lib/packaging/util/ship.rb in packaging-0.99.65 vs lib/packaging/util/ship.rb in packaging-0.99.66

- old
+ new

@@ -104,26 +104,15 @@ end 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, 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) - # We need to iterate through all the supported platforms here because of - # how deb repos are set up. Each codename will have its own link from the - # 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, 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) end @@ -133,30 +122,25 @@ end def ship_dmg(local_staging_directory, remote_path, opts = {}) packages_have_shipped = 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, opts[:nonfinal]) - if packages_have_shipped Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag| # Create the latest symlink for the current supported repo Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(platform_tag, remote_path, opts[:nonfinal]), 'dmg') end end 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, opts[:nonfinal]) end def ship_msi(local_staging_directory, remote_path, opts = {}) packages_have_shipped = 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, opts[:nonfinal]) if packages_have_shipped # Create the symlinks for the latest supported repo Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path, opts[:nonfinal]), 'msi', arch: 'x64') Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path, opts[:nonfinal]), 'msi', arch: 'x86') end @@ -203,20 +187,48 @@ 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}" + fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}\n#{e.backtrace}" end + # create all of the rolling repo links in one step + def create_rolling_repo_links(nonfinal = false) + yum_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'rpm') + dmg_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'dmg') + swix_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'swix') + msi_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'msi') + + create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, yum_path, nonfinal) + create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, dmg_path, nonfinal) + create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, swix_path, nonfinal) + create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, msi_path, nonfinal) + + # We need to iterate through all the supported platforms here because of + # how deb repos are set up. Each codename will have its own link from the + # 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] + + apt_path = Pkg::Config.apt_repo_staging_path + if nonfinal + apt_path = Pkg::Config.nonfinal_apt_repo_staging_path + end + Pkg::Platforms.codenames.each do |codename| + create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, apt_path, nonfinal) + end + end + def update_release_package_symlinks(local_staging_directory, nonfinal = false) local_packages = collect_packages(["#{local_staging_directory}/**/*.rpm", "#{local_staging_directory}/**/*.deb"]) local_packages.each do |package| platform_tag = Pkg::Paths.tag_from_artifact_path(package) package_format = Pkg::Platforms.package_format_for_tag(platform_tag) case package_format when 'rpm' - remote_base = Pkg::Paths.artifacts_path(platform_tag, Pkg::Paths.remote_repo_base(platform_tag, nonfinal), nonfinal) + remote_base = Pkg::Paths.artifacts_path(platform_tag, Pkg::Paths.remote_repo_base(platform_tag, nonfinal: nonfinal), nonfinal) when 'deb' remote_base = Pkg::Paths.apt_package_base_path(platform_tag, Pkg::Paths.repo_name(nonfinal), Pkg::Config.project, nonfinal) else fail "Unexpected package format #{package_format}, cannot create symlinks." end