Add conflicts_with property and use it for coreutils, tealdeer and tldr (#13252)

* Add PackageUtils.compatible? tests for min_glibc and max_glibc

* Add conflicts_with property and use it for coreutils, tealdeer and tldr
This commit is contained in:
Max Downey Twiss
2025-10-30 02:46:24 +11:00
committed by GitHub
parent a6fa361b02
commit 61dfdcb3e3
7 changed files with 68 additions and 35 deletions

View File

@@ -11,7 +11,7 @@ class PackageUtils
end
def self.compatible?(pkg)
return (pkg.compatibility.casecmp?('all') || pkg.compatibility.include?(ARCH)) && (pkg.min_glibc.nil? || (pkg.min_glibc <= LIBC_VERSION)) && (pkg.max_glibc.nil? || (pkg.max_glibc >= LIBC_VERSION))
return (pkg.compatibility.casecmp?('all') || pkg.compatibility.include?(ARCH)) && (pkg.min_glibc.nil? || (pkg.min_glibc <= LIBC_VERSION)) && (pkg.max_glibc.nil? || (pkg.max_glibc >= LIBC_VERSION)) && !installed?(pkg.conflicts_with)
end
def self.incompatible_reason(pkg)
@@ -19,6 +19,7 @@ class PackageUtils
reason.push "#{pkg.name.capitalize} is not compatible with #{ARCH}." if !pkg.compatibility.casecmp?('all') && !pkg.compatibility.include?(ARCH)
reason.push "ChromeOS is currently running glibc #{LIBC_VERSION}, but the minimum version for #{pkg.name} is #{pkg.min_glibc}." if !pkg.min_glibc.nil? && (pkg.min_glibc >= LIBC_VERSION)
reason.push "ChromeOS is currently running glibc #{LIBC_VERSION}, but the maximum version for #{pkg.name} is #{pkg.min_glibc}." if !pkg.max_glibc.nil? && (pkg.max_glibc.to_s <= LIBC_VERSION)
reason.push "#{pkg.name.capitalize} conflicts with #{pkg.conflicts_with.capitalize}, which is currently installed." if installed?(pkg.conflicts_with)
return reason
end