diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 9225c241..bc2583fc 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -117,6 +117,10 @@ def get_all_icon_dirs(repodir): yield get_icon_dir(repodir, density) +def disabled_algorithms_allowed(): + return options.allow_disabled_algorithms or config['allow_disabled_algorithms'] + + def update_wiki(apps, sortedids, apks): """Update the wiki @@ -460,7 +464,7 @@ def get_cache(): """ apkcachefile = get_cache_file() - ada = options.allow_disabled_algorithms or config['allow_disabled_algorithms'] + ada = disabled_algorithms_allowed() if not options.clean and os.path.exists(apkcachefile): with open(apkcachefile) as fp: apkcache = json.load(fp, object_pairs_hook=collections.OrderedDict) @@ -1598,7 +1602,7 @@ def process_apks(apkcache, repodir, knownapks, use_date_from_apk=False): apks = [] for apkfile in sorted(glob.glob(os.path.join(repodir, '*.apk'))): apkfilename = apkfile[len(repodir) + 1:] - ada = options.allow_disabled_algorithms or config['allow_disabled_algorithms'] + ada = disabled_algorithms_allowed() (skip, apk, cachethis) = process_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk, ada, True) if skip: @@ -1857,7 +1861,7 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi break if 'antiFeatures' not in apk: keep.append(apk) - elif 'DisabledAlgorithm' not in apk['antiFeatures']: + elif 'DisabledAlgorithm' not in apk['antiFeatures'] or disabled_algorithms_allowed(): keep.append(apk) # actually move apks to the target section diff --git a/tests/run-tests b/tests/run-tests index 16ec8bb3..7ae22fe9 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -555,6 +555,30 @@ if ! which apksigner; then test -e repo/com.politedroid_6.apk fi +# test unarchiving when disabled_algorithms are allowed again +echo 'allow_disabled_algorithms = True' >> config.py +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 2 +test `grep '' repo/index.xml | wc -l` -eq 6 +grep -F com.politedroid_3.apk archive/index.xml +grep -F com.politedroid_4.apk repo/index.xml +grep -F com.politedroid_5.apk repo/index.xml +grep -F com.politedroid_6.apk repo/index.xml +grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml +grep -F org.bitbucket.tickytacky.mirrormirror_2.apk repo/index.xml +grep -F org.bitbucket.tickytacky.mirrormirror_3.apk repo/index.xml +grep -F org.bitbucket.tickytacky.mirrormirror_4.apk repo/index.xml +! grep -F urzip-badsig.apk repo/index.xml +! grep -F urzip-badsig.apk archive/index.xml +test -e archive/com.politedroid_3.apk +test -e repo/com.politedroid_4.apk +test -e repo/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk +test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk +test -e repo/org.bitbucket.tickytacky.mirrormirror_2.apk +test -e repo/org.bitbucket.tickytacky.mirrormirror_3.apk +test -e repo/org.bitbucket.tickytacky.mirrormirror_4.apk +test -e archive/urzip-badsig.apk #------------------------------------------------------------------------------# echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed'