Re-added zip package output format. Modified zip and tar packaging process to use the base 'tar' and 'zip' commands, instead of 'fpm'.

This commit is contained in:
Ross McDonald 2016-03-02 10:42:58 -06:00 committed by Cameron Sparr
parent a77bfecb02
commit 095c90ad22
1 changed files with 46 additions and 38 deletions

View File

@ -84,7 +84,7 @@ supported_builds = {
} }
supported_packages = { supported_packages = {
"darwin": [ "tar" ], "darwin": [ "tar", "zip" ],
"linux": [ "deb", "rpm", "tar" ], "linux": [ "deb", "rpm", "tar" ],
"windows": [ "zip" ], "windows": [ "zip" ],
"freebsd": [ "tar" ] "freebsd": [ "tar" ]
@ -538,6 +538,9 @@ def build_packages(build_output, version, nightly=False, rc=None, iteration=1):
package_iteration = iteration package_iteration = iteration
package_build_root = build_root package_build_root = build_root
current_location = build_output[platform][arch] current_location = build_output[platform][arch]
if rc is not None:
# Set iteration to 0 since it's a release candidate
package_iteration = "0.rc{}".format(rc)
if package_type in ['zip', 'tar']: if package_type in ['zip', 'tar']:
# For tars and zips, start the packaging one folder above # For tars and zips, start the packaging one folder above
@ -554,18 +557,23 @@ def build_packages(build_output, version, nightly=False, rc=None, iteration=1):
platform, platform,
arch) arch)
current_location = os.path.join(os.getcwd(), current_location)
if package_type == 'tar': if package_type == 'tar':
# Add `tar.gz` to path to compress package output tar_command = "cd {} && tar -cvzf {}.tar.gz ./*".format(build_root, name)
current_location = os.path.join(current_location, name + '.tar.gz') run(tar_command, shell=True)
run("mv {}.tar.gz {}".format(os.path.join(build_root, name), current_location), shell=True)
outfile = os.path.join(current_location, name + ".tar.gz")
outfiles.append(outfile)
print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
elif package_type == 'zip': elif package_type == 'zip':
current_location = os.path.join(current_location, name + '.zip') zip_command = "cd {} && zip -r {}.zip ./*".format(build_root, name)
run(zip_command, shell=True)
if rc is not None: run("mv {}.zip {}".format(os.path.join(build_root, name), current_location), shell=True)
# Set iteration to 0 since it's a release candidate outfile = os.path.join(current_location, name + ".zip")
package_iteration = "0.rc{}".format(rc) outfiles.append(outfile)
print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format( else:
fpm_common_args, fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format(fpm_common_args,
name, name,
arch, arch,
package_type, package_type,
@ -587,7 +595,7 @@ def build_packages(build_output, version, nightly=False, rc=None, iteration=1):
print("!! Could not determine output from packaging command.") print("!! Could not determine output from packaging command.")
else: else:
# Strip nightly version (the unix epoch) from filename # Strip nightly version (the unix epoch) from filename
if nightly and package_type in [ 'deb', 'rpm' ]: if nightly:
outfile = rename_file(outfile, outfile.replace("{}-{}".format(version, iteration), "nightly")) outfile = rename_file(outfile, outfile.replace("{}-{}".format(version, iteration), "nightly"))
outfiles.append(os.path.join(os.getcwd(), outfile)) outfiles.append(os.path.join(os.getcwd(), outfile))
# Display MD5 hash for generated package # Display MD5 hash for generated package