Skip to content

Improve support for RHEL based distros

eri requested to merge eerii/cerbero:almalinux into main

This is a followup to !1644 (merged) that improves the support for RHEL based distros and cleans a bit of the logic that handles the bootstrapping. Last MR only worked with Alma Linux 8, but not the version 9 (which the newest manylinux image uses). There are also some systems where the current code doesn't work as expected.

Changes:

  • Alma Linux and Rocky Linux are compatible versions of RHEL. It makes sense to count them as redhat without their own version string. The check for Rocky Linux was bundled with Amazon Linux, which caused an error since no compatible version was found.
  • Updated the existing logic for determining the Amazon Linux version since it seemed to be mixing versions 1 and 2, and it didn't work for 2023.
    • Amazon Linux 1 and 2 are based on RHEL 6 and 7 respectively, and had no compatibility issues on my testing.
    • Amazon Linux 2023 is loosely based on Fedora 34-36, but with no compatibility guarantees, so I added its own version string. The current version works with the defaults so no extra code is needed.
  • The PowerTools / CodeReady Build repository that exists in RHEL 8+ based distros has been changing names. This is common for all redhat distros.
  • Comparing versions using strings lexicographically fails if the distro has a two digit minor version. For example, 8.10 is counted as smaller than 8.3. Splitting the version into tuples works as python compares them item by item in order.
  • Used the idea from the previous MR of querying for available dependencies to generalize and simplify some checks:
    • The issue with perl-FindBin wasn't exclusive to Alma Linux. It was around RHEL 8.6 where it was added as a standalone package, before it was bundled in perl-interpeter. Before RHEL 8, perl-interpeter was just perl. Check for the best matching version.
    • Use curl as a wget fallback in distros that moved to wget2, not only Fedora.
    • Improve the check for ccache availability. While Fedora has it, in RHEL distros it is in the EPEL repository (which contains Fedora packages). Since it is not a required dependency and it is only seems to be used if use_ccache is enabled, don't fail if the user chooses not to install EPEL. On Amazon Linux 2023, EPEL is not available and ccache is not packaged.
    • The python3-devel package may not match the python version that the user is using to run cerbero. While it is not required to install the matching one, it can add unnecessary patches and overwrite the default python version, causing unexpected errors if the PATH is not set right. In particular, in RHEL 8 it installs python 3.6, which is too old to use with cerbero. Try to install the version matching the python interpreter running the bootstrap, and if not fall back to the default one.

Tested images:

I have tested bootstrapping and compiling with most relevant rpm based containers. Testing versions older than RHEL 8 was difficult since they are EOL and most containers fail to even start. That's why I used Amazon Linux 1/2, since it seems to be one of the few mantained ones. For Fedora, I tested the first version with python 3.7 support and the current one, though its changes here should be minimal.

  • RHEL 10: almalinux:10-kitten
  • RHEL 9: quay.io/pypa/manylinux_2_34_x86_64, almalinux:9, rockylinux:9
  • RHEL 8: quay.io/pypa/manylinux_2_28_x86_64, almalinux:8, rockylinux:8
  • RHEL 6 and 7: amazonlinux:1, amazonlinux:2 (correct bootstrap but really outdated dependencies)
  • Fedora: fedora:latest, amazonlinux:2023, fedora:29

Testing commands used:

# Use toolbox, podman, distrobox, or the real distro
distrobox create --image $NAME --name cerbero
distrobox enter cerbero

# On manylinux 2_28, 2_34 select the python version
export PATH=/opt/python/cp311-cp311/bin:$PATH

# On Fedora 29+, RHEL 9+, Amazon Linux 2023
# Python >= 3.7 is installed and distro is a system package
dnf install python3-distro

# Python is outdated / not installed
dnf install python3.11 python3.11-pip # RHEL 8
yum install python3 # Amazon Linux 2
yum install python38 # Amazon Linux 1

# If not available as a system package, install distro with pip
python3 -m pip install distro

# On any Amazon Linux, also install tar
dnf/yum install tar

# Bootstrap and compile
python3 cerbero-uninstalled bootstrap
python3 cerbero-uninstalled package -tn gstreamer-1.0

Merge request reports

Loading