Skip to content

Commit 99c3342

Browse files
phlogistonjohnanoopcs9
authored andcommitted
container: update build script handle more distro conditions
Start to prepare for centos stream10 build support by moving things that not all versions support out of the packages list and adding a set of distro-conditional actions in. Signed-off-by: John Mulligan <[email protected]>
1 parent 1928d09 commit 99c3342

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tests/container/build.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ setup_update() {
8888
task_sys_deps() {
8989
info "installing system packages"
9090
OS_VER=$(source /etc/os-release && echo "${ID}-${VERSION_ID}")
91+
local use_distro
9192
case "${OS_VER}" in
9293
centos*)
9394
info "detected centos (stream): ${OS_VER}"
94-
use_centos=true
95+
use_distro="el${OS_VER/*-},centos"
9596
;;
9697
rhel*)
9798
info "detected rhel: ${OS_VER}"
98-
use_centos=
99-
use_rhel=true
99+
use_distro="el${OS_VER/*-},rhel"
100100
;;
101101
fedora*)
102102
info "detected fedora: ${OS_VER}"
103-
use_centos=
103+
use_distro=fedora
104104
;;
105105
*)
106106
info "unknown platform: ${OS_VER}"
@@ -121,10 +121,9 @@ task_sys_deps() {
121121
python3-wheel \
122122
python3-pyxattr \
123123
python3-devel \
124-
python3.9 \
125124
samba-common-tools \
126125
rpm-build \
127-
'python3dist(flake8)' \
126+
pyproject-rpm-macros \
128127
'python3dist(inotify-simple)' \
129128
'python3dist(mypy)' \
130129
'python3dist(pytest)' \
@@ -134,14 +133,16 @@ task_sys_deps() {
134133
'python3dist(wheel)' \
135134
)
136135

137-
if [ "$use_centos" ]; then
138-
"${dnf_cmd}" install -y epel-release
139-
yum_args=(--enablerepo=crb)
140-
pkgs+=(pyproject-rpm-macros)
141-
fi
142-
if [ "$use_rhel" ]; then
143-
pkgs+=(pyproject-rpm-macros)
144-
fi
136+
case "${use_distro}" in
137+
fedora|el9,centos)
138+
pkgs+=(python3.9)
139+
;;&
140+
# common for all centos
141+
*,centos)
142+
"${dnf_cmd}" install -y epel-release
143+
yum_args=(--enablerepo=crb)
144+
;;&
145+
esac
145146
"${dnf_cmd}" "${yum_args[@]}" install -y "${pkgs[@]}"
146147
"${dnf_cmd}" clean all
147148
}

0 commit comments

Comments
 (0)