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,44 +557,49 @@ def build_packages(build_output, version, nightly=False, rc=None, iteration=1):
platform, platform,
arch) arch)
if package_type == 'tar': current_location = os.path.join(os.getcwd(), current_location)
# Add `tar.gz` to path to compress package output if package_type == 'tar':
current_location = os.path.join(current_location, name + '.tar.gz') tar_command = "cd {} && tar -cvzf {}.tar.gz ./*".format(build_root, name)
elif package_type == 'zip': run(tar_command, shell=True)
current_location = os.path.join(current_location, name + '.zip') run("mv {}.tar.gz {}".format(os.path.join(build_root, name), current_location), shell=True)
outfile = os.path.join(current_location, name + ".tar.gz")
if rc is not None: outfiles.append(outfile)
# Set iteration to 0 since it's a release candidate print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
package_iteration = "0.rc{}".format(rc) elif package_type == 'zip':
zip_command = "cd {} && zip -r {}.zip ./*".format(build_root, name)
fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format( run(zip_command, shell=True)
fpm_common_args, run("mv {}.zip {}".format(os.path.join(build_root, name), current_location), shell=True)
name, outfile = os.path.join(current_location, name + ".zip")
arch, outfiles.append(outfile)
package_type, print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
package_version,
package_iteration,
package_build_root,
current_location)
if debug:
fpm_command += "--verbose "
if package_type == "rpm":
fpm_command += "--depends coreutils "
fpm_command += "--depends lsof "
out = run(fpm_command, shell=True)
matches = re.search(':path=>"(.*)"', out)
outfile = None
if matches is not None:
outfile = matches.groups()[0]
if outfile is None:
print("!! Could not determine output from packaging command.")
else: else:
# Strip nightly version (the unix epoch) from filename fpm_command = "fpm {} --name {} -a {} -t {} --version {} --iteration {} -C {} -p {} ".format(fpm_common_args,
if nightly and package_type in [ 'deb', 'rpm' ]: name,
outfile = rename_file(outfile, outfile.replace("{}-{}".format(version, iteration), "nightly")) arch,
outfiles.append(os.path.join(os.getcwd(), outfile)) package_type,
# Display MD5 hash for generated package package_version,
print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile))) package_iteration,
package_build_root,
current_location)
if debug:
fpm_command += "--verbose "
if package_type == "rpm":
fpm_command += "--depends coreutils "
fpm_command += "--depends lsof "
out = run(fpm_command, shell=True)
matches = re.search(':path=>"(.*)"', out)
outfile = None
if matches is not None:
outfile = matches.groups()[0]
if outfile is None:
print("!! Could not determine output from packaging command.")
else:
# Strip nightly version (the unix epoch) from filename
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
print("MD5({}) = {}".format(outfile, generate_md5_from_file(outfile)))
print("") print("")
if debug: if debug:
print("[DEBUG] package outfiles: {}".format(outfiles)) print("[DEBUG] package outfiles: {}".format(outfiles))