[OS-BUILD PATCHv3] redhat/Makefile: Fix dist-dump-variables target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: Fix dist-dump-variables target

The existing dist-dump-variables didn't output all the variables.  Fix the
target so that it outputs all the Makefile variables.

v2: dzickus pointed out that the self-tests use the dist-dump-variables
target.  Added additional code to fix the self-tests.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -162,10 +162,7 @@ dist-clean-rpmdirs:
 		rm -rf $$i; \
 	done;
 
-dist-clean-scripts:
-	@rm -f dist-dump-variables.sh
-
-dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs dist-clean-scripts
+dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs
 
 dist-stub-key:
 	@echo "Copying pre-generated keys";
@@ -437,12 +434,8 @@ dist-get-latest:
 dist-os-version:
 	@echo "OSVERSION: $(RHEL_MAJOR).$(RHEL_MINOR)"
 
-.EXPORT_ALL_VARIABLES:
-.PHONY: dist-dump-variables
 dist-dump-variables:
-	grep -h "^[ 	]*[a-zA-Z_][a-zA-Z_0-9]*[ 	]*[:?]*=" $(REDHAT)/Makefile.common $(REDHAT)/Makefile $(TOPDIR)/Makefile.rhelver | sed -e 's/[ 	]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/echo "\1=$$\1"/' | sort | uniq > dist-dump-variables.sh
-	chmod +x $(REDHAT)/dist-dump-variables.sh
-	@$(REDHAT)/dist-dump-variables.sh
+	@$(foreach V,$(sort $(.VARIABLES)), $(if $(filter-out environment% default automatic, $(origin $V)),$(info $V=$($V) )))
 
 dist-self-test:
 	@if test -x /usr/bin/bats; then \
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index blahblah..blahblah 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -23,6 +23,7 @@ ifneq ($(RPMKEXTRAVERSION),)
   PREBUILD:=0$(KEXTRAVERSION).
   UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
 else
+  KEXTRAVERSION:=
   ifeq ($(RPMKSUBLEVEL),0)
     MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)
     UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)
diff --git a/redhat/self-test/1005-dist-dump-variables.bats b/redhat/self-test/1005-dist-dump-variables.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/1005-dist-dump-variables.bats
+++ b/redhat/self-test/1005-dist-dump-variables.bats
@@ -5,25 +5,27 @@ function prologue()
     tag=$1
     ofile=$BATS_TMPDIR/$tag.out
     # Have to unset environment variables that may be inherited from supra-make:
-    grep "^[ 	]*[a-zA-Z_][a-zA-Z_0-9]*[ 	]*[:?]*=" \
-         $BATS_TEST_DIRNAME/../Makefile.common | \
-        sed -e 's/[ 	]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/unset \1/' | \
-        sort | uniq > $BATS_TMPDIR/unset-vars.sh
-    source $BATS_TMPDIR/unset-vars.sh
+    make dist-dump-variables | grep "=" | cut -d"=" -f1 | while read VAR; do unset "$VAR"; done
     GIT=$BATS_TEST_DIRNAME/egit.sh HEAD=$tag EGIT_OVERRIDE_DESCRIBE=$tag DIST=.fc33 make dist-dump-variables > $ofile
 }
 
 function checkversion()
 {
-    status=1
-    if grep -x "_TAG=$1" $ofile && \
-            grep -x "RPMKVERSION=$2" $ofile && grep -x "RPMKPATCHLEVEL=$3" $ofile && \
-            grep -x "RPMKSUBLEVEL=$4" $ofile && grep -x "RPMKEXTRAVERSION=$5" $ofile && \
-            grep -x "KEXTRAVERSION=$6" $ofile && \
-            grep -x "SNAPSHOT=$7" $ofile
-    then
-        status=$?
-    fi
+	echo "verifying _TAG=$1"
+	grep -E "^_TAG=$1" $ofile
+	echo "verifying RPMKVERSION=$2"
+	grep -E "^RPMKVERSION=$2" $ofile
+	echo "verifying RPMPATCHLEVEL=$3"
+	grep -E "^RPMKPATCHLEVEL=$3" $ofile
+	echo "verifying RPMSUBLEVEL=$4"
+	grep -E "^RPMKSUBLEVEL=$4" $ofile
+	echo "verifying RPMEXTRAVERSION=$5"
+	grep -E "^RPMKEXTRAVERSION=$5" $ofile
+	echo "verifying KEXTRAVERSION=$6"
+	grep -E "^KEXTRAVERSION=$6" $ofile
+	echo "verifying SNAPSHOT=$6"
+	grep -E "^SNAPSHOT=$7" $ofile
+	status=0
 }
 
 @test "dist-dump-variables v5.8" {

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1625
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux