diff --git a/release b/release index c1c8597..c004299 100644 --- a/release +++ b/release @@ -1,10 +1,15 @@ #!/usr/bin/env python3 + +import os import subprocess + import common -subprocess.check_call(['./build-all']) -subprocess.check_call(['./zip-img']) +zip_img = imp.load_source('zip_img', os.path.join(common.root_dir, 'zip-img')) + +subprocess.check_call([os.path.join(common.root_dir, 'build-all')]) +zip_img.main() tag = 'sha-{}'.format(common.sha) -subprocess.check_call(['git', 'tag' tag]) +subprocess.check_call(['git', 'tag', tag]) subprocess.check_call(['git', 'push' '--tags']) # TODO # - https://stackoverflow.com/questions/41022470/curl-request-to-add-file-to-github-release diff --git a/zip-img b/zip-img index 548d044..ea2a487 100755 --- a/zip-img +++ b/zip-img @@ -6,12 +6,16 @@ import zipfile import common -outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha)) -if os.path.exists(outfile): - os.unlink(outfile) -zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED) -for arch in common.arches: - common.setup(common.get_argparse(default_args={'arch': arch})) - zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir)) - zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir)) -zipf.close() +def main(): + outfile = os.path.join(common.out_dir, 'lkmc-{}.zip'.format(common.sha)) + if os.path.exists(outfile): + os.unlink(outfile) + zipf = zipfile.ZipFile(outfile, 'w', zipfile.ZIP_DEFLATED) + for arch in common.arches: + common.setup(common.get_argparse(default_args={'arch': arch})) + zipf.write(common.qcow2_file, arcname=os.path.relpath(common.qcow2_file, common.root_dir)) + zipf.write(common.linux_image, arcname=os.path.relpath(common.linux_image, common.root_dir)) + zipf.close() + +if __name__ == '__main__': + main()