1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

nightly: resign APKs with provided debug.keystore

Rather than needing to run a command before and after the build, in order
to first install the debug.keystore, then after to fetch and publish the
APK, this makes `fdroid nightly` just resign the APK with the provided
debug.keystore.  Then `fdroid nightly` can be run as the final step in a CI
build, and still ensure that the APKs are always signed by the provided
debug.keystore.
This commit is contained in:
Hans-Christoph Steiner 2017-11-30 21:12:34 +01:00
parent 1c3a4479ab
commit 8a61b0b945

View File

@ -235,6 +235,8 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
with open('config.py', 'w') as fp:
fp.write(config)
os.chmod('config.py', 0o600)
config = common.read_config(options)
common.assert_config_keystore(config)
for root, dirs, files in os.walk(cibase):
for d in ('fdroid', '.git', '.gradle'):
@ -243,12 +245,14 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
for f in files:
if f.endswith('-debug.apk'):
apkfilename = os.path.join(root, f)
logging.debug(_('copying {apkfilename} into {path}')
.format(apkfilename=apkfilename, path=repodir))
logging.debug(_('Striping mystery signature from {apkfilename}')
.format(apkfilename=apkfilename))
destapk = os.path.join(repodir, os.path.basename(f))
shutil.copyfile(apkfilename, destapk)
shutil.copystat(apkfilename, destapk)
os.chmod(destapk, 0o644)
os.chmod(apkfilename, 0o644)
logging.debug(_('Resigning {apkfilename} with provided debug.keystore')
.format(apkfilename=os.path.basename(apkfilename)))
common.apk_strip_signatures(apkfilename, strip_manifest=True)
common.sign_apk(apkfilename, destapk, KEY_ALIAS)
if options.verbose:
logging.debug(_('attempting bare ssh connection to test deploy key:'))