Compare commits

...

21 Commits

Author SHA1 Message Date
Greg Cymbalski
100ea47bf7 Clarity: set SKIP_CACHE=1 to ignore docker cache 2025-12-15 18:41:42 -08:00
Greg Cymbalski
7a1d9d0aba Consistency: set -x when VERBOSE set to 1 2025-12-15 18:41:40 -08:00
Greg Cymbalski
e3a6d31b1d Reorder for clarity/work around el7 naming conventions 2025-12-15 18:02:00 -08:00
Greg Cymbalski
3fae02a3db Set build scripts executable 2025-12-15 17:23:40 -08:00
Greg Cymbalski
9b007e434d Disable verbose logging of builds by default 2025-12-15 17:21:22 -08:00
Greg Cymbalski
dd94d689aa Remove vestigial configuration 2025-12-15 17:19:00 -08:00
Greg Cymbalski
8737af1fa5 Parameterize proxy used by mock 2025-12-15 17:17:21 -08:00
Greg Cymbalski
309e9c0cb0 Use tried-and-true non-docker builds for el7 2025-12-15 17:16:42 -08:00
Greg Cymbalski
d0eaaa2738 Don't use devel kernels as a proxy for available kernel packages 2025-12-03 17:51:55 -08:00
Greg Cymbalski
ba7a8fcbba Special cases for EL7 builds 2025-12-03 14:09:48 -08:00
Greg Cymbalski
a8ba5a6a5e Support building against specific kvers 2025-12-03 14:08:23 -08:00
Greg Cymbalski
7ccb33cd30 Consistency: Use 0/1 for false/true everywhere
And consolidate 'edge' distro configuration.
2025-12-03 14:07:44 -08:00
Greg Cymbalski
28a8dc83ef Critical dep 2025-12-02 14:00:12 -08:00
Greg Cymbalski
a85fff1934 Automatically handle building scoutfs containers 2025-12-02 13:53:15 -08:00
Greg Cymbalski
087f756e78 Dockerfile for scoutfs build environments 2025-12-02 13:47:55 -08:00
Greg Cymbalski
51a4a41f26 Revert "Experiment: conflict with nonequal packages to prevent upgrades to kernels that do not have scoutfs kmods prebuilt"
This reverts commit 680dcd4653.
2025-12-02 11:36:01 -08:00
Greg Cymbalski
680dcd4653 Experiment: conflict with nonequal packages to prevent upgrades to kernels that do not have scoutfs kmods prebuilt 2025-12-01 16:36:46 -08:00
Greg Cymbalski
cc55ae4ee8 Provide a version to the virtual package we provide 2025-12-01 16:10:31 -08:00
Greg Cymbalski
f3fffa9e4b WIP: Tooling to build all kversions, needs major refactoring before pushing 2025-12-01 11:08:24 -08:00
Greg Cymbalski
329b9e817b Closer target kernel tracking
- This makes ScoutFS packages more directly tied to a given kernel while
  still allowing for weak modules usage when possible.
- For EL9, this still prevents the installation of kmod packages across
  minor releases, which no longer have strict kABI gurantees.
2025-11-26 13:57:35 -08:00
Zach Brown
1c7678b6f5 Merge pull request #263 from versity/zab/v1.26
v1.26 Release
2025-11-18 09:39:27 -08:00
7 changed files with 480 additions and 3 deletions

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
ARG IMAGE_SOURCE=library/centos:centos7.9.2009
FROM "${IMAGE_SOURCE}"
ARG IS_EDGE=1
ENV IS_EDGE=${IS_EDGE}
ARG HTTP_PROXY=http://package-mirror.vpn.versity.com:3128
ENV HTTP_PROXY=${HTTP_PROXY}
ARG http_proxy=http://package-mirror.vpn.versity.com:3128
ENV http_proxy=${http_proxy}
ARG SKIP_REPO_FIXUP=false
ENV SKIP_REPO_FIXUP=${SKIP_REPO_FIXUP}
COPY repo-fixup.sh /tmp/repo-fixup.sh
RUN IS_EDGE="${IS_EDGE}" bash /tmp/repo-fixup.sh
RUN bash -c "yum install -y diff || yum install -y diffutils"
RUN yum groupinstall -y 'Development Tools'
RUN yum install -y epel-release rpm-build sudo
RUN yum install -y mock

20
build-all.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
export VERBOSE="${VERBOSE:-0}"
if [ "${VERBOSE}" -eq 1 ]; then
set -x
fi
export EL_VER
export IS_EDGE
# 'edge' releases first'
for EL_VER in 8.10 9.6; do
IS_EDGE=1
bash ./build-minor.sh
done
# then legacy
for EL_VER in 8.9 9.4 9.5; do
IS_EDGE=0
bash ./build-minor.sh
done

37
build-container.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
set -ex
export VERBOSE="${VERBOSE:-0}"
if [ "${VERBOSE}" -eq 1 ]; then
set -x
fi
export EL_MAJOR_VER="${EL_MAJOR_VER:-9.5}"
export EL_VER="${EL_VER:-${EL_MAJOR_VER}}"
export MAJOR_VER="${EL_VER%%.*}"
export MINOR_VER="${EL_VER#*.}"
export IS_EDGE="${IS_EDGE:-0}"
export SKIP_CACHE="${SKIP_CACHE:-0}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-0}"
docker_args=()
if [ "${SKIP_CACHE}" -eq '1' ]; then
docker_args+=(--no-cache)
fi
if [ -z "${MINOR_VER}" ] || [ -z "${MAJOR_VER}" ]; then
echo "Major/minor versions could not be inferred from required version ${EL_VER}, bailing out"
exit 1
fi
if [ "${MAJOR_VER}" -gt 7 ]; then
IMAGE_BASE="quay.io/rockylinux/rockylinux"
IMAGE_VERSION="${MAJOR_VER}.${MINOR_VER}-ubi"
else
IMAGE_BASE="library/centos"
IMAGE_VERSION="centos7.9.2009"
fi
# build fresh 'builder' images only if we don't have them or want to force a rebuild
if [ "$(docker images -q scoutfs-builder:el${MAJOR_VER}.${MINOR_VER})" == "" ] || [ "${FORCE_REBUILD_DOCKER_IMAGE}" == '1' ]; then
docker build . "${docker_args[@]}" --progress plain --build-arg IS_EDGE="${IS_EDGE}" --build-arg IMAGE_SOURCE="${IMAGE_BASE}:${IMAGE_VERSION}" -t "scoutfs-builder:el${MAJOR_VER}.${MINOR_VER}"
fi

49
build-minor.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
set -e
export VERBOSE="${VERBOSE:-0}"
if [ "${VERBOSE}" -eq 1 ]; then
set -x
fi
export EL_MAJOR_VER="${EL_MAJOR_VER:-9.4}"
export EL_VER="${EL_VER:-${EL_MAJOR_VER}}"
export MAJOR_VER="${EL_VER%%.*}"
export MINOR_VER="${EL_VER#*.}"
export RELEASE="${RELEASE:-0}"
export IS_EDGE="${IS_EDGE:-0}"
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-0}"
export HTTP_PROXY="${HTTP_PROXY:-}"
if [ -z "${KVERS}" ]; then
KVERS="$(bash build-packages.sh get-kvers)"
else
echo "Specified the following kernel versions to build against:"
echo "${KVERS}"
fi
# use old-style build process for el7
if [ "${MAJOR_VER}" -gt 7 ]; then
bash build-container.sh
fi
for KVER in ${KVERS}; do
echo "Building for ${KVER} on ${EL_VER}"
if [ "${MAJOR_VER}" -gt 7 ]; then
docker run --rm --privileged \
-e "VERBOSE=${VERBOSE}" \
-e "KVERSION=${KVER}" \
-e "EL_VER=${EL_VER}" \
-e "RELEASE=${RELEASE}" \
-e "HTTP_PROXY=${HTTP_PROXY}" \
-e "IS_EDGE=${IS_EDGE}" \
-v "/var/cache:/var/cache" \
-v "/run/containers/storage:/run/containers/storage" \
-v "/var/lib/containers/storage:/var/lib/containers/storage" \
-v .:/repo \
"scoutfs-builder:el${EL_VER}" \
bash -c "cd /repo && git config --global --add safe.directory /repo && bash build-packages.sh && chown -R ${UID} /repo"
else
# use 'legacy' build process for el7
KVERSION="${KVER}" bash build-packages.sh
fi
done

264
build-packages.sh Executable file
View File

@@ -0,0 +1,264 @@
#!/bin/bash
set -e
export VERBOSE="${VERBOSE:-0}"
if [ "${VERBOSE}" -eq 1 ]; then
set -x
fi
export EL_MAJOR_VER="${EL_MAJOR_VER:-9.5}"
export EL_VER="${EL_VER:-${EL_MAJOR_VER}}"
export MAJOR_VER="${EL_VER%%.*}"
export MINOR_VER="${EL_VER#*.}"
export IS_EDGE="${IS_EDGE:-0}"
mock_args=()
if [ "${VERBOSE}" -eq 1 ]; then
mock_args+=(-v)
else
mock_args+=(-q)
fi
function get_kvers {
REPO_PATH="$1"
if [ "${MAJOR_VER}" -gt 7 ]; then
PKG_PATH="${REPO_PATH}/BaseOS/x86_64/os/Packages/k/"
else
PKG_PATH="${REPO_PATH}/os/x86_64/Packages/"
fi
curl "${PKG_PATH}" | \
grep -e 'kernel-[0-9]' | \
grep -o 'href="[^"]*\.rpm"' | \
cut -d'"' -f2 | \
sed -e 's/^[a-z-]*//g' | \
sed -e 's/\.el.*//g' | \
sort -V
}
function get_latest_kver {
get_kvers "$1" | tail -n1
}
function get_oldest_kver {
get_kvers "$1" | head -n1
}
function repo_addr {
REPO_BASE="$1"
REPO_NAME="$2"
echo "${REPO_BASE}/${REPO_NAME}/x86_64/os/"
}
RELEASE=${RELEASE:-0}
if [ "${RELEASE}" == "1" ]; then
RELEASE_OPT=(--define "_release ${RELEASE}")
else
RELEASE_OPT=()
fi
if [ "${IS_EDGE}" -eq 1 ]; then
REPO_ROOT_PATH="pub"
else
REPO_ROOT_PATH="vault"
fi
if [ "${MAJOR_VER}" -gt 7 ]; then
REPO_BASE="http://download.rockylinux.org/${REPO_ROOT_PATH}/rocky/${EL_VER}"
DISTRO=rocky
EXTRA_CONFIG="config_opts['bootstrap_image'] = \"quay.io/rockylinux/rockylinux:${EL_VER}\""
PACKAGE_MANAGER="dnf"
SETUP_CMD='install tar gcc-c++ redhat-rpm-config redhat-release which xz sed make bzip2 gzip gcc coreutils unzip shadow-utils diffutils cpio bash gawk rpm-build info patch util-linux findutils grep systemd sparse'
KEY_URL="https://download.rockylinux.org/pub/rocky/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}"
else
REPO_BASE="https://vault.centos.org/7.9.2009"
DISTRO=centos
EXTRA_CONFIG=""
PACKAGE_MANAGER="yum"
SETUP_CMD='install @buildsys-build redhat-rpm-config /usr/bin/pigz /usr/bin/lbzip2 hostname shadow-utils rpm-build make gcc sparse'
KEY_URL="https://vault.centos.org/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7"
fi
if [[ "${1}" == 'get-kvers' ]]; then
get_kvers "${REPO_BASE}"
exit 0
fi
# if we haven't injected the KVERSION we want into the env, detect it based on the repo path
if [ -z "${KVERSION}" ]; then
if [ "${REPO_ROOT_PATH}" = "pub" ]; then
# unfortunately we HAVE to use the latest version
KVERSION="$(get_latest_kver "${REPO_BASE}")"
else
KVERSION="$(get_oldest_kver "${REPO_BASE}")"
fi
fi
if [ "${MAJOR_VER}" -gt 7 ]; then
RPM_KVERSION="${KVERSION}.el${EL_VER//./_}.x86_64"
else
RPM_KVERSION="${KVERSION}.el${MAJOR_VER}.x86_64"
fi
echo "Starting Build $BUILD_DISPLAY_NAME on $NODE_NAME"
(git repack -a -d && rm -f .git/objects/info/alternates) || true
cat <<EOF >scoutfs-build-${EL_VER}.cfg
config_opts['root'] = '${DISTRO}-${EL_VER}-base-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = '${SETUP_CMD}'
config_opts['dist'] = 'el${MAJOR_VER}' # only useful for --resultdir variable subst
config_opts['releasever'] = '${MAJOR_VER}'
config_opts['package_manager'] = '${PACKAGE_MANAGER}'
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
${EXTRA_CONFIG}
config_opts['description'] = "${DISTRO} ${EL_VER}"
config_opts['http_proxy'] = '${HTTP_PROXY}'
# experiment: simplify for better docker use
config_opts['use_nspawn'] = False
config_opts['isolation'] = 'simple'
config_opts['plugin_conf']['root_cache_enable'] = True
config_opts['plugin_conf']['yum_cache_enable'] = True
config_opts['plugin_conf']['dnf_cache_enable'] = True
config_opts['${PACKAGE_MANAGER}.conf'] = """
[main]
keepcache=1
debuglevel=2
reposdir=/dev/null
logfile=/var/log/yum.log
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
metadata_expire=0
mdpolicy=group:primary
best=1
install_weak_deps=0
protected_packages=
module_platform_id=platform:el${MAJOR_VER}
user_agent={{ user_agent }}
# repos
EOF
if [ "${MAJOR_VER}" -gt 7 ]; then
cat <<EOF >>scoutfs-build-${EL_VER}.cfg
[baseos]
name=${DISTRO} ${EL_VER} - BaseOS
repo=${DISTRO}-BaseOS-${EL_VER}&arch=x86_64
baseurl=$(repo_addr "${REPO_BASE}" "BaseOS")
gpgcheck=0
enabled=1
gpgkey=file:///usr/share/distribution-gpg-keys/${DISTRO}/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}
[appstream]
name=${DISTRO} ${EL_VER} - AppStream
baseurl=$(repo_addr "${REPO_BASE}" "AppStream")
gpgcheck=0
enabled=1
gpgkey=file:///usr/share/distribution-gpg-keys/${DISTRO}/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}
[devel]
name=${DISTRO} ${EL_VER} - Devel
repo=${DISTRO}-Devel-${EL_VER}&arch=x86_64
baseurl=$(repo_addr "${REPO_BASE}" "devel")
gpgcheck=0
enabled=1
gpgkey=file:///usr/share/distribution-gpg-keys/${DISTRO}/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}
[epel]
name=EPEL - \$releasever
baseurl=https://dl.fedoraproject.org/pub/epel/\$releasever/Everything/x86_64/
gpgcheck=0
enabled=1
"""
EOF
else
cat <<EOF >>scoutfs-build-${EL_VER}.cfg
[baseos]
name=${DISTRO} ${EL_VER} - BaseOS
repo=${DISTRO}-BaseOS-${EL_VER}&arch=x86_64
baseurl=http://vault.centos.org/7.9.2009/os/x86_64/
gpgcheck=0
enabled=1
gpgkey=file:///usr/share/distribution-gpg-keys/${DISTRO}/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}
[epel]
name=EPEL - \$releasever
baseurl=https://archives.fedoraproject.org/pub/archive/epel/${MAJOR_VER}/x86_64/
gpgcheck=0
enabled=1
"""
EOF
fi
cd "${WORKSPACE:-.}"
sudo mkdir -p /usr/share/distribution-gpg-keys/${DISTRO}/
sudo curl -o "/usr/share/distribution-gpg-keys/${DISTRO}/RPM-GPG-KEY-${DISTRO}-${MAJOR_VER}" "${KEY_URL}"
# make kmod rpms
pushd kmod
rm kmod-scoutfs.spec || true
make dist
if [ "$?" -ne "0" ]; then
exit 1
fi
sleep 5s
try=0
while [[ "$try" -lt "3" ]]; do
echo "Trying to build srpm; attempt #$try"
set +e
SRPM=$(rpmbuild -ts "${RELEASE_OPT[@]}" --define "kversion ${RPM_KVERSION}" --define "dist .el${MAJOR_VER}" scoutfs-kmod-*.tar | awk '{print $2}' )
set -e
if [ -f "$SRPM" ]; then
echo "SRPM created: $SRPM"
break
fi
try="$((try + 1))"
sleep 5s
done
if [ -z "$SRPM" ]; then
echo "no srpm found."
exit 1
fi
mock_args+=(--${PACKAGE_MANAGER})
mock "${mock_args[@]}" --enablerepo epel -r "../scoutfs-build-${EL_VER}.cfg" rebuild "${RELEASE_OPT[@]}" --define "kversion ${RPM_KVERSION}" --define "dist .el${EL_VER//./_}" --resultdir "./scoutfs_${EL_VER//./_}" "${SRPM}"
if [ "$?" -ne "0" ]; then
exit 1
fi
popd
# make utils rpms
pushd utils
make dist
if [ "$?" -ne "0" ]; then
exit 1
fi
SRPM=$(rpmbuild -ts "${RELEASE_OPT[@]}" --define "dist .el${MAJOR_VER}" scoutfs-utils-*.tar | awk '{print $2}')
if [ -z "$SRPM" ]; then
echo "no srpm found."
exit 1
fi
mock "${mock_args[@]}" --enablerepo epel -r "../scoutfs-build-${EL_VER}.cfg" rebuild "${RELEASE_OPT[@]}" --define "dist .el${MAJOR_VER}" --resultdir "./scoutfs_${EL_VER//./_}" "${SRPM}"
if [ "$?" -ne "0" ]; then
exit 1
fi
popd

View File

@@ -7,6 +7,7 @@
# take kernel version or default to uname -r
%{!?kversion: %global kversion %(uname -r)}
%global kernel_version %{kversion}
%define sanitized_kernel_version %(echo %{kernel_version} | tr - _ |sed -e 's/.x86_64//')
%if 0%{?el7}
%global kernel_source() /usr/src/kernels/%{kernel_version}.$(arch)
@@ -17,16 +18,20 @@
%{!?_release: %global _release 0.%{pkg_date}git%{kmod_git_hash}}
%if 0%{?el7}
Name: %{kmod_name}
Name: %{kmod_name}-%{sanitized_kernel_version}
Provides: %{kmod_name} = %{kmod_version}
%else
Name: kmod-%{kmod_name}
Name: kmod-%{kmod_name}-%{sanitized_kernel_version}
Provides: kmod-%{kmod_name} = %{kmod_version}
%endif
Summary: %{kmod_name} kernel module
Version: %{kmod_version}
Release: %{_release}%{?dist}
Release: %{_release}
License: GPLv2
Group: System/Kernel
URL: http://scoutfs.org/
Requires: kernel-core-uname-r = %{kernel_version}
Requires: kernel-modules-uname-r = %{kernel_version}
%if 0%{?el7}
BuildRequires: %{kernel_module_package_buildreqs}

83
repo-fixup.sh Executable file
View File

@@ -0,0 +1,83 @@
#!/bin/bash
set -e
. /etc/os-release
MAJOR_VER="${VERSION_ID%%.*}"
if [[ "$VERSION_ID" == *.* ]]; then
MINOR_VER=".${VERSION_ID#*.}"
else
MINOR_VER=""
fi
DISTRO="${ID}"
IS_EDGE="${IS_EDGE:-0}"
if [ "${IS_EDGE}" = 0 ]; then
PUB_OR_VAULT=vault
else
PUB_OR_VAULT=pub
fi
VAULT_PREFIX=""
PUB_PREFIX=""
# - Accept ${SKIP_REPO_FIXUP} to take no action at all
# - Accept ${IS_EDGE} as 1/0 for whether we should lock to the *vaulted* repo vs. the current public one
if [ "${SKIP_REPO_FIXUP}" = 'true' ]; then
echo "Requested to take no action on repositories; exiting cleanly"
exit 0
fi
case ${DISTRO} in
rocky)
PUB_PREFIX="http://download.rockylinux.org/${PUB_OR_VAULT}/rocky"
VAULT_PREFIX="${PUB_PREFIX}"
RELEASE="${MAJOR_VER}${MINOR_VER}"
;;
centos)
PUB_PREFIX="http://mirror.centos.org/centos"
VAULT_PREFIX="http://vault.centos.org"
RELEASE="$(cat /etc/redhat-release |awk '{print $4}')"
;;
oracle)
echo "TODO"
;;
*)
echo "Unknown distro, unsure how to remap repos- exiting cleanly without doing anything"
exit 0
;;
esac
if [ "${IS_EDGE}" = 0 ]; then
BASE_URL="${VAULT_PREFIX}/${RELEASE}"
else
BASE_URL="${PUB_PREFIX}/${RELEASE}"
fi
for repo in "/etc/yum.repos.d/"*; do
sed -i -e "s/^mirrorlist/#mirrorlist/g" -e "s/^#baseurl/baseurl/g" \
-e "s|^metalink|#metalink|g" -e "s|https|http|g" "$repo"
if ! [[ "$repo" =~ .*epel.* ]]; then
sed -i -e "s|http.*releasever|${BASE_URL}|g" "$repo"
if [ "${IS_EDGE}" = 0 ]; then
sed -i -e "s|pub|vault|g" "$repo"
fi
else
sed -i -e "s|download.example|archives.fedoraproject.org|g" "$repo"
if [ "${IS_EDGE}" = 0 ]; then
sed -i -e "s|pub/epel/${MAJOR_VER}|pub/archive/epel/${VERSION_ID}|g" "$repo"
fi
fi
done
if [ "${MAJOR_VER}" -gt "7" ]; then
dnf clean metadata
dnf clean all
else
yum clean metadata
yum clean all
fi