Skip to content

Commit 7454dd5

Browse files
jdieterclaude
authored andcommitted
Consolidate spec version defines and prevent CLK kernel from hijacking boot default
Reduce duplicated version numbers in the spec to single sources of truth: - kernel_major_minor, kernel_patch, and buildid are the base defines - specversion, kversion, patchlevel, pkgrelease, specrelease, and tarfile_release are all derived from them - Remove specrpmversion (identical to specversion) - Add el_version for tarball naming Export GRUB_NON_STANDARD_KERNEL=true in the posttrans before calling kernel-install so that 20-grub.install respects DEFAULTKERNEL in /etc/sysconfig/kernel. When DEFAULTKERNEL=kernel-core, the CLK kernel will no longer take over as the boot default on upgrade. Update generate_tarball.sh to extract the base defines and compute derived values rather than reading the now-derived tarfile_release directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Dieter <jdieter@ciq.com>
1 parent 601aa13 commit 7454dd5

2 files changed

Lines changed: 80 additions & 68 deletions

File tree

ciq/SOURCES/generate_tarball.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ SOURCE_DIR="$DISTGIT_ROOT/SOURCES"
1111
SPEC_FILE="$DISTGIT_ROOT/SPECS/kernel-clk6.18.spec"
1212

1313
# Extract version information from spec file
14-
TARFILE_RELEASE=$(grep '^%define tarfile_release' "$SPEC_FILE" | awk '{print $3}')
15-
SPEC_VERSION=$(grep '^%define specversion' "$SPEC_FILE" | awk '{print $3}')
16-
17-
if [ -z "$TARFILE_RELEASE" ]; then
18-
echo "Error: Could not extract tarfile_release from $SPEC_FILE"
14+
KERNEL_MAJOR_MINOR=$(grep '^%define kernel_major_minor' "$SPEC_FILE" | awk '{print $3}')
15+
KERNEL_PATCH=$(grep '^%define kernel_patch' "$SPEC_FILE" | awk '{print $3}')
16+
BUILDID=$(grep '^%define buildid' "$SPEC_FILE" | awk '{print $3}')
17+
PKGRELEASE=$(grep '^%define pkgrelease' "$SPEC_FILE" | awk '{print $3}')
18+
EL_VERSION=$(grep '^%define el_version' "$SPEC_FILE" | awk '{print $3}')
19+
20+
if [ -z "$KERNEL_MAJOR_MINOR" ] || [ -z "$KERNEL_PATCH" ] || [ -z "$PKGRELEASE" ] || [ -z "$EL_VERSION" ]; then
21+
echo "Error: Could not extract kernel version from $SPEC_FILE"
1922
exit 1
2023
fi
2124

22-
if [ -z "$SPEC_VERSION" ]; then
23-
echo "Error: Could not extract specversion from $SPEC_FILE"
24-
exit 1
25-
fi
25+
# Resolve macros in pkgrelease
26+
PKGRELEASE=$(echo "$PKGRELEASE" | sed "s/%{?buildid}/${BUILDID}/")
27+
28+
SPEC_VERSION="${KERNEL_MAJOR_MINOR}.${KERNEL_PATCH}"
29+
TARFILE_RELEASE="${SPEC_VERSION}-${PKGRELEASE}.el${EL_VERSION}"
2630

2731
# Get current git tag and extract version
2832
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)

0 commit comments

Comments
 (0)