lib/mixlib/install/backend/bintray.rb in mixlib-install-1.0.9 vs lib/mixlib/install/backend/bintray.rb in mixlib-install-1.0.10

- old
+ new

@@ -217,11 +217,11 @@ # def url(artifact_map) platform_info = parse_platform_info(artifact_map) base_url = case "#{platform_info[:platform]}-#{platform_info[:platform_version]}" - when "freebsd-9", "el-5" + when "freebsd-9", "el-5", "solaris2-5.9", "solaris2-5.10" COMPAT_DOWNLOAD_URL_ENDPOINT else DOWNLOAD_URL_ENDPOINT end @@ -245,10 +245,11 @@ def parse_platform_info(artifact_map) # platform/platform_version/filename path = artifact_map["path"].split("/") platform = path[0] platform_version = path[1] + platform, platform_version = normalize_platform(platform, platform_version) filename = artifact_map["name"] architecture = parse_architecture_from_file_name(filename) { @@ -257,10 +258,33 @@ architecture: architecture, } end # + # Normalizes platform and platform_version information that we receive + # from bintray. There are a few entries that we historically published + # that we need to normalize. They are: + # * solaris -> solaris2 & 10 -> 5.10 for solaris. + # + # @param [String] platform + # @param [String] platform_version + # + # @return Array<String> [platform, platform_version] + def normalize_platform(platform, platform_version) + if platform == "solaris" + platform = "solaris2" + + # Here platform_version is set to either 10 or 11 and we would like + # to normalize that to 5.10 and 5.11. + + platform_version = "5.#{platform_version}" + end + + [platform, platform_version] + end + + # # Determines the architecture for which a file is published from from # filename. # # We determine the architecture based on the filename of the artifact # since architecture the artifact is published for is not available @@ -286,11 +310,11 @@ elsif %w{ powerpc }.fuzzy_include?(filename) "powerpc" elsif %w{ sparc sun4u sun4v }.fuzzy_include?(filename) "sparc" # Note that ppc64le should come before ppc64 otherwise our search - # will think ppc64le matches ppc64. - elsif %w{ ppc64le }.fuzzy_include?(filename) + # will think ppc64le matches ppc64. Ubuntu also calls it ppc64el. + elsif %w{ ppc64le ppc64el }.fuzzy_include?(filename) "ppc64le" elsif %w{ ppc64 }.fuzzy_include?(filename) "ppc64" # # From here on we need to deal with historical versions