use default accepted_formats since all the files are .yml anyway

This commit is contained in:
Hans-Christoph Steiner 2020-06-09 22:19:06 +02:00
parent 1b90aec697
commit 37f37ebd88
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
8 changed files with 12 additions and 45 deletions

View File

@ -10,7 +10,7 @@ test:
- cd tests - cd tests
- ./complete-ci-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, # released version. This uses the commit ID of the release tags,
# rather than the release tag itself so that contributor forks do not # rather than the release tag itself so that contributor forks do not
# need to include the tags in them for this test to work. # need to include the tags in them for this test to work.
@ -22,19 +22,18 @@ metadata_v0:
variables: variables:
RELEASE_COMMIT_ID: 4655e2e24ebd043be6faa4adf552db391caf2be9 # 1.1a~ RELEASE_COMMIT_ID: 4655e2e24ebd043be6faa4adf552db391caf2be9 # 1.1a~
script: script:
- git fetch https://gitlab.com/fdroid/fdroidserver $RELEASE_COMMIT_ID - git fetch https://gitlab.com/fdroid/fdroidserver.git $RELEASE_COMMIT_ID
- cd tests - cd tests
- export GITCOMMIT=`git describe` - export GITCOMMIT=`git describe`
- git checkout $RELEASE_COMMIT_ID - git checkout $RELEASE_COMMIT_ID
- cd .. - cd ..
- git clone --depth 1 https://gitlab.com/fdroid/fdroiddata - git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git
- cd fdroiddata - cd fdroiddata
- ../tests/dump_internal_metadata_format.py - ../tests/dump_internal_metadata_format.py
- cd .. - cd ..
- git reset --hard - git reset --hard
- git checkout $GITCOMMIT - git checkout $GITCOMMIT
- cd fdroiddata - cd fdroiddata
- echo "accepted_formats = ('txt', 'yml')" >> config.py
- ../tests/dump_internal_metadata_format.py - ../tests/dump_internal_metadata_format.py
- sed -i - sed -i
-e '/kivy:\sfalse/d' -e '/kivy:\sfalse/d'

View File

@ -41,7 +41,6 @@ class UpdateTest(unittest.TestCase):
raise Exception('This test must be run in the "tests/" subdir') raise Exception('This test must be run in the "tests/" subdir')
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config

View File

@ -31,7 +31,6 @@ mirrors = (
) )
update_stats = True update_stats = True
accepted_formats = ('json', 'txt', 'yml')
install_list = 'org.adaway' install_list = 'org.adaway'
uninstall_list = ('com.android.vending', 'com.facebook.orca', ) uninstall_list = ('com.android.vending', 'com.facebook.orca', )

View File

@ -1,5 +1,10 @@
#!/usr/bin/env python3 #!/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. # This is for running manual tests when changing the metadata format.
# The idea is to test changes using all of the files in # The idea is to test changes using all of the files in
# fdroiddata.git. To run it, do: # fdroiddata.git. To run it, do:
@ -71,7 +76,7 @@ if not os.path.isdir('metadata'):
config = dict() config = dict()
config['sdk_path'] = os.getenv('ANDROID_HOME') or '/opt/android-sdk' config['sdk_path'] = os.getenv('ANDROID_HOME') or '/opt/android-sdk'
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['txt'] config['accepted_formats'] = ['yml']
fdroidserver.common.config = config fdroidserver.common.config = config
repo = git.Repo(localmodule) repo = git.Repo(localmodule)

View File

@ -34,11 +34,6 @@ class LintTest(unittest.TestCase):
os.chdir(self.basedir) os.chdir(self.basedir)
def test_check_for_unsupported_metadata_files(self): 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()) self.assertTrue(fdroidserver.lint.check_for_unsupported_metadata_files())
tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name,

View File

@ -108,12 +108,8 @@ class MetadataTest(unittest.TestCase):
self.maxDiff = None 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 = dict()
config['sdk_path'] = '/opt/android-sdk' fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.metadata.warnings_action = None fdroidserver.metadata.warnings_action = None
@ -134,7 +130,7 @@ class MetadataTest(unittest.TestCase):
def test_rewrite_yaml_fakeotaupdate(self): def test_rewrite_yaml_fakeotaupdate(self):
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) 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 fdroidserver.metadata.warnings_action = None
# rewrite metadata # rewrite metadata
@ -151,7 +147,7 @@ class MetadataTest(unittest.TestCase):
def test_rewrite_yaml_fdroidclient(self): def test_rewrite_yaml_fdroidclient(self):
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) 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 # rewrite metadata
allapps = fdroidserver.metadata.read_metadata(xref=True) allapps = fdroidserver.metadata.read_metadata(xref=True)
@ -167,7 +163,6 @@ class MetadataTest(unittest.TestCase):
def test_rewrite_yaml_special_build_params(self): def test_rewrite_yaml_special_build_params(self):
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']}
# rewrite metadata # rewrite metadata
allapps = fdroidserver.metadata.read_metadata(xref=True) 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) testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
metadatadir = os.path.join(testdir, 'metadata') metadatadir = os.path.join(testdir, 'metadata')
os.makedirs(metadatadir) os.makedirs(metadatadir)
fdroidserver.common.config = {'accepted_formats': ['txt']}
randomlist = [] randomlist = []
randomapps = glob.glob(os.path.join(self.basedir, 'metadata', '*.yml')) randomapps = glob.glob(os.path.join(self.basedir, 'metadata', '*.yml'))

View File

@ -167,7 +167,6 @@ if which zipalign || ls -1 $ANDROID_HOME/build-tools/*/zipalign; then
$fdroid init --keystore keystore.jks --repo-keyalias=sova $fdroid init --keystore keystore.jks --repo-keyalias=sova
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
echo 'keypass = "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 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
test -d archive || mkdir archive test -d archive || mkdir archive
test -d metadata || mkdir metadata 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/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
chmod 0700 $GNUPGHOME chmod 0700 $GNUPGHOME
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
echo "install_list = 'org.adaway'" >> config.py echo "install_list = 'org.adaway'" >> config.py
echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py
echo "gpghome = '$GNUPGHOME'" >> 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` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
echo "accepted_formats = ['txt']" >> config.py
$sed -i.tmp '/allow_disabled_algorithms/d' config.py $sed -i.tmp '/allow_disabled_algorithms/d' config.py
test -d metadata || mkdir metadata test -d metadata || mkdir metadata
cp $WORKSPACE/tests/metadata/*.txt metadata/ cp $WORKSPACE/tests/metadata/*.txt metadata/
@ -325,7 +322,6 @@ if ! which apksigner; then
REPOROOT=`create_test_dir` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
echo "accepted_formats = ['txt']" >> config.py
test -d metadata || mkdir metadata test -d metadata || mkdir metadata
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
test -d repo || mkdir repo test -d repo || mkdir repo
@ -411,7 +407,6 @@ echo_header 'test moving old APKs to and from the archive'
REPOROOT=`create_test_dir` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
echo "accepted_formats = ['txt']" >> config.py
test -d metadata || mkdir metadata test -d metadata || mkdir metadata
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
$sed -i.tmp '/Archive Policy:/d' metadata/com.politedroid.txt $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` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
echo "accepted_formats = ['txt']" >> config.py
echo 'allow_disabled_algorithms = True' >> config.py echo 'allow_disabled_algorithms = True' >> config.py
$sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py
test -d metadata || mkdir metadata 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` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore 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 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
test -d metadata || mkdir metadata test -d metadata || mkdir metadata
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/ cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
@ -873,7 +866,6 @@ cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
mkdir $REPOROOT/metadata mkdir $REPOROOT/metadata
cp -a $WORKSPACE/tests/metadata/obb.mainpatch.current.yml $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.apk $REPOROOT/repo/
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/ cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
$fdroid update --pretty $fdroid update --pretty
@ -1029,7 +1021,6 @@ cd $REPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
$fdroid update --verbose $fdroid update --verbose
if have_git_2_3; then if have_git_2_3; then
$fdroid server update --verbose $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 "mirrors = ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.py
echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
$fdroid update --pretty $fdroid update --pretty
grep -F '<application id=' repo/index.xml > /dev/null grep -F '<application id=' repo/index.xml > /dev/null
grep -F '/fdroid/repo</mirror>' repo/index.xml grep -F '/fdroid/repo</mirror>' repo/index.xml
@ -1215,7 +1205,6 @@ echo_header 'test extracting and publishing with developer signature'
REPOROOT=`create_test_dir` REPOROOT=`create_test_dir`
cd $REPOROOT cd $REPOROOT
fdroid_init_with_prebuilt_keystore 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 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
test -d metadata || mkdir metadata test -d metadata || mkdir metadata
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/

View File

@ -47,7 +47,6 @@ class UpdateTest(unittest.TestCase):
def testInsertStoreMetadata(self): def testInsertStoreMetadata(self):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['accepted_formats'] = ('txt', 'yml')
fdroidserver.update.config = config fdroidserver.update.config = config
fdroidserver.update.options = fdroidserver.common.options fdroidserver.update.options = fdroidserver.common.options
os.chdir(os.path.join(localmodule, 'tests')) os.chdir(os.path.join(localmodule, 'tests'))
@ -170,7 +169,6 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['accepted_formats'] = ('yml')
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config
fdroidserver.update.options = fdroidserver.common.options 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) shutil.copytree(os.path.join(self.basedir, 'triple-t-2'), tmptestsdir)
os.chdir(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 fdroidserver.update.options = fdroidserver.common.options
apps = fdroidserver.metadata.read_metadata(xref=True) apps = fdroidserver.metadata.read_metadata(xref=True)
@ -344,7 +337,6 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config
@ -402,7 +394,6 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.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') raise Exception('This test must be run in the "tests/" subdir')
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config
@ -646,7 +636,6 @@ class UpdateTest(unittest.TestCase):
fdroidserver.update.config = config fdroidserver.update.config = config
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config
@ -765,7 +754,6 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config
@ -801,7 +789,6 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config