mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
put .binary.apk files into sub-directory
This commit is contained in:
parent
fab02a49dc
commit
cdc2147de9
2 changed files with 26 additions and 17 deletions
|
@ -1026,6 +1026,7 @@ def main():
|
||||||
if not os.path.isdir(output_dir):
|
if not os.path.isdir(output_dir):
|
||||||
logging.info("Creating output directory")
|
logging.info("Creating output directory")
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
|
binaries_dir = os.path.join(output_dir, 'binaries')
|
||||||
|
|
||||||
if config['archive_older'] != 0:
|
if config['archive_older'] != 0:
|
||||||
also_check_dir = 'archive'
|
also_check_dir = 'archive'
|
||||||
|
@ -1142,12 +1143,18 @@ def main():
|
||||||
# binary. We get that binary now, and save it
|
# binary. We get that binary now, and save it
|
||||||
# alongside our built one in the 'unsigend'
|
# alongside our built one in the 'unsigend'
|
||||||
# directory.
|
# directory.
|
||||||
|
if not os.path.isdir(binaries_dir):
|
||||||
|
os.makedirs(binaries_dir)
|
||||||
|
logging.info("Created directory for storing "
|
||||||
|
"devleoper supplied reference "
|
||||||
|
"binaries: '{path}'"
|
||||||
|
.format(path=binaries_dir))
|
||||||
url = app.Binaries
|
url = app.Binaries
|
||||||
url = url.replace('%v', build.versionName)
|
url = url.replace('%v', build.versionName)
|
||||||
url = url.replace('%c', str(build.versionCode))
|
url = url.replace('%c', str(build.versionCode))
|
||||||
logging.info("...retrieving " + url)
|
logging.info("...retrieving " + url)
|
||||||
of = re.sub(r'.apk$', '.binary.apk', common.get_release_filename(app, build))
|
of = re.sub(r'.apk$', '.binary.apk', common.get_release_filename(app, build))
|
||||||
of = os.path.join(output_dir, of)
|
of = os.path.join(binaries_dir, of)
|
||||||
try:
|
try:
|
||||||
net.download_file(url, local_filename=of)
|
net.download_file(url, local_filename=of)
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
|
|
|
@ -178,6 +178,7 @@ def main():
|
||||||
if not os.path.isdir(unsigned_dir):
|
if not os.path.isdir(unsigned_dir):
|
||||||
logging.warning(_("No unsigned directory - nothing to do"))
|
logging.warning(_("No unsigned directory - nothing to do"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
binaries_dir = os.path.join(unsigned_dir, 'binaries')
|
||||||
|
|
||||||
if not os.path.exists(config['keystore']):
|
if not os.path.exists(config['keystore']):
|
||||||
logging.error("Config error - missing '{0}'".format(config['keystore']))
|
logging.error("Config error - missing '{0}'".format(config['keystore']))
|
||||||
|
@ -210,10 +211,6 @@ def main():
|
||||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))
|
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))
|
||||||
+ glob.glob(os.path.join(unsigned_dir, '*.zip'))):
|
+ glob.glob(os.path.join(unsigned_dir, '*.zip'))):
|
||||||
|
|
||||||
# skip over developer supplied reference binaries for reproducible builds
|
|
||||||
if apkfile.endswith('.binary.apk'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
appid, vercode = common.publishednameinfo(apkfile)
|
appid, vercode = common.publishednameinfo(apkfile)
|
||||||
apkfilename = os.path.basename(apkfile)
|
apkfilename = os.path.basename(apkfile)
|
||||||
if vercodes and appid not in vercodes:
|
if vercodes and appid not in vercodes:
|
||||||
|
@ -238,15 +235,20 @@ def main():
|
||||||
# version if everything checks out.
|
# version if everything checks out.
|
||||||
# The binary should already have been retrieved during the build
|
# The binary should already have been retrieved during the build
|
||||||
# process.
|
# process.
|
||||||
srcapk = re.sub(r'.apk$', '.binary.apk', apkfile)
|
|
||||||
|
|
||||||
|
srcapk = re.sub(r'.apk$', '.binary.apk', apkfile)
|
||||||
|
srcapk = srcapk.replace(unsigned_dir, binaries_dir)
|
||||||
|
|
||||||
|
if not os.path.isfile(srcapk):
|
||||||
|
logging.error("...reference binary missing - publish skipped: "
|
||||||
|
"'{refpath}'".format(refpath=srcapk))
|
||||||
|
else:
|
||||||
# Compare our unsigned one with the downloaded one...
|
# Compare our unsigned one with the downloaded one...
|
||||||
compare_result = common.verify_apks(srcapk, apkfile, tmp_dir)
|
compare_result = common.verify_apks(srcapk, apkfile, tmp_dir)
|
||||||
if compare_result:
|
if compare_result:
|
||||||
logging.error("...verification failed - publish skipped : "
|
logging.error("...verification failed - publish skipped : "
|
||||||
+ compare_result)
|
"{result}".format(result=compare_result))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# Success! So move the downloaded file to the repo, and remove
|
# Success! So move the downloaded file to the repo, and remove
|
||||||
# our built version.
|
# our built version.
|
||||||
shutil.move(srcapk, os.path.join(output_dir, apkfilename))
|
shutil.move(srcapk, os.path.join(output_dir, apkfilename))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue