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 Michele Fadda
parent ade58cf2ec
commit e7de5b5845
1 changed files with 46 additions and 38 deletions

View File

@ -84,7 +84,7 @@ supported_builds = {
}
supported_packages = {
"darwin": [ "tar" ],
"darwin": [ "tar", "zip" ],
"linux": [ "deb", "rpm", "tar" ],
"windows": [ "zip" ],
"freebsd": [ "tar" ]
@ -538,6 +538,9 @@ def build_packages(build_output, version, nightly=False, rc=None, iteration=1):
package_iteration = iteration
package_build_root = build_root
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']:
# 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,
arch)
current_location = os.path.join(os.getcwd(), current_location)
if package_type == 'tar':
# Add `tar.gz` to path to compress package output
current_location = os.path.join(current_location, name + '.tar.gz')
tar_command = "cd {} && tar -cvzf {}.tar.gz ./*".format(build_root, name)
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':
current_location = os.path.join(current_location, name + '.zip')
if rc is not None:
# Set iteration to 0 since it's a release candidate
package_iteration = "0.rc{}".format(rc)
fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format(
fpm_common_args,
zip_command = "cd {} && zip -r {}.zip ./*".format(build_root, name)
run(zip_command, shell=True)
run("mv {}.zip {}".format(os.path.join(build_root, name), current_location), shell=True)
outfile = os.path.join(current_location, name + ".zip")
outfiles.append(outfile)
print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
else:
fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format(fpm_common_args,
name,
arch,
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.")
else:
# 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"))
outfiles.append(os.path.join(os.getcwd(), outfile))
# Display MD5 hash for generated package