From d6c0bbc7f42683180fd52050c7a0012275872be9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Mon, 5 Apr 2021 09:54:54 -0700 Subject: [PATCH] GHCR: Add constant OS::CI_OS_VERSION Rename constant OS::GLIBC_CI_VERSION to OS::CI_GLIBC_VERSION. --- Library/Homebrew/formula_auditor.rb | 2 +- Library/Homebrew/github_packages.rb | 8 +++++--- Library/Homebrew/os.rb | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 8dc9bee4d9..a17873c506 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -343,7 +343,7 @@ module Homebrew return unless @core_tap version = formula.version.to_s - return if version == OS::GLIBC_CI_VERSION + return if version == OS::CI_GLIBC_VERSION problem "The glibc version must be #{version}, as this is the version used by our CI on Linux. " \ "Glibc is for users who have a system Glibc with a lower version, " \ diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index 31ba0d1cf9..b9dd5fce25 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -234,13 +234,15 @@ class GitHubPackages end raise TypeError, "unknown tab['built_on']['os']: #{tab["built_on"]["os"]}" if os.blank? - os_version = tab["built_on"]["os_version"] if tab["built_on"].present? + os_version = tab["built_on"]["os_version"].presence if tab["built_on"].present? case os when "darwin" os_version ||= "macOS #{MacOS::Version.from_symbol(bottle_tag)}" when "linux" - os_version = (os_version || "Ubuntu 16.04.7").delete_suffix " LTS" - glibc_version = (tab["built_on"]["glibc_version"] if tab["built_on"].present?) || OS::GLIBC_CI_VERSION + os_version&.delete_suffix!(" LTS") + os_version ||= OS::CI_OS_VERSION + glibc_version = tab["built_on"]["glibc_version"].presence if tab["built_on"].present? + glibc_version ||= OS::CI_GLIBC_VERSION cpu_variant = tab["oldest_cpu_family"] || Hardware::CPU::INTEL_64BIT_OLDEST_CPU.to_s end diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 0c55095eec..7d98154013 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -37,7 +37,8 @@ module OS ::OS_VERSION = ENV["HOMEBREW_OS_VERSION"] - GLIBC_CI_VERSION = "2.23" + CI_GLIBC_VERSION = "2.23" + CI_OS_VERSION = "Ubuntu 16.04" if OS.mac? require "os/mac"