python3: use backported libselinux-python3

It seems that CentOS 7 will not be shipping libselinux-python3
until 7.8 most likely and we need to unblock our gates, so this
will start allowing us to use Python 3 within CentOS 7.

Change-Id: Ia7545d10bffe92c9ef74cbbf44d5e3b3cb356158
This commit is contained in:
Mohammed Naser 2020-02-24 10:44:26 +01:00
parent 853dec794d
commit fb1a66e037
2 changed files with 10 additions and 3 deletions

View File

@ -64,12 +64,19 @@ determine_distro
# Prefer dnf over yum for CentOS.
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
# Install the base packages
case ${DISTRO_ID} in
centos|rhel)
# NOTE(mnaser): libselinux-python3 will likely not exist until CentOS 7.8 and
# we need to unblock our gates to be able to use Python 3, so we
# use this temporary repository. This should be removed once
# CentOS 7 releases libselinux-2.5-15.
curl https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/8709ca2640344a4ba85cba0a1d6eea69/libselinux-2.5-15/libselinux.repo \
-o /etc/yum.repos.d/libselinux.repo
$RHT_PKG_MGR -y install \
git curl autoconf gcc gcc-c++ nc \
python2 python2-devel \
python3 python3-devel libselinux-python3 \
openssl-devel libffi-devel \
libselinux-python python-virtualenv
;;

View File

@ -86,8 +86,8 @@ function build_ansible_runtime_venv {
$PIP_COMMAND install -e .
# Add SELinux support to the venv
if [ -d "/usr/lib64/python2.7/site-packages/selinux/" ]; then
rsync -avX /usr/lib64/python2.7/site-packages/selinux/ /opt/ansible-runtime/lib64/python2.7/selinux/
if [ -d "/usr/lib64/python3.6/site-packages/selinux/" ]; then
rsync -avX /usr/lib64/python3.6/site-packages/selinux/ /opt/ansible-runtime/lib64/python3.6/selinux/
fi
}