[OS-BUILD PATCHv2 9/17] redhat/kernel.spec.template: Move genspec variables into one section

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/kernel.spec.template: Move genspec variables into one section

Move the genspec variables into one section. This re-introduces the
SPECKVERSION variable into the specfile.

Additional fix: add a tarfile_release variable that maps to
SPECTARFILE_RELEASE.

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

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,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora %%SPECINCLUDE_FEDORA_FILES%%
-# Include RHEL files
-%global include_rhel %%SPECINCLUDE_RHEL_FILES%%
-# Provide Patchlist.changelog file
-%global patchlist_changelog %%SPECPATCHLIST_CHANGELOG%%
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel %%SPECRELEASED_KERNEL%%
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled %%SPECDEBUG_BUILDS_ENABLED%%
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%%SPECBUILDID%%
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora %%SPECINCLUDE_FEDORA_FILES%%
+# Include RHEL files
+%global include_rhel %%SPECINCLUDE_RHEL_FILES%%
+# Provide Patchlist.changelog file
+%global patchlist_changelog %%SPECPATCHLIST_CHANGELOG%%
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel %%SPECRELEASED_KERNEL%%
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled %%SPECDEBUG_BUILDS_ENABLED%%
+%%SPECBUILDID%%
 %define specversion %%SPECVERSION%%
 %define patchversion %%SPECKVERSION%%.%%SPECKPATCHLEVEL%%
 %define pkgrelease %%SPECBUILD%%
-
+%define kversion %%SPECKVERSION%%
+%define tarfile_release %%SPECTARFILE_RELEASE%%
 # This is needed to do merge window version magic
 %define patchlevel %%SPECKPATCHLEVEL%%
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease %%SPECRELEASE%%
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-%%SPECTARFILE_RELEASE%%.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-%%SPECKVERSION%%." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-%%SPECTARFILE_RELEASE%% -c
-mv linux-%%SPECTARFILE_RELEASE%% linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.el7.spec b/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
+++ b/redhat/self-test/data/centos-2585cf9dfaad.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.6.test -c
-mv linux-5.16.0-0.rc5.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec b/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
+++ b/redhat/self-test/data/centos-2585cf9dfaad.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.6.test -c
-mv linux-5.16.0-0.rc5.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.el7.spec b/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
+++ b/redhat/self-test/data/centos-78e36f3b0dae.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.17.0
 %define patchversion 5.17
 %define pkgrelease 0.rc0.78e36f3b0dae586.6.test
-
+%define kversion 5
+%define tarfile_release 5.17.0-0.rc0.78e36f3b0dae586.6.test
 # This is needed to do merge window version magic
 %define patchlevel 17
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc0.78e36f3b0dae586.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.17.0-0.rc0.78e36f3b0dae586.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.17.0-0.rc0.78e36f3b0dae586.6.test -c
-mv linux-5.17.0-0.rc0.78e36f3b0dae586.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec b/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
+++ b/redhat/self-test/data/centos-78e36f3b0dae.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.17.0
 %define patchversion 5.17
 %define pkgrelease 0.rc0.78e36f3b0dae586.6.test
-
+%define kversion 5
+%define tarfile_release 5.17.0-0.rc0.78e36f3b0dae586.6.test
 # This is needed to do merge window version magic
 %define patchlevel 17
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc0.78e36f3b0dae586.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.17.0-0.rc0.78e36f3b0dae586.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.17.0-0.rc0.78e36f3b0dae586.6.test -c
-mv linux-5.17.0-0.rc0.78e36f3b0dae586.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-df0cc57e057f.el7.spec b/redhat/self-test/data/centos-df0cc57e057f.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-df0cc57e057f.el7.spec
+++ b/redhat/self-test/data/centos-df0cc57e057f.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-6.test -c
-mv linux-5.16.0-6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-df0cc57e057f.fc25.spec b/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
+++ b/redhat/self-test/data/centos-df0cc57e057f.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-6.test -c
-mv linux-5.16.0-6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.el7.spec b/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
+++ b/redhat/self-test/data/centos-fce15c45d3fb.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.fce15c45d3fbd9f.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.fce15c45d3fbd9f.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.fce15c45d3fbd9f.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.fce15c45d3fbd9f.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.fce15c45d3fbd9f.6.test -c
-mv linux-5.16.0-0.rc5.fce15c45d3fbd9f.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec b/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
+++ b/redhat/self-test/data/centos-fce15c45d3fb.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.fce15c45d3fbd9f.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.fce15c45d3fbd9f.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.fce15c45d3fbd9f.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.fce15c45d3fbd9f.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.fce15c45d3fbd9f.6.test -c
-mv linux-5.16.0-0.rc5.fce15c45d3fbd9f.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-2585cf9dfaad.el7.spec b/redhat/self-test/data/fedora-2585cf9dfaad.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-2585cf9dfaad.el7.spec
+++ b/redhat/self-test/data/fedora-2585cf9dfaad.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-rc5
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-rc5.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-rc5 -c
-mv linux-5.16-rc5 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-2585cf9dfaad.fc25.spec b/redhat/self-test/data/fedora-2585cf9dfaad.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-2585cf9dfaad.fc25.spec
+++ b/redhat/self-test/data/fedora-2585cf9dfaad.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-rc5
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-rc5.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-rc5 -c
-mv linux-5.16-rc5 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-78e36f3b0dae.el7.spec b/redhat/self-test/data/fedora-78e36f3b0dae.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-78e36f3b0dae.el7.spec
+++ b/redhat/self-test/data/fedora-78e36f3b0dae.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.17.0
 %define patchversion 5.17
 %define pkgrelease 0.rc0.78e36f3b0dae586.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-11523-g78e36f3b0dae586
 # This is needed to do merge window version magic
 %define patchlevel 17
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc0.78e36f3b0dae586.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-11523-g78e36f3b0dae586.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-11523-g78e36f3b0dae586 -c
-mv linux-5.16-11523-g78e36f3b0dae586 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-78e36f3b0dae.fc25.spec b/redhat/self-test/data/fedora-78e36f3b0dae.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-78e36f3b0dae.fc25.spec
+++ b/redhat/self-test/data/fedora-78e36f3b0dae.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.17.0
 %define patchversion 5.17
 %define pkgrelease 0.rc0.78e36f3b0dae586.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-11523-g78e36f3b0dae586
 # This is needed to do merge window version magic
 %define patchlevel 17
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc0.78e36f3b0dae586.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-11523-g78e36f3b0dae586.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-11523-g78e36f3b0dae586 -c
-mv linux-5.16-11523-g78e36f3b0dae586 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-df0cc57e057f.el7.spec b/redhat/self-test/data/fedora-df0cc57e057f.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-df0cc57e057f.el7.spec
+++ b/redhat/self-test/data/fedora-df0cc57e057f.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 6.test
-
+%define kversion 5
+%define tarfile_release 5.16
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16 -c
-mv linux-5.16 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-df0cc57e057f.fc25.spec b/redhat/self-test/data/fedora-df0cc57e057f.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-df0cc57e057f.fc25.spec
+++ b/redhat/self-test/data/fedora-df0cc57e057f.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 6.test
-
+%define kversion 5
+%define tarfile_release 5.16
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16 -c
-mv linux-5.16 linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-fce15c45d3fb.el7.spec b/redhat/self-test/data/fedora-fce15c45d3fb.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-fce15c45d3fb.el7.spec
+++ b/redhat/self-test/data/fedora-fce15c45d3fb.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.fce15c45d3fbd9f.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-rc5-1-gfce15c45d3fbd9f
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.fce15c45d3fbd9f.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-rc5-1-gfce15c45d3fbd9f.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-rc5-1-gfce15c45d3fbd9f -c
-mv linux-5.16-rc5-1-gfce15c45d3fbd9f linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/fedora-fce15c45d3fb.fc25.spec b/redhat/self-test/data/fedora-fce15c45d3fb.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/fedora-fce15c45d3fb.fc25.spec
+++ b/redhat/self-test/data/fedora-fce15c45d3fb.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.fce15c45d3fbd9f.6.test
-
+%define kversion 5
+%define tarfile_release 5.16-rc5-1-gfce15c45d3fbd9f
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.fce15c45d3fbd9f.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16-rc5-1-gfce15c45d3fbd9f.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16-rc5-1-gfce15c45d3fbd9f -c
-mv linux-5.16-rc5-1-gfce15c45d3fbd9f linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/rhel-2585cf9dfaad.el7.spec b/redhat/self-test/data/rhel-2585cf9dfaad.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/rhel-2585cf9dfaad.el7.spec
+++ b/redhat/self-test/data/rhel-2585cf9dfaad.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.6.test -c
-mv linux-5.16.0-0.rc5.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/rhel-2585cf9dfaad.fc25.spec b/redhat/self-test/data/rhel-2585cf9dfaad.fc25.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/rhel-2585cf9dfaad.fc25.spec
+++ b/redhat/self-test/data/rhel-2585cf9dfaad.fc25.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 1
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 1
+%define buildid .test
 %define specversion 5.16.0
 %define patchversion 5.16
 %define pkgrelease 0.rc5.6.test
-
+%define kversion 5
+%define tarfile_release 5.16.0-0.rc5.6.test
 # This is needed to do merge window version magic
 %define patchlevel 16
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc5.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.16.0-0.rc5.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.16.0-0.rc5.6.test -c
-mv linux-5.16.0-0.rc5.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
diff --git a/redhat/self-test/data/rhel-78e36f3b0dae.el7.spec b/redhat/self-test/data/rhel-78e36f3b0dae.el7.spec
index blahblah..blahblah 100755
--- a/redhat/self-test/data/rhel-78e36f3b0dae.el7.spec
+++ b/redhat/self-test/data/rhel-78e36f3b0dae.el7.spec
@@ -3,13 +3,6 @@
 # environment changes that affect %%install need to go
 # here before the %%install macro is pre-built.
 
-# Include Fedora files
-%global include_fedora 1
-# Include RHEL files
-%global include_rhel 1
-# Provide Patchlist.changelog file
-%global patchlist_changelog 1
-
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
@@ -72,21 +65,6 @@
 %endif
 
 Summary: The Linux kernel
-
-# Set released_kernel to 1 when the upstream source tarball contains a
-#  kernel release. (This includes prepatch or "rc" releases.)
-# Set released_kernel to 0 when the upstream source tarball contains an
-#  unreleased kernel development snapshot.
-%global released_kernel 0
-
-# Set debugbuildsenabled to 1 to build separate base and debug kernels
-#  (on supported architectures). The kernel-debug-* subpackages will
-#  contain the debug kernel.
-# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
-#  to build the base kernel using the debug configuration. (Specifying
-#  the --with-release option overrides this setting.)
-%define debugbuildsenabled 0
-
 %if 0%{?fedora}
 %define secure_boot_arch x86_64
 %else
@@ -115,25 +93,49 @@ Summary: The Linux kernel
 # for parallel xz processes, replace with 1 to go back to single process
 %endif
 
-%define buildid .test
-
-
 %if 0%{?fedora}
 %define primary_target fedora
 %else
 %define primary_target rhel
 %endif
 
+#
+# genspec.sh variables
+#
+
+# Include Fedora files
+%global include_fedora 1
+# Include RHEL files
+%global include_rhel 1
+# Provide Patchlist.changelog file
+%global patchlist_changelog 1
+# Set released_kernel to 1 when the upstream source tarball contains a
+#  kernel release. (This includes prepatch or "rc" releases.)
+# Set released_kernel to 0 when the upstream source tarball contains an
+#  unreleased kernel development snapshot.
+%global released_kernel 0
+# Set debugbuildsenabled to 1 to build separate base and debug kernels
+#  (on supported architectures). The kernel-debug-* subpackages will
+#  contain the debug kernel.
+# Set debugbuildsenabled to 0 to not build a separate debug kernel, but
+#  to build the base kernel using the debug configuration. (Specifying
+#  the --with-release option overrides this setting.)
+%define debugbuildsenabled 0
+%define buildid .test
 %define specversion 5.17.0
 %define patchversion 5.17
 %define pkgrelease 0.rc0.78e36f3b0dae586.6.test
-
+%define kversion 5
+%define tarfile_release 5.17.0-0.rc0.78e36f3b0dae586.6.test
 # This is needed to do merge window version magic
 %define patchlevel 17
-
 # allow pkg_release to have configurable %%{?dist} tag
 %define specrelease 0.rc0.78e36f3b0dae586.6%{?buildid}%{?dist}
 
+#
+# End of genspec.sh variables
+#
+
 %define pkg_release %{specrelease}
 
 # libexec dir is not used by the linker, so the shared object there
@@ -687,7 +689,7 @@ BuildRequires: lld
 # exact git commit you can run
 #
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
-Source0: linux-5.17.0-0.rc0.78e36f3b0dae586.6.test.tar.xz
+Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
 
@@ -1352,7 +1354,7 @@ ApplyPatch()
     exit 1
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; then
-    if [ "${patch:0:8}" != "patch-5." ] ; then
+    if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
       exit 1
     fi
@@ -1379,8 +1381,8 @@ ApplyOptionalPatch()
   fi
 }
 
-%setup -q -n kernel-5.17.0-0.rc0.78e36f3b0dae586.6.test -c
-mv linux-5.17.0-0.rc0.78e36f3b0dae586.6.test linux-%{KVERREL}
+%setup -q -n kernel-%{tarfile_release} -c
+mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1757
_______________________________________________
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