self.assertFalse(os.path.isfile(unsigned))
self.assertTrue(fdroidserver.common.verify_apk_signature(signed))
+ # now sign an APK with minSdkVersion >= 18
+ unsigned = os.path.join(testdir, 'duplicate.permisssions_9999999-unsigned.apk')
+ signed = os.path.join(testdir, 'duplicate.permisssions_9999999.apk')
+ shutil.copy(os.path.join(self.basedir, 'repo', 'duplicate.permisssions_9999999.apk'),
+ os.path.join(unsigned))
+ fdroidserver.common.apk_strip_signatures(unsigned, strip_manifest=True)
+ fdroidserver.common.sign_apk(unsigned, signed, config['keyalias'])
+ self.assertTrue(os.path.isfile(signed))
+ self.assertFalse(os.path.isfile(unsigned))
+ self.assertTrue(fdroidserver.common.verify_apk_signature(signed))
+ self.assertEqual(18, fdroidserver.common.get_minSdkVersion_aapt(signed))
+
def test_get_api_id_aapt(self):
config = dict()
def test_parse_androidmanifests_with_flavor(self):
source_files_dir = os.path.join(os.path.dirname(__file__), 'source-files')
+
app = fdroidserver.metadata.App()
build = fdroidserver.metadata.Build()
build.gradle = ['devVersion']
self.assertEqual(('0.95-dev', '949', 'org.fdroid.fdroid.dev'),
fdroidserver.common.parse_androidmanifests(paths, app))
+ app = fdroidserver.metadata.App()
+ build = fdroidserver.metadata.Build()
+ build.gradle = ['free']
+ app.builds = [build]
+ app.id = 'eu.siacs.conversations'
+ paths = [
+ os.path.join(source_files_dir, 'eu.siacs.conversations', 'build.gradle'),
+ ]
+ for path in paths:
+ self.assertTrue(os.path.isfile(path))
+ self.assertEqual(('1.23.1', '245', 'eu.siacs.conversations'),
+ fdroidserver.common.parse_androidmanifests(paths, app))
+
+ app = fdroidserver.metadata.App()
+ build = fdroidserver.metadata.Build()
+ build.gradle = ['generic']
+ app.builds = [build]
+ app.id = 'com.nextcloud.client'
+ paths = [
+ os.path.join(source_files_dir, 'com.nextcloud.client', 'build.gradle'),
+ ]
+ for path in paths:
+ self.assertTrue(os.path.isfile(path))
+ self.assertEqual(('2.0.0', '20000099', 'com.nextcloud.client'),
+ fdroidserver.common.parse_androidmanifests(paths, app))
+
+ app = fdroidserver.metadata.App()
+ build = fdroidserver.metadata.Build()
+ build.gradle = ['versionDev']
+ app.builds = [build]
+ app.id = 'com.nextcloud.android.beta'
+ paths = [
+ os.path.join(source_files_dir, 'com.nextcloud.client', 'build.gradle'),
+ ]
+ for path in paths:
+ self.assertTrue(os.path.isfile(path))
+ self.assertEqual(('20171223', '20171223', 'com.nextcloud.android.beta'),
+ fdroidserver.common.parse_androidmanifests(paths, app))
+
+ app = fdroidserver.metadata.App()
+ build = fdroidserver.metadata.Build()
+ build.gradle = ['standard']
+ app.builds = [build]
+ app.id = 'at.bitfire.davdroid'
+ paths = [
+ os.path.join(source_files_dir, 'at.bitfire.davdroid', 'build.gradle'),
+ ]
+ for path in paths:
+ self.assertTrue(os.path.isfile(path))
+ self.assertEqual(('1.9.8.1-ose', '197', 'at.bitfire.davdroid'),
+ fdroidserver.common.parse_androidmanifests(paths, app))
+
if __name__ == "__main__":
parser = optparse.OptionParser()