mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
tests: allow the full suite to run without aapt, only androguard
This commit is contained in:
parent
cf1ce46e5c
commit
77f7ca2f25
1 changed files with 36 additions and 25 deletions
|
|
@ -6,11 +6,19 @@ echo_header() {
|
||||||
{ echo -e "==============================================================================\n$1"; } 2>/dev/null
|
{ echo -e "==============================================================================\n$1"; } 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_fdroid_apk_filename() {
|
||||||
|
if [ -z $aapt ]; then
|
||||||
|
python3 -c "from androguard.core.bytecodes.apk import APK; a=APK('$1'); print(a.package+'_'+a.get_androidversion_code()+'.apk')"
|
||||||
|
else
|
||||||
|
$aapt dump badging "$1" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
copy_apks_into_repo() {
|
copy_apks_into_repo() {
|
||||||
set +x
|
set +x
|
||||||
find $APKDIR -type f -name '*.apk' -print0 | while IFS= read -r -d '' f; do
|
find $APKDIR -type f -name '*.apk' -print0 | while IFS= read -r -d '' f; do
|
||||||
echo $f | grep -F -v -e unaligned -e unsigned -e badsig -e badcert -e bad-unicode -e janus.apk || continue
|
echo $f | grep -F -v -e unaligned -e unsigned -e badsig -e badcert -e bad-unicode -e janus.apk || continue
|
||||||
apk=`$aapt dump badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
|
apk=`get_fdroid_apk_filename "$f"`
|
||||||
test "$f" -nt repo/$apk && rm -f repo/$apk # delete existing if $f is newer
|
test "$f" -nt repo/$apk && rm -f repo/$apk # delete existing if $f is newer
|
||||||
if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
|
if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
|
||||||
echo "$f --> repo/$apk"
|
echo "$f --> repo/$apk"
|
||||||
|
|
@ -720,8 +728,8 @@ $fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
echo_header "check that 'fdroid init' fails when build-tools cannot be found"
|
echo_header "check that 'fdroid init' fails when build-tools cannot be found"
|
||||||
|
|
||||||
if [ -e /usr/bin/aapt ]; then
|
if [ -e /usr/bin/aapt ] || python3 -c 'import androguard'; then
|
||||||
echo "/usr/bin/aapt exists, not running test"
|
echo "/usr/bin/aapt or androguard installed, not running test"
|
||||||
else
|
else
|
||||||
REPOROOT=`create_test_dir`
|
REPOROOT=`create_test_dir`
|
||||||
FAKE_ANDROID_HOME=`create_test_dir`
|
FAKE_ANDROID_HOME=`create_test_dir`
|
||||||
|
|
@ -760,29 +768,32 @@ set -e
|
||||||
# by --android-home over the one in ANDROID_HOME, therefore if it uses the one
|
# by --android-home over the one in ANDROID_HOME, therefore if it uses the one
|
||||||
# in ANDROID_HOME, it won't work because it is a fake one. Only
|
# in ANDROID_HOME, it won't work because it is a fake one. Only
|
||||||
# --android-home provides a working one.
|
# --android-home provides a working one.
|
||||||
echo_header "setup a new repo from scratch with keystore and android-home set on cmd line"
|
if [ -z "$ANDROID_HOME" ]; then
|
||||||
|
echo_header "SKIP setup a new repo from scratch with keystore and android-home set on cmd line"
|
||||||
REPOROOT=`create_test_dir`
|
else
|
||||||
KEYSTORE=$REPOROOT/keystore.jks
|
echo_header "setup a new repo from scratch with keystore and android-home set on cmd line"
|
||||||
FAKE_ANDROID_HOME=`create_test_dir`
|
|
||||||
create_fake_android_home $FAKE_ANDROID_HOME
|
|
||||||
STORED_ANDROID_HOME=$ANDROID_HOME
|
|
||||||
unset ANDROID_HOME
|
|
||||||
echo "ANDROID_HOME: $ANDROID_HOME"
|
|
||||||
cd $REPOROOT
|
|
||||||
$fdroid init --keystore $KEYSTORE --android-home $STORED_ANDROID_HOME --no-prompt
|
|
||||||
test -e $KEYSTORE
|
|
||||||
copy_apks_into_repo $REPOROOT
|
|
||||||
$fdroid update --create-metadata --verbose
|
|
||||||
$fdroid readmeta
|
|
||||||
grep -F '<application id=' repo/index.xml > /dev/null
|
|
||||||
test -e repo/index.xml
|
|
||||||
test -e repo/index.jar
|
|
||||||
test -e repo/index-v1.jar
|
|
||||||
test -e tmp/apkcache
|
|
||||||
! test -z tmp/apkcache
|
|
||||||
export ANDROID_HOME=$STORED_ANDROID_HOME
|
|
||||||
|
|
||||||
|
REPOROOT=`create_test_dir`
|
||||||
|
KEYSTORE=$REPOROOT/keystore.jks
|
||||||
|
FAKE_ANDROID_HOME=`create_test_dir`
|
||||||
|
create_fake_android_home $FAKE_ANDROID_HOME
|
||||||
|
STORED_ANDROID_HOME=$ANDROID_HOME
|
||||||
|
unset ANDROID_HOME
|
||||||
|
echo "ANDROID_HOME: $ANDROID_HOME"
|
||||||
|
cd $REPOROOT
|
||||||
|
$fdroid init --keystore $KEYSTORE --android-home $STORED_ANDROID_HOME --no-prompt
|
||||||
|
test -e $KEYSTORE
|
||||||
|
copy_apks_into_repo $REPOROOT
|
||||||
|
$fdroid update --create-metadata --verbose
|
||||||
|
$fdroid readmeta
|
||||||
|
grep -F '<application id=' repo/index.xml > /dev/null
|
||||||
|
test -e repo/index.xml
|
||||||
|
test -e repo/index.jar
|
||||||
|
test -e repo/index-v1.jar
|
||||||
|
test -e tmp/apkcache
|
||||||
|
! test -z tmp/apkcache
|
||||||
|
export ANDROID_HOME=$STORED_ANDROID_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
echo_header "check duplicate files are properly handled by fdroid update"
|
echo_header "check duplicate files are properly handled by fdroid update"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue