test/integration/lib.sh: fix kernel build dependencies

The yum-builddep utility doesn't always install all the kernel build
dependencies.  Using the --skip-unavailable flag (rhel8+) lets us skip
over packages that it can't find, but continue to install the ones it
can. (Unavailable packages are usually platform-specific or not strictly
necessary for kpatch-build's kernel build invocation.)

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
Joe Lawrence 2022-05-23 08:47:18 -04:00
parent 6b0b482d16
commit e72b876f97
1 changed files with 21 additions and 26 deletions

View File

@ -58,38 +58,33 @@ kpatch_rhel_dependencies()
local kernel_version local kernel_version
local arch local arch
local rhel_major local rhel_major
local py_version local yum_utils_version
kernel_version=$(uname -r) kernel_version=$(uname -r)
arch=$(uname -m) arch=$(uname -m)
rhel_major=${VERSION_ID%%.*} rhel_major=${VERSION_ID%%.*}
if [ "${rhel_major}" -ge 8 ]; then # kpatch-build dependencies
py_version="3" sudo yum install -y \
else elfutils \
py_version="2" elfutils-devel \
fi gcc \
gcc-c++ \
sudo yum install -y git gcc gcc-c++ "kernel-devel-${kernel_version%.*}" elfutils elfutils-devel git \
sudo yum install -y yum-utils zlib-devel binutils-devel newt-devel \ "kernel-devel-${kernel_version%.*}" \
python${py_version}-devel perl-ExtUtils-Embed audit-libs-devel numactl-devel \ rpm-build \
pciutils-devel bison ncurses-devel rpm-build java-devel wget \
sudo yum-builddep -y "kernel-${kernel_version%.*}" yum-utils
sudo debuginfo-install -y "kernel-${kernel_version%.*}" sudo debuginfo-install -y "kernel-${kernel_version%.*}"
[[ "$arch" == "ppc64le" ]] && sudo yum install -y gcc-plugin-devel
case "${arch}" in # kernel dependencies
"x86_64") yum_utils_version=$(rpm -q --queryformat="%{version}" yum-utils)
sudo yum install -y pesign if [[ "${yum_utils_version}" = "$(echo -e "${yum_utils_version}\\n4.0.12" | sort -rV | head -n1)" ]]; then
;; sudo yum-builddep -y --skip-unavailable "kernel-${kernel_version%.*}"
"ppc64le") else
sudo yum install -y gcc-plugin-devel sudo yum-builddep -y "kernel-${kernel_version%.*}"
if [ "${rhel_major}" -ge 8 ]; then
# yum-builddep doesn't provide everything we need :(
sudo yum install -y flex openssl-devel
fi fi
;; [[ "$arch" == "x86_64" ]] && sudo yum install -y pesign
*)
;;
esac
# ccache # ccache
if ! command -v ccache &> /dev/null; then if ! command -v ccache &> /dev/null; then