From: Don Zickus <[email protected]>

[redhat] Explicitly set srpm requirements

It isn't clear what packages are necessary to be installed to generate
the srpm for the kernel.  Use another spec macro to call out the exact
packages needed. This allows a makefile target to be used to verify the
right packages have been installed.

Signed-off-by: Don Zickus <[email protected]>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -84,6 +84,7 @@ TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
 SPECCHANGELOG:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(RHEL_MINOR)
 CHANGELOG_PREV:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(shell expr 
$(RHEL_MINOR) - 1)
 ARCH_LIST=aarch64 ppc64le s390x x86_64
+SPECSRPMBUILDREQS := git-core make gcc flex bison bzip2
 
 ifndef DISTRO
   ifneq ($(findstring .fc,$(DIST)),)
@@ -391,7 +392,7 @@ rh-configs: dist-rhel-configs
 dist-configs-check: dist-configs-prep
        +cd $(REDHAT)/configs; ./process_configs.sh 
$(PROCESS_CONFIGS_CHECK_OPTS) "" ""
 
-dist-configs-prep: dist-clean-configs dist-buildreq-check
+dist-configs-prep: dist-clean-configs dist-srpmbuildreq-check
        +cd $(REDHAT)/configs; ./build_configs.sh "partial" "snip"
        +cd $(REDHAT)/configs; ./build_configs.sh "$(PACKAGE_NAME)" "$(FLAVOR)"
 
@@ -469,6 +470,17 @@ dist-git-version-check:
                exit 1; \
        fi
 
+dist-srpmbuildreq-check: setup-source
+       @PKGLIST="rpm-build $(SPECSRPMBUILDREQS)"; \
+       MISSING=""; \
+       for pkg in $$PKGLIST; do \
+               rpm -q --whatprovides $$pkg >/dev/null || MISSING="$$MISSING 
$$pkg"; \
+       done; \
+       if [ -n "$$MISSING" ]; then \
+               echo "Error: please 'dnf install $$MISSING'"; \
+               exit 1; \
+       fi
+
 dist-buildreq-check: setup-source
        @PKGLIST="rpm-build $$(rpmspec -q --buildrequires 
$(SOURCES)/$(SPECFILE) | cut -d ' ' -f 1)"; \
        MISSING=""; \
@@ -812,6 +824,7 @@ dist-full-help:
 
        @echo  ''
        @echo  'Misc targets:'
+       @echo  '  dist-srpmbuildreq-check - Checks for presence of packages 
required for the srpm'
        @echo  '  dist-buildreq-check - Checks for presence of packages 
required for build'
        @echo  '  dist-get-latest - Returns the latest "known good" kernel from 
brew. This'
        @echo  '                    should not be confused with the latest 
top-of-tree'
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -70,6 +70,7 @@ test -f "$SOURCES/$SPECFILE" &&
        s/%%SPECINCLUDE_RHEL_FILES%%/$SPECINCLUDE_RHEL_FILES/
        s/%%SPECPATCHLIST_CHANGELOG%%/$SPECPATCHLIST_CHANGELOG/
        s/%%SPECVERSION%%/$SPECVERSION/
+       s/%%SPECSRPMBUILDREQS%%/$SPECSRPMBUILDREQS/
        s/%%SPECTARFILE_RELEASE%%/$SPECTARFILE_RELEASE/" "$SOURCES/$SPECFILE"
 test -n "$RHSELFTESTDATA" && test -f "$SOURCES/$SPECFILE" && sed -i -e "
        /%%SPECCHANGELOG%%/r $SOURCES/$SPECCHANGELOG
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
@@ -570,9 +570,10 @@ Requires: kernel-modules-uname-r = %{KVERREL}
 #
 # List the packages used during the kernel build
 #
-BuildRequires: kmod, patch, bash, coreutils, tar, git-core, which
-BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, 
perl-devel, perl-generators, make, diffutils, gawk
-BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex, gcc-c++
+BuildRequires: %%SPECSRPMBUILDREQS%%
+BuildRequires: kmod, patch, bash, coreutils, tar, which
+BuildRequires: xz, findutils, gzip, m4, perl-interpreter, perl-Carp, 
perl-devel, perl-generators, diffutils, gawk
+BuildRequires: binutils, redhat-rpm-config, hmaccalc, gcc-c++
 BuildRequires: net-tools, hostname, bc, elfutils-devel
 BuildRequires: dwarves
 BuildRequires: python3-devel

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1786
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to