Merge pull request #1271 from joe-lawrence/integration-kpatch_rhel_dependencies

kpatch build dependency cleanup
This commit is contained in:
Joe Lawrence 2022-05-25 09:35:12 -04:00 committed by GitHub
commit e425e653aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 68 deletions

View File

@ -10,17 +10,22 @@ UNITTEST_DIR = test/unit
INTEGRATION_DIR = test/integration
CLEAN_DIRS += clean-$(UNITTEST_DIR)
.PHONY: all install uninstall clean check unit
.PHONY: all dependencies install uninstall clean check unit
.PHONY: $(SUBDIRS) $(BUILD_DIRS) $(INSTALL_DIRS) $(CLEAN_DIRS)
.PHONY: integration integration-slow integration-quick
.PHONY: vagrant-integration-slow vagrant-integration-quick vagrant-integration
.PHONY: vagrant-install
.PHONY: help
all: $(BUILD_DIRS)
$(BUILD_DIRS):
$(MAKE) -C $(@:build-%=%)
dependencies: SHELL:=/bin/bash
dependencies:
source test/integration/lib.sh && kpatch_dependencies
install: $(INSTALL_DIRS)
$(INSTALL_DIRS):
$(MAKE) -C $(@:install-%=%) install
@ -67,3 +72,24 @@ check:
test/integration/lib.sh test/integration/rebase-patches \
test/integration/test-vagrant \
test/integration/vm-integration-run
help:
@echo "kpatch Makefile"
@echo
@echo "Targets:"
@echo " make dependencies install build dependencies [1]"
@echo " make all build entire project"
@echo " make install install programs to system [1]"
@echo " make uninstall remove programs from system [1]"
@echo " make clean clean build files"
@echo
@echo "Test targets:"
@echo " make check run static code analyzers"
@echo " make integration build and run integration tests [2]"
@echo " make integration-slow build and run integration tests [2]"
@echo " make integration-quick build and run integration tests [2]"
@echo " make unit run unit tests"
@echo
@echo "[1] requires admin privileges"
@echo "[2] installs test kpatch kernel modules, run at your own risk"
@echo

View File

@ -32,9 +32,8 @@ architecture is supported.
Install the dependencies for compiling kpatch and running kpatch-build:
```bash
source test/integration/lib.sh
# Will request root privileges
kpatch_dependencies
make dependencies
```
### Oracle Linux 7
@ -78,12 +77,12 @@ ccache --max-size=5G
Install the dependencies for compiling kpatch and running kpatch-build
```bash
source test/integration/lib.sh
# required on ppc64le
# e.g., on Ubuntu 18.04 for gcc-7.3
apt-get install gcc-7-plugin-dev
# Will request root privileges
kpatch_dependencies
make dependencies
```
### Debian 9 (Stretch)
@ -200,9 +199,8 @@ to see its documents. This document describes how to run mainline kpatch in open
Install the dependencies for compiling kpatch and running kpatch-build:
```bash
source test/integration/lib.sh
# Will request root privileges
kpatch_dependencies
make dependencies
```
Before running kpatch-build, two more things need to be checked:

View File

@ -7,23 +7,6 @@ kpatch_set_ccache_max_size()
ccache --max-size="${ccache_max_size}"
}
kpatch_fedora_dependencies()
{
local kernel_version
kernel_version=$(uname -r)
sudo dnf install -y gcc "kernel-devel-${kernel_version%.*}" elfutils elfutils-devel
sudo dnf install -y pesign yum-utils openssl wget numactl-devel
sudo dnf builddep -y "kernel-${kernel_version%.*}"
sudo dnf debuginfo-install -y "kernel-${kernel_version%.*}"
sudo dnf install -y ccache
if [[ "$(uname -m)" == "ppc64le" ]]; then
sudo yum install -y gcc-plugin-devel
fi
}
kpatch_ubuntu_dependencies()
{
sudo sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
@ -58,62 +41,52 @@ kpatch_rhel_dependencies()
local kernel_version
local arch
local rhel_major
local py_version
local yum_utils_version
kernel_version=$(uname -r)
arch=$(uname -m)
rhel_major=${VERSION_ID%%.*}
if [ "${rhel_major}" -ge 8 ]; then
py_version="3"
else
py_version="2"
fi
sudo yum install -y git gcc gcc-c++ "kernel-devel-${kernel_version%.*}" elfutils elfutils-devel
sudo yum install -y yum-utils zlib-devel binutils-devel newt-devel \
python${py_version}-devel perl-ExtUtils-Embed audit-libs-devel numactl-devel \
pciutils-devel bison ncurses-devel rpm-build java-devel
sudo yum-builddep -y "kernel-${kernel_version%.*}"
# kpatch-build dependencies
sudo yum install -y \
elfutils \
elfutils-devel \
gcc \
gcc-c++ \
git \
"kernel-devel-${kernel_version%.*}" \
rpm-build \
wget \
yum-utils
sudo debuginfo-install -y "kernel-${kernel_version%.*}"
[[ "$arch" == "ppc64le" ]] && sudo yum install -y gcc-plugin-devel
case "${arch}" in
"x86_64")
sudo yum install -y pesign
;;
"ppc64le")
sudo yum install -y gcc-plugin-devel
if [ "${rhel_major}" -ge 8 ]; then
# yum-builddep doesn't provide everything we need :(
sudo yum install -y flex openssl-devel
# kernel dependencies
yum_utils_version=$(rpm -q --queryformat="%{version}" yum-utils)
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%.*}"
else
sudo yum-builddep -y "kernel-${kernel_version%.*}"
fi
;;
*)
;;
esac
[[ "$arch" == "x86_64" ]] && sudo yum install -y pesign
sudo yum install -y "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
sudo yum install -y ccache
# ccache
if ! command -v ccache &> /dev/null; then
if ! sudo yum install -y ccache; then
sudo yum install -y "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${rhel_major}.noarch.rpm" && \
sudo yum install -y ccache && \
sudo yum remove -y epel-release
fi
fi
}
kpatch_centos_dependencies()
{
local kernel_version
local arch
kernel_version=$(uname -r)
arch=$(uname -m)
kpatch_rhel_dependencies
}
sudo yum install -y gcc gcc-c++ "kernel-devel-${kernel_version%.*}" elfutils elfutils-devel
sudo yum install -y yum-utils zlib-devel binutils-devel newt-devel \
python-devel perl-ExtUtils-Embed audit-libs-devel numactl-devel \
pciutils-devel bison ncurses-devel rpm-build java-devel pesign
sudo yum-config-manager --enable debug
sudo yum-builddep -y "kernel-${kernel_version%.*}"
sudo debuginfo-install -y "kernel-${kernel_version%.*}"
sudo yum install -y "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
sudo yum install -y ccache
sudo yum remove -y epel-release
kpatch_fedora_dependencies()
{
kpatch_rhel_dependencies
}
kpatch_openEuler_dependencies()