Skip to content

Commit

Permalink
Detect slc9 arch on RHEL9 correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoWilken committed Oct 18, 2023
1 parent 4ccd30c commit 8904be5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions alibuild_helpers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,15 @@ def doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, pl
return "osx_%s" % processor.replace("_", "-")
distribution, version, flavour = platformTuple
distribution = distribution.lower()
# If platform.dist does not return something sensible,
# let's try with /etc/os-release
if distribution not in ["ubuntu", "redhat", "centos", "almalinux", "rockylinux"] and hasOsRelease:

if distribution in ("redhat", "red hat enterprise linux", "centos", "almalinux", "rockylinux"):
distribution = "slc"

Check warning on line 153 in alibuild_helpers/utilities.py

View check run for this annotation

Codecov / codecov/patch

alibuild_helpers/utilities.py#L153

Added line #L153 was not covered by tests
elif distribution == "ubuntu":
major, _, minor = version.partition(".")
version = major + minor
elif hasOsRelease:

Check warning on line 157 in alibuild_helpers/utilities.py

View check run for this annotation

Codecov / codecov/patch

alibuild_helpers/utilities.py#L157

Added line #L157 was not covered by tests
# If platform.dist does not return something sensible,
# let's try with /etc/os-release
for x in osReleaseLines:
key, is_prop, val = x.partition("=")
if not is_prop:
Expand All @@ -161,17 +167,12 @@ def doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, pl
if key == "VERSION_ID":
version = val

if distribution == "ubuntu":
major, _, minor = version.partition(".")
version = major + minor
elif distribution == "debian":
if distribution == "debian":
# http://askubuntu.com/questions/445487/which-ubuntu-version-is-equivalent-to-debian-squeeze
debian_ubuntu = {"7": "1204", "8": "1404", "9": "1604", "10": "1804", "11": "2004"}
if version in debian_ubuntu:
distribution = "ubuntu"
version = debian_ubuntu[version]
elif distribution in ["redhat", "centos", "almalinux", "rockylinux"]:
distribution = "slc"

processor = platformProcessor
if not processor:
Expand Down

0 comments on commit 8904be5

Please sign in to comment.