From: Prarit Bhargava <pra...@redhat.com>

redhat/genspec.sh: Rework RPMVERSION variable

The redhat/genspec.sh file contains $RPMVERSION and $RPM_VERSION variables
which don't match the Makefile variables.  Create a new KVERSION variable
and replace $RPMVERSION with KVERSION, and $RPM_VERSION with $RPMVERSION.

Rework the RPMVERSION variable in redhat/genspec.sh and the Makfile.

Signed-off-by: Prarit Bhargava <pra...@redhat.com>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -13,6 +13,7 @@ RPMKVERSION:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne 
'/^VERSION\ =\ /{s//
 RPMKPATCHLEVEL:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne '/^PATCHLEVEL\ 
=\ /{s///;p;q}')
 RPMKSUBLEVEL:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne '/^SUBLEVEL\ =\ 
/{s///;p;q}')
 RPMKEXTRAVERSION:=$(shell $(GIT) show $(HEAD):Makefile | sed -ne 
'/^EXTRAVERSION\ =\ /{s///;p;q}')
+KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
 GITID:= $(shell $(GIT) log --max-count=1 --pretty=format:%H $(HEAD))
 # marker is git tag which we base off of for exporting patches
 # Make sure marker uses RPMKPATCHLEVEL and RPMKEXTRAVERSION from the kernel
@@ -26,7 +27,7 @@ else
   KEXTRAVERSION:=
   ifeq ($(RPMKSUBLEVEL),0)
     MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)
-    UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)
+    UPSTREAM_TARBALL_NAME:=$$(RPMKVERSION).$(RPMKPATCHLEVEL)
   else
     MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
     UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
@@ -97,7 +98,6 @@ ifeq ($(SNAPSHOT),1)
 endif
 
 KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
-RPMVERSION:=$(KVERSION)
 
 ifndef BUILD
   BUILD:=$(RHEL_RELEASE)
@@ -122,6 +122,7 @@ else
 endif
 
 PKGRELEASE:=$(PREBUILD)$(BUILD)$(BUILDID)
+RPMVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL)-$(PKGRELEASE)
 SPECRELEASE:=$(PREBUILD)$(BUILD)%{?buildid}%{?dist}
 
 ifeq ("$(DISTRO)", "fedora")
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 LAST_MARKER=$(cat $REDHAT/marker)
-RPMVERSION=${RPMKVERSION}.${RPMKPATCHLEVEL}
 clogf="$SOURCES/changelog"
 # hide [redhat] entries from changelog
 HIDE_REDHAT=1;
@@ -10,11 +9,10 @@ HIDE_UNSUPPORTED_ARCH=1;
 # override LC_TIME to avoid date conflicts when building the srpm
 LC_TIME=
 # STAMP=$(echo $MARKER | cut -f 1 -d '-' | sed -e "s/v//"); # unused
-RPM_VERSION="$RPMVERSION-$PKGRELEASE";
 
 echo > "$clogf"
 
-lasttag=$(git rev-list --first-parent --grep="^\[redhat\] 
kernel-${RPMVERSION}" --max-count=1 HEAD)
+lasttag=$(git rev-list --first-parent --grep="^\[redhat\] 
kernel-${RPMKVERSION}.${RPMKPATCHLEVEL}" --max-count=1 HEAD)
 # if we didn't find the proper tag, assume this is the first release
 if [[ -z $lasttag ]]; then
     if [[ -z ${MARKER//[0-9a-f]/} ]]; then
@@ -33,7 +31,7 @@ UPSTREAM="$(git rev-parse -q --verify origin/$UPSTREAM_BRANCH 
|| \
 git log --topo-order --reverse --no-merges -z --format="- %s (%an)%n%b" \
        ^${UPSTREAM} "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> 
"$clogf"
 
-grep -v "tagging $RPM_VERSION" "$clogf" > "$clogf.stripped"
+grep -v "tagging $RPMVERSION" "$clogf" > "$clogf.stripped"
 cp "$clogf.stripped" "$clogf"
 
 if [ "$HIDE_REDHAT" = "1" ]; then
@@ -75,7 +73,7 @@ LENGTH=$(wc -l "$clogf" | awk '{print $1}')
 #left by the 'print version\n' logic above
 cname="$(git var GIT_COMMITTER_IDENT |sed 's/>.*/>/')"
 cdate="$(LC_ALL=C date +"%a %b %d %Y")"
-cversion="[$RPM_VERSION]";
+cversion="[$RPMVERSION]";
 tac "$clogf" | sed "1{/^$/d; /^- /i\
 * $cdate $cname $cversion
        }" > "$clogf.rev"
@@ -153,10 +151,10 @@ if [ "$SINGLE_TARBALL" = 0 ]; then
        # May need to preserve word splitting in EXCLUDE_FILES
        # shellcheck disable=SC2086
        git diff -p --no-renames --stat "$MARKER"..  $EXCLUDE_FILES \
-               > "$SOURCES"/patch-"$RPMVERSION"-redhat.patch
+               > 
"$SOURCES"/patch-"${RPMKVERSION}.${RPMKPATCHLEVEL}"-redhat.patch
 else
        # Need an empty file for dist-git compatibility
-       touch "$SOURCES"/patch-"$RPMVERSION"-redhat.patch
+       touch "$SOURCES"/patch-"${RPMKVERSION}.${RPMKPATCHLEVEL}"-redhat.patch
 fi
 
 # We depend on work splitting of BUILDOPTS

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

Reply via email to