From: Prarit Bhargava <prarit(a)redhat.com>
redhat/kernel.spec.template: Add include_fedora and include_rhel variables
The centos-stream-9 (c9s) [1] repository contains files for both RHEL and
Fedora configs. The Fedora configs will never be updated, and will
quickly be out-of-date with respect to upstream. Having the files in
place causes confusion having the Fedora files causes for engineers and
contributors.
Add include_fedora and include_rhel variables. These can be set in
Makefile.variables to include or exclude RHEL or Fedora-specific files.
These are enabled for ARK, and include_fedora can be disabled for c9s.
[1]
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -236,7 +236,7 @@ setup-source: dist-git-version-check dist-clean-sources
cp $(REDHAT)/$(CHANGELOG_PREV) $(REDHAT)/$(CHANGELOG); \
fi
@cp $(REDHAT)/$(CHANGELOG) $(SOURCES)/$(CHANGELOG)
- @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG)
$(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD)
$(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat
$(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH)
$(BUILDID)
+ @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG)
$(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD)
$(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat
$(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH)
$(BUILDID) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES)
@cp $(SOURCES)/$(SPECFILE) $(SOURCES)/../SPECS/
generate-testpatch-tmp:
diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables
index blahblah..blahblah 100644
--- a/redhat/Makefile.variables
+++ b/redhat/Makefile.variables
@@ -34,3 +34,10 @@ RELEASED_KERNEL:=0
# multiple updates and builds without bumping the base version, and no
# when you expect every build to use a different base kernel version.
BUMP_RELEASE:=yes
+
+# INCLUDE_*_FILES determines whether or not the specific OS flavor files will
+# be included as part of the source RPM. Downstream projects, such as
+# centos-stream or RHEL, can disable file inclusion by setting these values
+# to '0'.
+INCLUDE_FEDORA_FILES:=1
+INCLUDE_RHEL_FILES:=1
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -23,6 +23,8 @@ TARFILE_RELEASE=${16}
SNAPSHOT=${17}
UPSTREAM_BRANCH=${18}
BUILDID=${19}
+INCLUDE_FEDORA_FILES=${20}
+INCLUDE_RHEL_FILES=${21}
RPMVERSION=${KVERSION}.${KPATCHLEVEL}
clogf="$SOURCES/changelog"
# hide [redhat] entries from changelog
@@ -137,6 +139,8 @@ test -n "$SPECFILE" &&
s/%%DISTRO_BUILD%%/$DISTRO_BUILD/
s/%%RELEASED_KERNEL%%/$RELEASED_KERNEL/
s/%%DEBUG_BUILDS_ENABLED%%/$DEBUG_BUILDS_ENABLED/
+ s/%%INCLUDE_FEDORA_FILES%%/$INCLUDE_FEDORA_FILES/
+ s/%%INCLUDE_RHEL_FILES%%/$INCLUDE_RHEL_FILES/
s/%%TARBALL_VERSION%%/$TARFILE_RELEASE/" "$SPECFILE"
echo "MARKER is $MARKER"
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -3,6 +3,11 @@
# environment changes that affect %%install need to go
# here before the %%install macro is pre-built.
+# Include Fedora files
+%global include_fedora %%INCLUDE_FEDORA_FILES%%
+# Include RHEL files
+%global include_rhel %%INCLUDE_RHEL_FILES%%
+
# Disable LTO in userspace packages.
%global _lto_cflags %{nil}
@@ -685,8 +690,12 @@ Source1: Makefile.rhelver
%define signing_key_filename kernel-signing-s390.cer
%endif
+%if 0%{?include_rhel}
Source8: x509.genkey.rhel
+%endif
+%if 0%{?include_fedora}
Source9: x509.genkey.fedora
+%endif
%if %{?released_kernel}
@@ -732,12 +741,17 @@ Source13: redhatsecureboot003.cer
# released_kernel
%endif
+%if 0%{?include_rhel}
Source22: mod-extra.list.rhel
+%endif
+%if 0%{?include_fedora}
Source16: mod-extra.list.fedora
+%endif
Source17: mod-denylist.sh
Source18: mod-sign.sh
Source79: parallel_xz.sh
+%if 0%{?include_fedora}
Source80: filter-x86_64.sh.fedora
Source81: filter-armv7hl.sh.fedora
Source82: filter-i686.sh.fedora
@@ -745,7 +759,9 @@ Source83: filter-aarch64.sh.fedora
Source86: filter-ppc64le.sh.fedora
Source87: filter-s390x.sh.fedora
Source89: filter-modules.sh.fedora
+%endif
+%if 0%{?include_rhel}
Source90: filter-x86_64.sh.rhel
Source91: filter-armv7hl.sh.rhel
Source92: filter-i686.sh.rhel
@@ -753,8 +769,10 @@ Source93: filter-aarch64.sh.rhel
Source96: filter-ppc64le.sh.rhel
Source97: filter-s390x.sh.rhel
Source99: filter-modules.sh.rhel
+%endif
%define modsign_cmd %{SOURCE18}
+%if 0%{?include_rhel}
Source20: kernel-aarch64-rhel.config
Source21: kernel-aarch64-debug-rhel.config
Source30: kernel-ppc64le-rhel.config
@@ -764,7 +782,9 @@ Source33: kernel-s390x-debug-rhel.config
Source34: kernel-s390x-zfcpdump-rhel.config
Source35: kernel-x86_64-rhel.config
Source36: kernel-x86_64-debug-rhel.config
+%endif
+%if 0%{?include_fedora}
Source37: kernel-aarch64-fedora.config
Source38: kernel-aarch64-debug-fedora.config
Source39: kernel-armv7hl-fedora.config
@@ -779,7 +799,7 @@ Source47: kernel-s390x-fedora.config
Source48: kernel-s390x-debug-fedora.config
Source49: kernel-x86_64-fedora.config
Source50: kernel-x86_64-debug-fedora.config
-
+%endif
Source51: generate_all_configs.sh
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413