Skip to content

Commit

Permalink
ubi9 support via rocky repos with some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rafie committed Oct 1, 2023
1 parent 0045ab6 commit d236c4a
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 90 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/redhat-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
platforms:
description: 'Platforms'
default: '["centos:7", "quay.io/centos/centos:stream8", "quay.io/centos/centos:stream9",
"redhat/ubi9:latest",
"rockylinux:8", "rockylinux:9",
"oraclelinux:7", "oraclelinux:8", "oraclelinux:9",
"amazonlinux:2", "amazonlinux:2022", "amazonlinux:2023",
Expand Down Expand Up @@ -48,9 +49,12 @@ jobs:
echo "/etc/os-release:"; cat /etc/os-release
echo "/etc/redhat-release:"; cat /etc/redhat-release || true
echo "uname -a: $(uname -a)"
echo "python: $(python3 --version)"
echo "bash: $BASH_VERSION"
echo "System Python: $(/usr/bin/python3 --version)"
echo "Python: $(python3 --version)"
echo "pip list:"; python3 -m pip list -v
echo "System gcc: $(/usr/bin/gcc --version | head -1)"
echo "gcc: $(gcc --version | head -1)"
echo "glibc: $(./bin/glibcver)"
echo "libstdc++: $(./bin/libstdc++ver)"
echo "binutils: $(ld --version | head -1)"
9 changes: 2 additions & 7 deletions bin/getclang
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,8 @@ class CLangSetup(paella.Setup):
if not self.modern:
return
self.run("%s/bin/getepel" % READIES, sudo=True)

if self.os_version[0] == 9:
if self.dist in ['centos', 'ol', 'redhat']:
self.install("clang llvm-toolset")
elif self.os_version[0] == 8:
if self.dist in ['centos', 'ol']:
self.install("clang llvm-toolset")
if self.dist in ['centos', 'ol'] and self.os_version[0] >= 8:
self.install("clang llvm-toolset")
else:
self.install("llvm-toolset-7.0")
self.cp_to_profile_d("/opt/rh/llvm-toolset-7.0/enable", "llvm-toolset-7.0.sh")
Expand Down
132 changes: 118 additions & 14 deletions bin/getepel
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,27 @@ READIES=$(cd $HERE/.. && pwd)
# https://developers.redhat.com/products/red-hat-software-collections/overview
# SCL/ol https://docs.oracle.com/en/operating-systems/oracle-linux/scl-user/#Oracle-Linux

# centos7 centos8 centos9 rocky8 rocky9 ol7 ol8 ol9 amzn2 amzn2022 amzn2023
# EPEL v v v v v v v v v - -
# raven - v v v v - v v - v v
# powertools v v - v - - - - - - -
# crb - - v - v - - - - - -
# REMI v v v v v v v v v - -
# SCL v - - - - v* - - v - -
# centos7 centos8 centos9 rocky8 rocky9 ubi9 ol7 ol8 ol9 amzn2 amzn2022 amzn2023
# EPEL v v v v v v v v v v - -
# raven - v v v v v - v v - v v
# powertools v v - v - - - - - - - -
# crb - - v - v v* - - - - - -
# REMI v v v v v v v v v v - -
# SCL v - - - - - v* - - v - -

# Notes:
# - rockylinux and almalinux are compatible
# - Rocky Linux repos (https://wiki.rockylinux.org/rocky/repo):
# baseos, appstream, powertools(8), crb(9), highavailibility, resilientstorage
# - for Oracle Linux 7. SCL/ol should be used instead of SCL
# - ubi9 uses rocky9's repos (baseos, appstream, crb)

# Useful commands and locations:
# dnf repolist [--all]
# dnf groupinfo GROUP
# dnf info PACKAGE
# dnf makecache
# /etc/yum.repos.d

#----------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -127,6 +135,102 @@ install_centos_stream_appstream() {
runn $SUDO dnf makecache
}

install_rocky_repos() {
if [[ $osver != rhel9* ]]; then
return
fi
# check whether rhel repos are in place
if dnf info bison &> /dev/null; then
return
fi

tmp_yumd=$(mktemp -d)
cat <<-'END' > $tmp_yumd/rocky.repo
[rocky-baseos]
name=Rocky Linux $releasever - BaseOS
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
priority=100
[rocky-appstream]
name=Rocky Linux $releasever - AppStream
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
priority=100
[crb]
name=Rocky Linux $releasever - CRB
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
priority=100
[rocky-extras]
name=Rocky Linux $releasever - Extras
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
priority=100
END

cat <<-'END' > $tmp_yumd/RPM-GPG-KEY
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: resf.keykeeper.v1
Comment: Keykeeper
xsFNBGJ5RksBEADF/Lzssm7uryV6+VHAgL36klyCVcHwvx9Bk853LBOuHVEZWsme
kbJF3fQG7i7gfCKGuV5XW15xINToe4fBThZteGJziboSZRpkEQ2z3lYcbg34X7+d
co833lkBNgz1v6QO7PmAdY/x76Q6Hx0J9yiJWd+4j+vRi4hbWuh64vUtTd7rPwk8
0y3g4oK1YT0NR0Xm/QUO9vWmkSTVflQ6y82HhHIUrG+1vQnSOrWaC0O1lqUI3Nuo
b6jTARCmbaPsi+XVQnBbsnPPq6Tblwc+NYJSqj5d9nT0uEXT7Zovj4Je5oWVFXp9
P1OWkbo2z5XkKjoeobM/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fswWFNfe5I+4i
CMHPRFsZNYxQnIA2Prtgt2YMwz3VIGI6DT/Z56Joqw4eOfaJTTQSXCANts/gD7qW
D3SZXPc7wQD63TpDEjJdqhmepaTECbxN7x/p+GwIZYWJN+AYhvrfGXfjud3eDu8/
i+YIbPKH1TAOMwiyxC106mIL705p+ORf5zATZMyB8Y0OvRIz5aKkBDFZM2QN6A==
=PzIf
-----END PGP PUBLIC KEY BLOCK-----
END

runn $SUDO mv $tmp_yumd/rocky.repo /etc/yum.repos.d/
runn $SUDO mv $tmp_yumd/RPM-GPG-KEY /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
runn rm -rf $tmp_yumd
runn $SUDO dnf makecache
}

#----------------------------------------------------------------------------------------------

if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
Expand Down Expand Up @@ -224,23 +328,23 @@ fi
if is_command dnf; then
xinstall dnf-plugins-core

if [[ $os != amzn* && $os != rhel ]]; then
if [[ $os != amzn* ]]; then
(( EPEL < 9 )) && runn $SUDO dnf config-manager -y --set-enabled powertools
(( EPEL >= 9 )) && runn $SUDO dnf config-manager -y --set-enabled crb
(( EPEL > 8 )) && [[ $os != rhel ]] && runn $SUDO dnf config-manager -y --set-enabled crb

if [[ $os == rhel* ]]; then
install_rocky_repos
fi
xinstall epel-release
# xinstall --allowerasing https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EPEL}.noarch.rpm
fi

install_raven
install_remi

install_centos_stream_appstream

elif is_command yum; then
xinstall -y yum-utils

if [[ $os != amzn* && $os != rhel ]]; then
(( EPEL >= 9 )) && runn $SUDO yum config-manager -y --set-enabled crb
fi

xinstall epel-release
install_scl
Expand Down
6 changes: 1 addition & 5 deletions bin/getgcc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ class SystemSetup(paella.Setup):
self.install("build-essential")

def redhat_compat(self):
if((self.dist == "redhat" or self.dist == "centos") and self.os_ver == 9):
pass
else:
self.group_install("'Development Tools'")

self.group_install("'Development Tools'")
if not self.modern:
return
self.run(f"{ROOT}/bin/getepel")
Expand Down
8 changes: 5 additions & 3 deletions bin/getget
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ elif is_command yum; then
elif is_command brew; then
packs=${packs/ca-certificates/}
fi

if is_command curl; then
packs=${packs/curl/}
if [[ $os == rocky || $os == almalinux || $os == rhel ]]; then
# has curl-minimal which conflicts with curl
if [[ $(echo "$osver >= 9.0" | bc -l) ]]; then
packs=${packs/curl/}
fi
fi

if [[ $FORCE != 1 ]]; then
Expand Down
3 changes: 1 addition & 2 deletions bin/getredis
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,7 @@ index b0727db2c..ae7f3f80a 100644
def redhat_compat(self):
if self.no_prepare:
return
if shutil.which('gcc') is None:
self.run(f"{ROOT}/bin/getgcc --modern")
self.group_install("'Development Tools'")
self.install("openssl-devel")

def fedora(self):
Expand Down
2 changes: 1 addition & 1 deletion bin/getrmpytools
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class RMPyToolsSetup(paella.Setup):
redis_py_cluster_installed = False
if self.redispy_version is None:
if self.modern:
self.pip_install("--no-cache-dir redis==5.0.0b4") # redis~=5.0.0 / redis~=5.0.0rc1
self.pip_install("--no-cache-dir redis~=5.0.0")
elif self.legacy:
self.pip_install("--no-cache-dir git+https://github.com/redisfab/redis-py.git@3.5")
self.pip_install("--no-cache-dir git+https://github.com/redisfab/redis-py-cluster@2.1")
Expand Down
3 changes: 1 addition & 2 deletions bin/platform
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
''''[ ! -z $VIRTUAL_ENV ] && exec python -u -- "$0" ${1+"$@"}; command -v python3 > /dev/null && exec python3 -u -- "$0" ${1+"$@"}; exec python2 -u -- "$0" ${1+"$@"} # '''
#!/usr/bin/env python3

import sys
import os
Expand Down
2 changes: 0 additions & 2 deletions mk/docker
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ OS.archlinux=archlinux:latest
OS.ol8=oraclelinux:8
OS.alma8=almalinux:8
OS.rocky8=rockylinux:8
OS.rocky9=rockylinux:9
OS.rhel9=redhat/ubi9

endif # OS

Expand Down
2 changes: 0 additions & 2 deletions mk/docker.cross
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ OS.archlinux=archlinux:latest
OS.ol8=oraclelinux:8
OS.alma8=almalinux:8
OS.rocky8=rockylinux:8
OS.rocky9=rockylinux:9
OS.rhel9=redhat/ubi9

endif # OS

Expand Down
2 changes: 0 additions & 2 deletions mk/docker.native
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ OS.archlinux=archlinux:latest
OS.ol8=oraclelinux:8
OS.alma8=almalinux:8
OS.rocky8=rockylinux:8
OS.rocky9=rockylinux:9
OS.rhel9=redhat/ubi9
OS.jammy=ubuntu:jammy

endif # OS
Expand Down
3 changes: 2 additions & 1 deletion mk/osnick.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ OS.leap15.2=opensuse/leap:15.2
OS.leap15.3=opensuse/leap:15.3
OS.tumbleweed=opensuse/tumbleweed
OS.archlinux=archlinux:latest
OS.manjaro=manjarolinux/base:latest
OS.alpine3=alpine:latest
OS.ol7=oraclelinux:7
OS.ol8=oraclelinux:8
Expand All @@ -35,7 +36,7 @@ OS.alma8=almalinux:8
OS.alma9=almalinux:9
OS.rocky8=rockylinux:8
OS.rocky9=rockylinux:9
OS.rhel9=redhat/ubi9
OS.rhel9=redhat/ubi9:latest
OS.jammy=ubuntu:jammy
OS.amzn2=amazonlinux:2
OS.amzn2022=amazonlinux:2022
Expand Down
Loading

0 comments on commit d236c4a

Please sign in to comment.