From 37f37ebd88e79ebe93239b72ed5503d5bde13f4b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 9 Jun 2020 22:19:06 +0200 Subject: [PATCH] use default accepted_formats since all the files are .yml anyway --- .gitlab-ci.yml | 7 +++---- tests/androguard_test.py | 1 - tests/config.py | 1 - tests/dump_internal_metadata_format.py | 7 ++++++- tests/lint.TestCase | 5 ----- tests/metadata.TestCase | 12 +++--------- tests/run-tests | 11 ----------- tests/update.TestCase | 13 ------------- 8 files changed, 12 insertions(+), 45 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7d00a05..277c6162 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ test: - cd tests - ./complete-ci-tests -# Test that the parsing of the .txt format didn't change from last +# Test that the parsing of the .yml metadata format didn't change from last # released version. This uses the commit ID of the release tags, # rather than the release tag itself so that contributor forks do not # need to include the tags in them for this test to work. @@ -22,19 +22,18 @@ metadata_v0: variables: RELEASE_COMMIT_ID: 4655e2e24ebd043be6faa4adf552db391caf2be9 # 1.1a~ script: - - git fetch https://gitlab.com/fdroid/fdroidserver $RELEASE_COMMIT_ID + - git fetch https://gitlab.com/fdroid/fdroidserver.git $RELEASE_COMMIT_ID - cd tests - export GITCOMMIT=`git describe` - git checkout $RELEASE_COMMIT_ID - cd .. - - git clone --depth 1 https://gitlab.com/fdroid/fdroiddata + - git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git - cd fdroiddata - ../tests/dump_internal_metadata_format.py - cd .. - git reset --hard - git checkout $GITCOMMIT - cd fdroiddata - - echo "accepted_formats = ('txt', 'yml')" >> config.py - ../tests/dump_internal_metadata_format.py - sed -i -e '/kivy:\sfalse/d' diff --git a/tests/androguard_test.py b/tests/androguard_test.py index c708b85f..162dffb3 100644 --- a/tests/androguard_test.py +++ b/tests/androguard_test.py @@ -41,7 +41,6 @@ class UpdateTest(unittest.TestCase): raise Exception('This test must be run in the "tests/" subdir') config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config diff --git a/tests/config.py b/tests/config.py index 745fb9d6..ead06f91 100644 --- a/tests/config.py +++ b/tests/config.py @@ -31,7 +31,6 @@ mirrors = ( ) update_stats = True -accepted_formats = ('json', 'txt', 'yml') install_list = 'org.adaway' uninstall_list = ('com.android.vending', 'com.facebook.orca', ) diff --git a/tests/dump_internal_metadata_format.py b/tests/dump_internal_metadata_format.py index 6b657b06..50a4cd20 100755 --- a/tests/dump_internal_metadata_format.py +++ b/tests/dump_internal_metadata_format.py @@ -1,5 +1,10 @@ #!/usr/bin/env python3 # +# Test that the parsing of the .yml metadata format didn't change from last +# released version. This uses the commit ID of the release tags, +# rather than the release tag itself so that contributor forks do not +# need to include the tags in them for this test to work. +# # This is for running manual tests when changing the metadata format. # The idea is to test changes using all of the files in # fdroiddata.git. To run it, do: @@ -71,7 +76,7 @@ if not os.path.isdir('metadata'): config = dict() config['sdk_path'] = os.getenv('ANDROID_HOME') or '/opt/android-sdk' config['ndk_paths'] = dict() -config['accepted_formats'] = ['txt'] +config['accepted_formats'] = ['yml'] fdroidserver.common.config = config repo = git.Repo(localmodule) diff --git a/tests/lint.TestCase b/tests/lint.TestCase index 783b6f1f..09aca89f 100755 --- a/tests/lint.TestCase +++ b/tests/lint.TestCase @@ -34,11 +34,6 @@ class LintTest(unittest.TestCase): os.chdir(self.basedir) def test_check_for_unsupported_metadata_files(self): - config = dict() - fdroidserver.common.fill_config_defaults(config) - config['accepted_formats'] = ('txt', 'yml') - fdroidserver.common.config = config - fdroidserver.lint.config = config self.assertTrue(fdroidserver.lint.check_for_unsupported_metadata_files()) tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, diff --git a/tests/metadata.TestCase b/tests/metadata.TestCase index ab636a35..3799e48c 100755 --- a/tests/metadata.TestCase +++ b/tests/metadata.TestCase @@ -108,12 +108,8 @@ class MetadataTest(unittest.TestCase): self.maxDiff = None - # these need to be set to prevent code running on None, only - # 'accepted_formats' is actually used in metadata.py config = dict() - config['sdk_path'] = '/opt/android-sdk' - config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] + fdroidserver.common.fill_config_defaults(config) fdroidserver.common.config = config fdroidserver.metadata.warnings_action = None @@ -134,7 +130,7 @@ class MetadataTest(unittest.TestCase): def test_rewrite_yaml_fakeotaupdate(self): testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) - fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']} + fdroidserver.common.config = {'accepted_formats': ['yml']} fdroidserver.metadata.warnings_action = None # rewrite metadata @@ -151,7 +147,7 @@ class MetadataTest(unittest.TestCase): def test_rewrite_yaml_fdroidclient(self): testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) - fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']} + fdroidserver.common.config = {'accepted_formats': ['yml']} # rewrite metadata allapps = fdroidserver.metadata.read_metadata(xref=True) @@ -167,7 +163,6 @@ class MetadataTest(unittest.TestCase): def test_rewrite_yaml_special_build_params(self): testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) - fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']} # rewrite metadata allapps = fdroidserver.metadata.read_metadata(xref=True) @@ -229,7 +224,6 @@ class MetadataTest(unittest.TestCase): testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) metadatadir = os.path.join(testdir, 'metadata') os.makedirs(metadatadir) - fdroidserver.common.config = {'accepted_formats': ['txt']} randomlist = [] randomapps = glob.glob(os.path.join(self.basedir, 'metadata', '*.yml')) diff --git a/tests/run-tests b/tests/run-tests index b6a43c0d..f3533bd3 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -167,7 +167,6 @@ if which zipalign || ls -1 $ANDROID_HOME/build-tools/*/zipalign; then $fdroid init --keystore keystore.jks --repo-keyalias=sova echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py - echo "accepted_formats = ['txt', 'yml']" >> config.py echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py test -d archive || mkdir archive test -d metadata || mkdir metadata @@ -252,7 +251,6 @@ fdroid_init_with_prebuilt_keystore cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME chmod 0700 $GNUPGHOME -echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py echo "install_list = 'org.adaway'" >> config.py echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py echo "gpghome = '$GNUPGHOME'" >> config.py @@ -293,7 +291,6 @@ echo_header 'test moving lots of APKs to the archive' REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore -echo "accepted_formats = ['txt']" >> config.py $sed -i.tmp '/allow_disabled_algorithms/d' config.py test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/*.txt metadata/ @@ -325,7 +322,6 @@ if ! which apksigner; then REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore - echo "accepted_formats = ['txt']" >> config.py test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ test -d repo || mkdir repo @@ -411,7 +407,6 @@ echo_header 'test moving old APKs to and from the archive' REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore -echo "accepted_formats = ['txt']" >> config.py test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ $sed -i.tmp '/Archive Policy:/d' metadata/com.politedroid.txt @@ -492,7 +487,6 @@ echo_header 'test allowing disabled signatures in repo and archive' REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore -echo "accepted_formats = ['txt']" >> config.py echo 'allow_disabled_algorithms = True' >> config.py $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py test -d metadata || mkdir metadata @@ -586,7 +580,6 @@ echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed' REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore -echo "accepted_formats = ['txt', 'yml']" >> config.py echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/ @@ -873,7 +866,6 @@ cd $REPOROOT fdroid_init_with_prebuilt_keystore mkdir $REPOROOT/metadata cp -a $WORKSPACE/tests/metadata/obb.mainpatch.current.yml $REPOROOT/metadata -echo "accepted_formats = ['txt']" >> config.py cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/ cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/ $fdroid update --pretty @@ -1029,7 +1021,6 @@ cd $REPOROOT fdroid_init_with_prebuilt_keystore cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py -echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py $fdroid update --verbose if have_git_2_3; then $fdroid server update --verbose @@ -1182,7 +1173,6 @@ if have_git_2_3; then echo "mirrors = ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.py echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py - echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py $fdroid update --pretty grep -F '' repo/index.xml @@ -1215,7 +1205,6 @@ echo_header 'test extracting and publishing with developer signature' REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore -echo "accepted_formats = ['txt']" >> config.py echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ diff --git a/tests/update.TestCase b/tests/update.TestCase index e3d9ef53..1465ad57 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -47,7 +47,6 @@ class UpdateTest(unittest.TestCase): def testInsertStoreMetadata(self): config = dict() fdroidserver.common.fill_config_defaults(config) - config['accepted_formats'] = ('txt', 'yml') fdroidserver.update.config = config fdroidserver.update.options = fdroidserver.common.options os.chdir(os.path.join(localmodule, 'tests')) @@ -170,7 +169,6 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) - config['accepted_formats'] = ('yml') fdroidserver.common.config = config fdroidserver.update.config = config fdroidserver.update.options = fdroidserver.common.options @@ -201,11 +199,6 @@ class UpdateTest(unittest.TestCase): shutil.copytree(os.path.join(self.basedir, 'triple-t-2'), tmptestsdir) os.chdir(tmptestsdir) - config = dict() - fdroidserver.common.fill_config_defaults(config) - config['accepted_formats'] = ('yml') - fdroidserver.common.config = config - fdroidserver.update.config = config fdroidserver.update.options = fdroidserver.common.options apps = fdroidserver.metadata.read_metadata(xref=True) @@ -344,7 +337,6 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config @@ -402,7 +394,6 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config @@ -592,7 +583,6 @@ class UpdateTest(unittest.TestCase): raise Exception('This test must be run in the "tests/" subdir') config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config @@ -646,7 +636,6 @@ class UpdateTest(unittest.TestCase): fdroidserver.update.config = config config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config @@ -765,7 +754,6 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config @@ -801,7 +789,6 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config