mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
92284f9b81
The default `_NPROCESSORS_ONLN` heuristic we have isn't cgroups aware. So it thinks it has e.g. 40 CPUs when running in a k8s pod. This can then blow through our allocated resource limits. Declare some modest amount of RAM and CPU resources and override `make` parallelism. This matches what rpm-ostree now does in https://github.com/coreos/rpm-ostree/pull/2155.
70 lines
1.9 KiB
Bash
70 lines
1.9 KiB
Bash
#!/usr/bin/bash
|
|
|
|
dn=$(cd $(dirname $0) && pwd)
|
|
|
|
OS_ID=$(. /etc/os-release; echo $ID)
|
|
OS_VERSION_ID=$(. /etc/os-release; echo $VERSION_ID)
|
|
|
|
pkg_upgrade() {
|
|
yum -y distro-sync
|
|
}
|
|
|
|
make() {
|
|
/usr/bin/make -j ${MAKE_JOBS:-$(getconf _NPROCESSORS_ONLN)} "$@"
|
|
}
|
|
|
|
build() {
|
|
env NOCONFIGURE=1 ./autogen.sh
|
|
./configure --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 "$@"
|
|
make V=1
|
|
}
|
|
|
|
pkg_install() {
|
|
yum -y install "$@"
|
|
}
|
|
|
|
pkg_install_if_os() {
|
|
local os=$1
|
|
shift
|
|
if test "${os}" = "${OS_ID}"; then
|
|
pkg_install "$@"
|
|
else
|
|
echo "Skipping installation targeted for ${os} (current OS: ${OS_ID}): $@"
|
|
fi
|
|
}
|
|
|
|
pkg_install_buildroot() {
|
|
case "${OS_ID}" in
|
|
fedora)
|
|
# https://github.com/projectatomic/rpm-ostree/pull/1889/commits/9ff611758bea22b0ad4892cc16182dd1f7f47e89
|
|
# https://fedoraproject.org/wiki/Common_F30_bugs#Conflicts_between_fedora-release_packages_when_installing_package_groups
|
|
if rpm -q fedora-release-container; then
|
|
yum -y swap fedora-release{-container,}
|
|
fi
|
|
pkg_install dnf-plugins-core @buildsys-build;;
|
|
centos) pkg_install yum-utils
|
|
# Base buildroot, copied from the mock config sadly
|
|
pkg_install bash bzip2 coreutils cpio diffutils system-release findutils gawk gcc gcc-c++ \
|
|
grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar \
|
|
unzip util-linux which xz;;
|
|
*) fatal "pkg_install_buildroot(): Unhandled OS ${OS_ID}";;
|
|
esac
|
|
}
|
|
|
|
pkg_builddep() {
|
|
# This is sadly the only case where it's a different command
|
|
if test -x /usr/bin/dnf; then
|
|
dnf builddep -y "$@"
|
|
else
|
|
yum-builddep -y "$@"
|
|
fi
|
|
}
|
|
|
|
# Install both build and runtime dependencies for $pkg
|
|
pkg_builddep_runtimedep() {
|
|
local pkg=$1
|
|
pkg_builddep $pkg
|
|
pkg_install $pkg
|
|
rpm -e $pkg
|
|
}
|