mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
purge common.use_androguard, it is now used by default
Up until now, the buildserver has not included androguard. Since a good version of androguard (v3.3.3+) is included in stretch-backports and the buildserver is already setup to use stretch-backports, this sets up the buildserver with androguard. closes #627
This commit is contained in:
parent
aa80662642
commit
fd41b70e27
@ -49,6 +49,7 @@ apt-get upgrade --download-only
|
|||||||
apt-get upgrade
|
apt-get upgrade
|
||||||
|
|
||||||
packages="
|
packages="
|
||||||
|
androguard/stretch-backports
|
||||||
ant
|
ant
|
||||||
asn1c
|
asn1c
|
||||||
ant-contrib
|
ant-contrib
|
||||||
@ -99,6 +100,7 @@ packages="
|
|||||||
python-magic
|
python-magic
|
||||||
python-pip
|
python-pip
|
||||||
python-setuptools
|
python-setuptools
|
||||||
|
python3-asn1crypto/stretch-backports
|
||||||
python3-defusedxml
|
python3-defusedxml
|
||||||
python3-git
|
python3-git
|
||||||
python3-gitdb
|
python3-gitdb
|
||||||
|
@ -75,46 +75,44 @@ def main():
|
|||||||
# in ANDROID_HOME if that exists, otherwise None
|
# in ANDROID_HOME if that exists, otherwise None
|
||||||
if options.android_home is not None:
|
if options.android_home is not None:
|
||||||
test_config['sdk_path'] = options.android_home
|
test_config['sdk_path'] = options.android_home
|
||||||
elif common.use_androguard():
|
|
||||||
pass
|
|
||||||
elif not common.test_sdk_exists(test_config):
|
elif not common.test_sdk_exists(test_config):
|
||||||
if os.path.isfile('/usr/bin/aapt'):
|
# if neither --android-home nor the default sdk_path
|
||||||
# remove sdk_path and build_tools, they are not required
|
# exist, prompt the user using platform-specific default
|
||||||
test_config.pop('sdk_path', None)
|
# and if the user leaves it blank, ignore and move on.
|
||||||
test_config.pop('build_tools', None)
|
default_sdk_path = ''
|
||||||
# make sure at least aapt is found, since this can't do anything without it
|
if sys.platform == 'win32' or sys.platform == 'cygwin':
|
||||||
test_config['aapt'] = common.find_sdk_tools_cmd('aapt')
|
p = os.path.join(os.getenv('USERPROFILE'),
|
||||||
|
'AppData', 'Local', 'Android', 'android-sdk')
|
||||||
|
elif sys.platform == 'darwin':
|
||||||
|
# on OSX, Homebrew is common and has an easy path to detect
|
||||||
|
p = '/usr/local/opt/android-sdk'
|
||||||
|
elif os.path.isdir('/usr/lib/android-sdk'):
|
||||||
|
# if the Debian packages are installed, suggest them
|
||||||
|
p = '/usr/lib/android-sdk'
|
||||||
else:
|
else:
|
||||||
# if neither --android-home nor the default sdk_path
|
p = '/opt/android-sdk'
|
||||||
# exist, prompt the user using platform-specific default
|
if os.path.exists(p):
|
||||||
default_sdk_path = '/opt/android-sdk'
|
default_sdk_path = p
|
||||||
if sys.platform == 'win32' or sys.platform == 'cygwin':
|
|
||||||
p = os.path.join(os.getenv('USERPROFILE'),
|
|
||||||
'AppData', 'Local', 'Android', 'android-sdk')
|
|
||||||
elif sys.platform == 'darwin':
|
|
||||||
# on OSX, Homebrew is common and has an easy path to detect
|
|
||||||
p = '/usr/local/opt/android-sdk'
|
|
||||||
else:
|
|
||||||
# if the Debian packages are installed, suggest them
|
|
||||||
p = '/usr/lib/android-sdk'
|
|
||||||
if os.path.exists(p):
|
|
||||||
default_sdk_path = p
|
|
||||||
|
|
||||||
while not options.no_prompt:
|
while not options.no_prompt:
|
||||||
try:
|
try:
|
||||||
s = input(_('Enter the path to the Android SDK (%s) here:\n> ') % default_sdk_path)
|
s = input(_('Enter the path to the Android SDK (%s) here:\n> ') % default_sdk_path)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('')
|
print('')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if re.match(r'^\s*$', s) is not None:
|
if re.match(r'^\s*$', s) is not None:
|
||||||
test_config['sdk_path'] = default_sdk_path
|
test_config['sdk_path'] = default_sdk_path
|
||||||
else:
|
else:
|
||||||
test_config['sdk_path'] = s
|
test_config['sdk_path'] = s
|
||||||
if common.test_sdk_exists(test_config):
|
if not default_sdk_path:
|
||||||
break
|
del(test_config['sdk_path'])
|
||||||
if (options.android_home is not None or not common.use_androguard()) \
|
break
|
||||||
and not common.test_sdk_exists(test_config):
|
if common.test_sdk_exists(test_config):
|
||||||
raise FDroidException("Android SDK not found.")
|
break
|
||||||
|
|
||||||
|
if test_config.get('sdk_path') and not common.test_sdk_exists(test_config):
|
||||||
|
raise FDroidException(_("Android SDK not found at {path}!")
|
||||||
|
.format(path=test_config['sdk_path']))
|
||||||
|
|
||||||
if not os.path.exists('config.py'):
|
if not os.path.exists('config.py'):
|
||||||
# 'metadata' and 'tmp' are created in fdroid
|
# 'metadata' and 'tmp' are created in fdroid
|
||||||
@ -134,31 +132,6 @@ def main():
|
|||||||
logging.info('Try running `fdroid init` in an empty directory.')
|
logging.info('Try running `fdroid init` in an empty directory.')
|
||||||
raise FDroidException('Repository already exists.')
|
raise FDroidException('Repository already exists.')
|
||||||
|
|
||||||
if common.use_androguard():
|
|
||||||
pass
|
|
||||||
elif 'aapt' not in test_config or not os.path.isfile(test_config['aapt']):
|
|
||||||
# try to find a working aapt, in all the recent possible paths
|
|
||||||
build_tools = os.path.join(test_config['sdk_path'], 'build-tools')
|
|
||||||
aaptdirs = []
|
|
||||||
aaptdirs.append(os.path.join(build_tools, test_config['build_tools']))
|
|
||||||
aaptdirs.append(build_tools)
|
|
||||||
for f in os.listdir(build_tools):
|
|
||||||
if os.path.isdir(os.path.join(build_tools, f)):
|
|
||||||
aaptdirs.append(os.path.join(build_tools, f))
|
|
||||||
for d in sorted(aaptdirs, reverse=True):
|
|
||||||
if os.path.isfile(os.path.join(d, 'aapt')):
|
|
||||||
aapt = os.path.join(d, 'aapt')
|
|
||||||
break
|
|
||||||
if aapt and os.path.isfile(aapt):
|
|
||||||
dirname = os.path.basename(os.path.dirname(aapt))
|
|
||||||
if dirname == 'build-tools':
|
|
||||||
# this is the old layout, before versioned build-tools
|
|
||||||
test_config['build_tools'] = ''
|
|
||||||
else:
|
|
||||||
test_config['build_tools'] = dirname
|
|
||||||
common.write_to_config(test_config, 'build_tools')
|
|
||||||
common.ensure_build_tools_exists(test_config)
|
|
||||||
|
|
||||||
# now that we have a local config.py, read configuration...
|
# now that we have a local config.py, read configuration...
|
||||||
config = common.read_config(options)
|
config = common.read_config(options)
|
||||||
|
|
||||||
|
@ -746,16 +746,15 @@ class CommonTest(unittest.TestCase):
|
|||||||
('repo/urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk', 'info.guardianproject.urzip', '100', '0.1'),
|
('repo/urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk', 'info.guardianproject.urzip', '100', '0.1'),
|
||||||
]
|
]
|
||||||
for apkfilename, appid, versionCode, versionName in testcases:
|
for apkfilename, appid, versionCode, versionName in testcases:
|
||||||
|
a, vc, vn = fdroidserver.common.get_apk_id(apkfilename)
|
||||||
|
self.assertEqual(appid, a, 'androguard appid parsing failed for ' + apkfilename)
|
||||||
|
self.assertEqual(versionName, vn, 'androguard versionName parsing failed for ' + apkfilename)
|
||||||
|
self.assertEqual(versionCode, vc, 'androguard versionCode parsing failed for ' + apkfilename)
|
||||||
if 'aapt' in config:
|
if 'aapt' in config:
|
||||||
a, vc, vn = fdroidserver.common.get_apk_id_aapt(apkfilename)
|
a, vc, vn = fdroidserver.common.get_apk_id_aapt(apkfilename)
|
||||||
self.assertEqual(appid, a, 'aapt appid parsing failed for ' + apkfilename)
|
self.assertEqual(appid, a, 'aapt appid parsing failed for ' + apkfilename)
|
||||||
self.assertEqual(versionCode, vc, 'aapt versionCode parsing failed for ' + apkfilename)
|
self.assertEqual(versionCode, vc, 'aapt versionCode parsing failed for ' + apkfilename)
|
||||||
self.assertEqual(versionName, vn, 'aapt versionName parsing failed for ' + apkfilename)
|
self.assertEqual(versionName, vn, 'aapt versionName parsing failed for ' + apkfilename)
|
||||||
if fdroidserver.common.use_androguard():
|
|
||||||
a, vc, vn = fdroidserver.common.get_apk_id(apkfilename)
|
|
||||||
self.assertEqual(appid, a, 'androguard appid parsing failed for ' + apkfilename)
|
|
||||||
self.assertEqual(versionName, vn, 'androguard versionName parsing failed for ' + apkfilename)
|
|
||||||
self.assertEqual(versionCode, vc, 'androguard versionCode parsing failed for ' + apkfilename)
|
|
||||||
|
|
||||||
with self.assertRaises(FDroidException):
|
with self.assertRaises(FDroidException):
|
||||||
fdroidserver.common.get_apk_id('nope')
|
fdroidserver.common.get_apk_id('nope')
|
||||||
|
Loading…
Reference in New Issue
Block a user