test_sdk_exists to be based on apksigner, that's the requirement

Before, lots of pieces of the Android SDK were required for fdroidserver to
operate, like aapt, zipalign, etc.  Now, apksigner is the only requirement.

%"support APK Signature v2+"
!889
This commit is contained in:
Hans-Christoph Steiner 2021-04-15 09:02:53 +02:00
parent b470ad2a6f
commit 3757add164
2 changed files with 82 additions and 7 deletions

View file

@ -728,13 +728,16 @@ def test_aapt_version(aapt):
def test_sdk_exists(thisconfig):
if 'sdk_path' not in thisconfig:
# TODO convert this to apksigner once it is required
if 'aapt' in thisconfig and os.path.isfile(thisconfig['aapt']):
test_aapt_version(thisconfig['aapt'])
return True
else:
logging.error(_("'sdk_path' not set in config.yml!"))
return False
# check the 'apksigner' value in the config to see if its new enough
f = thisconfig.get('apksigner', '')
if os.path.isfile(f):
sdk_path = os.path.dirname(os.path.dirname(os.path.dirname(f)))
tmpconfig = {'sdk_path': sdk_path}
find_apksigner(tmpconfig)
if os.path.exists(tmpconfig.get('apksigner', '')):
return True
logging.error(_("'sdk_path' not set in config.yml!"))
return False
if thisconfig['sdk_path'] == default_config['sdk_path']:
logging.error(_('No Android SDK found!'))
logging.error(_('You can use ANDROID_HOME to set the path to your SDK, i.e.:'))
@ -748,6 +751,9 @@ def test_sdk_exists(thisconfig):
logging.critical(_("Android SDK path '{path}' is not a directory!")
.format(path=thisconfig['sdk_path']))
return False
find_apksigner(thisconfig)
if not os.path.exists(thisconfig.get('apksigner', '')):
return False
return True