lib/packaging/util/ship.rb in packaging-0.99.3 vs lib/packaging/util/ship.rb in packaging-0.99.4
- old
+ new
@@ -22,18 +22,18 @@
# This assumes the working directory is a temporary directory that will
# later be cleaned up
#
# If this is platform_independent the packages will not get reorganized,
# just copied under the tmp directory for more consistent workflows
- def reorganize_packages(pkgs, tmp, platform_independent = false)
+ def reorganize_packages(pkgs, tmp, platform_independent = false, nonfinal = false)
new_pkgs = []
pkgs.each do |pkg|
if platform_independent
path = 'pkg'
else
platform_tag = Pkg::Paths.tag_from_artifact_path(pkg)
- path = Pkg::Paths.artifacts_path(platform_tag, 'pkg')
+ path = Pkg::Paths.artifacts_path(platform_tag, 'pkg', nonfinal)
end
FileUtils.mkdir_p File.join(tmp, path)
FileUtils.cp pkg, File.join(tmp, path)
new_pkgs << File.join(path, File.basename(pkg))
end
@@ -62,19 +62,20 @@
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def ship_pkgs(pkg_exts, staging_server, remote_path, opts = {})
options = {
excludes: [],
chattr: true,
- platform_independent: false }.merge(opts)
+ platform_independent: false,
+ nonfinal: false }.merge(opts)
# First find the packages to be shipped. We must find them before moving
# to our temporary staging directory
local_packages = collect_packages(pkg_exts, options[:excludes])
return if local_packages.empty?
tmpdir = Dir.mktmpdir
- staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent])
+ staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent], options[:nonfinal])
puts staged_pkgs.sort
puts "Do you want to ship the above files to (#{staging_server})?"
if Pkg::Util.ask_yes_or_no
extra_flags = ['--ignore-existing', '--delay-updates']
@@ -103,11 +104,11 @@
end
def ship_rpms(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.rpm", "#{local_staging_directory}/**/*.srpm"], Pkg::Config.yum_staging_server, remote_path, opts)
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, remote_path)
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, remote_path, opts[:nonfinal])
end
def ship_debs(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.debian.tar.gz", "#{local_staging_directory}/**/*.orig.tar.gz" "#{local_staging_directory}/**/*.dsc", "#{local_staging_directory}/**/*.deb", "#{local_staging_directory}/**/*.changes"], Pkg::Config.apt_signing_server, remote_path, opts)
@@ -116,11 +117,11 @@
# current versioned repo (e.g. puppet5) to the rolling repo. The one thing
# we don't care about is architecture, so we just grab the first supported
# architecture for the code name we're working with at the moment. [written
# by Melissa, copied by Molly]
Pkg::Platforms.codenames.each do |codename|
- create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, remote_path)
+ create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, remote_path, opts[:nonfinal])
end
end
def ship_svr4(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.pkg.gz"], Pkg::Config.svr4_host, remote_path, opts)
@@ -131,11 +132,11 @@
end
def ship_dmg(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.dmg"], Pkg::Config.dmg_staging_server, remote_path, opts)
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path)
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path, opts[:nonfinal])
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
# TODO remove the PC1 links when we no longer need to maintain them
# [written by Melissa, copied by Molly]
_, version, arch = Pkg::Platforms.parse_platform_tag(platform_tag)
@@ -146,17 +147,17 @@
end
def ship_swix(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.swix"], Pkg::Config.swix_staging_server, remote_path, opts)
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, remote_path)
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, remote_path, opts[:nonfinal])
end
def ship_msi(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/**/*.msi"], Pkg::Config.msi_staging_server, remote_path, opts)
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path)
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path, opts[:nonfinal])
# Create the symlinks for the latest supported repo
Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x64')
Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x86')
# We provide symlinks to the latest package in a given directory. This
@@ -173,12 +174,12 @@
def ship_tar(local_staging_directory, remote_path, opts = {})
ship_pkgs(["#{local_staging_directory}/*.tar.gz*"], Pkg::Config.tar_staging_server, remote_path, opts)
end
- def rolling_repo_link_command(platform_tag, repo_path)
- base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path)
+ def rolling_repo_link_command(platform_tag, repo_path, nonfinal = false)
+ base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path, nonfinal)
if link_path.nil?
puts "No link target set, not creating rolling repo link for #{base_path}"
return nil
end
@@ -203,11 +204,11 @@
fi
ln -s #{base_path} #{link_path}
CMD
end
- def create_rolling_repo_link(platform_tag, staging_server, repo_path)
- command = rolling_repo_link_command(platform_tag, repo_path)
+ def create_rolling_repo_link(platform_tag, staging_server, repo_path, nonfinal = false)
+ command = rolling_repo_link_command(platform_tag, repo_path, nonfinal)
Pkg::Util::Net.remote_ssh_cmd(staging_server, command) unless command.nil?
rescue => e
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}"
end