mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-09 17:00:27 +03:00
refactored publishing source tarball into a function
This commit is contained in:
parent
c196f7dd7a
commit
45688bfe42
1 changed files with 24 additions and 12 deletions
|
|
@ -37,6 +37,18 @@ config = None
|
||||||
options = None
|
options = None
|
||||||
|
|
||||||
|
|
||||||
|
def publish_source_tarball(apkfilename, unsigned_dir, output_dir):
|
||||||
|
"""Move the source tarball into the output directory..."""
|
||||||
|
|
||||||
|
tarfilename = apkfilename[:-4] + '_src.tar.gz'
|
||||||
|
tarfile = os.path.join(unsigned_dir, tarfilename)
|
||||||
|
if os.path.exists(tarfile):
|
||||||
|
shutil.move(tarfile, os.path.join(output_dir, tarfilename))
|
||||||
|
logging.debug('...published %s', tarfilename)
|
||||||
|
else:
|
||||||
|
logging.debug('...no source tarball for %s', apkfilename)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
global config, options
|
global config, options
|
||||||
|
|
@ -138,18 +150,23 @@ def main():
|
||||||
if compare_result:
|
if compare_result:
|
||||||
logging.error("...verification failed - publish skipped : "
|
logging.error("...verification failed - publish skipped : "
|
||||||
+ compare_result)
|
+ compare_result)
|
||||||
continue
|
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))
|
||||||
os.remove(apkfile)
|
os.remove(apkfile)
|
||||||
|
|
||||||
|
publish_source_tarball(apkfilename, unsigned_dir, output_dir)
|
||||||
|
logging.info('Published ' + apkfilename)
|
||||||
|
|
||||||
elif apkfile.endswith('.zip'):
|
elif apkfile.endswith('.zip'):
|
||||||
|
|
||||||
# OTA ZIPs built by fdroid do not need to be signed by jarsigner,
|
# OTA ZIPs built by fdroid do not need to be signed by jarsigner,
|
||||||
# just to be moved into place in the repo
|
# just to be moved into place in the repo
|
||||||
shutil.move(apkfile, os.path.join(output_dir, apkfilename))
|
shutil.move(apkfile, os.path.join(output_dir, apkfilename))
|
||||||
|
publish_source_tarball(apkfilename, unsigned_dir, output_dir)
|
||||||
|
logging.info('Published ' + apkfilename)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
@ -219,12 +236,7 @@ def main():
|
||||||
raise BuildException(_("Failed to align application"))
|
raise BuildException(_("Failed to align application"))
|
||||||
os.remove(apkfile)
|
os.remove(apkfile)
|
||||||
|
|
||||||
# Move the source tarball into the output directory...
|
publish_source_tarball(apkfilename, unsigned_dir, output_dir)
|
||||||
tarfilename = apkfilename[:-4] + '_src.tar.gz'
|
|
||||||
tarfile = os.path.join(unsigned_dir, tarfilename)
|
|
||||||
if os.path.exists(tarfile):
|
|
||||||
shutil.move(tarfile, os.path.join(output_dir, tarfilename))
|
|
||||||
|
|
||||||
logging.info('Published ' + apkfilename)
|
logging.info('Published ' + apkfilename)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue