Skip to content

Commit 9b0a9b4

Browse files
authored
CI: Add optional patch level, fix hostname on F42
In the past there have been times when we need to generate new RPMs for an existing ZFS release. Typically this happens when a new RHEL version comes out and the kernel symbols no longer match. To get users to auto-update we just bump the patch number. For example, we had to create zfs-2.1.13-1 for EL8.8 and zfs-2.1.13-2 for EL8.9. This commit adds an optional patch level text box to the github package builder runner. In addition, this commit also uses `hostnamectl` instead of `hostname` for F42+ compatibility, if available. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #17638
1 parent 5061f95 commit 9b0a9b4

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

.github/workflows/scripts/qemu-4-build-vm.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
#
66
# Usage:
77
#
8-
# qemu-4-build-vm.sh OS [--enable-debug][--dkms][--poweroff]
9-
# [--release][--repo][--tarball]
8+
# qemu-4-build-vm.sh OS [--enable-debug][--dkms][--patch-level NUM]
9+
# [--poweroff][--release][--repo][--tarball]
1010
#
1111
# OS: OS name like 'fedora41'
1212
# --enable-debug: Build RPMs with '--enable-debug' (for testing)
1313
# --dkms: Build DKMS RPMs as well
14+
# --patch-level NUM: Use a custom patch level number for packages.
1415
# --poweroff: Power-off the VM after building
1516
# --release Build zfs-release*.rpm as well
1617
# --repo After building everything, copy RPMs into /tmp/repo
@@ -21,6 +22,7 @@
2122

2223
ENABLE_DEBUG=""
2324
DKMS=""
25+
PATCH_LEVEL=""
2426
POWEROFF=""
2527
RELEASE=""
2628
REPO=""
@@ -35,6 +37,11 @@ while [[ $# -gt 0 ]]; do
3537
DKMS=1
3638
shift
3739
;;
40+
--patch-level)
41+
PATCH_LEVEL=$2
42+
shift
43+
shift
44+
;;
3845
--poweroff)
3946
POWEROFF=1
4047
shift
@@ -215,6 +222,10 @@ function rpm_build_and_install() {
215222
run ./autogen.sh
216223
echo "##[endgroup]"
217224

225+
if [ -n "$PATCH_LEVEL" ] ; then
226+
sed -i -E 's/(Release:\s+)1/\1'$PATCH_LEVEL'/g' META
227+
fi
228+
218229
echo "##[group]Configure"
219230
run ./configure --enable-debuginfo $extra
220231
echo "##[endgroup]"
@@ -328,7 +339,13 @@ fi
328339
# almalinux9.5
329340
# fedora42
330341
source /etc/os-release
331-
sudo hostname "$ID$VERSION_ID"
342+
if which hostnamectl &> /dev/null ; then
343+
# Fedora 42+ use hostnamectl
344+
sudo hostnamectl set-hostname "$ID$VERSION_ID"
345+
sudo hostnamectl set-hostname --pretty "$ID$VERSION_ID"
346+
else
347+
sudo hostname "$ID$VERSION_ID"
348+
fi
332349

333350
# save some sysinfo
334351
uname -a > /var/tmp/uname.txt

.github/workflows/zfs-qemu-packages.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
options:
3333
- "Build RPMs"
3434
- "Test repo"
35+
patch_level:
36+
type: string
37+
required: false
38+
default: ""
39+
description: "(optional) patch level number"
3540
repo_url:
3641
type: string
3742
required: false
@@ -78,7 +83,13 @@ jobs:
7883
mkdir -p /tmp/repo
7984
ssh zfs@vm0 '$HOME/zfs/.github/workflows/scripts/qemu-test-repo-vm.sh' ${{ github.event.inputs.repo_url }}
8085
else
81-
.github/workflows/scripts/qemu-4-build.sh --repo --release --dkms --tarball ${{ matrix.os }}
86+
EXTRA=""
87+
if [ -n "${{ github.event.inputs.patch_level }}" ] ; then
88+
EXTRA="--patch-level ${{ github.event.inputs.patch_level }}"
89+
fi
90+
91+
.github/workflows/scripts/qemu-4-build.sh $EXTRA \
92+
--repo --release --dkms --tarball ${{ matrix.os }}
8293
fi
8394
8495
- name: Prepare artifacts

0 commit comments

Comments
 (0)