From: Herton R. Krzesinski <herton(a)redhat.com>
redhat: make Patchlist.changelog generation conditional
Right now Patchlist.changelog is always generated and contains an
URL to the kernel-ark repository. However, when kernel-ark is forked
into CentOS or any other downstream repo, this file will continue to
be generated and will contains the kernel-ark repo URLs even if we
are already in another repository. Fix this by allowing setting other
URL value in the Makefile.variables file, or if for any reason we
don't want the Patchlist.changelog file, just set the PATCHLIST_URL
value to "none".
Signed-off-by: Herton R. Krzesinski <herton(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -236,7 +236,11 @@ setup-source: dist-git-version-check dist-clean-sources
cp $(REDHAT)/$(CHANGELOG_PREV) $(REDHAT)/$(CHANGELOG); \
fi
@cp $(REDHAT)/$(CHANGELOG) $(SOURCES)/$(CHANGELOG)
- @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG)
$(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD)
$(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat
$(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH)
$(BUILDID) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES)
+ @if [ -z "$(PATCHLIST_URL)" ]; then \
+ echo "Error: PATCHLIST_URL must be set (to 'none' or any URL)"; \
+ exit 1; \
+ fi
+ @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG)
$(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD)
$(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat
$(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH)
$(BUILDID) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES) $(PATCHLIST_URL)
@cp $(SOURCES)/$(SPECFILE) $(SOURCES)/../SPECS/
generate-testpatch-tmp:
diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables
index blahblah..blahblah 100644
--- a/redhat/Makefile.variables
+++ b/redhat/Makefile.variables
@@ -45,3 +45,9 @@ BUMP_RELEASE:=yes
# to '0'.
INCLUDE_FEDORA_FILES:=1
INCLUDE_RHEL_FILES:=1
+
+# In case PATCHLIST_URL is not set to "none", Patchlist.changelog is added to
+# the kernel src.rpm, which will contain shas and commits not upstream. The
+# value of PATCHLIST_URL in this case should point to the git repository where
+# the commits are located, and will be added as a prefix to the shas listed.
+PATCHLIST_URL ?= "https://gitlab.com/cki-project/kernel-ark/-/commit"
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -25,6 +25,7 @@ UPSTREAM_BRANCH=${18}
BUILDID=${19}
INCLUDE_FEDORA_FILES=${20}
INCLUDE_RHEL_FILES=${21}
+PATCHLIST_URL=${22}
RPMVERSION=${KVERSION}.${KPATCHLEVEL}
clogf="$SOURCES/changelog"
# hide [redhat] entries from changelog
@@ -126,6 +127,24 @@ else
BUILDID_DEFINE="# define buildid .local"
fi
+# If PATCHLIST_URL is not set to "none", generate Patchlist.changelog file
that
+# holds the shas and commits not included upstream and git commit url.
+PATCHLIST_CHANGELOG=0
+if [ "$PATCHLIST_URL" != "none" ]; then
+ # sed convert
+ # <sha> <description>
+ # to
+ # <ark_commit_url>/<sha>
+ # <sha> <description>
+ #
+ # May need to preserve word splitting in EXCLUDE_FILES
+ # shellcheck disable=SC2086
+ git log --no-merges --pretty=oneline --no-decorate ${UPSTREAM}.. $EXCLUDE_FILES | \
+ sed "s!^\([^ ]*\)!$PATCHLIST_URL/\1\n &!; s!\$!\n!" \
+ > "$SOURCES"/Patchlist.changelog
+ PATCHLIST_CHANGELOG=1
+fi
+
test -n "$SPECFILE" &&
sed -i -e "
/%%CHANGELOG%%/r $CHANGELOG
@@ -141,6 +160,7 @@ test -n "$SPECFILE" &&
s/%%DEBUG_BUILDS_ENABLED%%/$DEBUG_BUILDS_ENABLED/
s/%%INCLUDE_FEDORA_FILES%%/$INCLUDE_FEDORA_FILES/
s/%%INCLUDE_RHEL_FILES%%/$INCLUDE_RHEL_FILES/
+ s/%%PATCHLIST_CHANGELOG%%/$PATCHLIST_CHANGELOG/
s/%%TARBALL_VERSION%%/$TARFILE_RELEASE/" "$SPECFILE"
echo "MARKER is $MARKER"
@@ -164,22 +184,6 @@ else
touch "$SOURCES"/patch-"$RPMVERSION"-redhat.patch
fi
-# generate Patchlist.changelog file that holds the shas and commits not
-# included upstream and git commit url.
-ARK_COMMIT_URL="https://gitlab.com/cki-project/kernel-ark/-/commit"
-
-# sed convert
-# <sha> <description>
-# to
-# <ark_commit_url>/<sha>
-# <sha> <description>
-#
-# May need to preserve word splitting in EXCLUDE_FILES
-# shellcheck disable=SC2086
-git log --no-merges --pretty=oneline --no-decorate ${UPSTREAM}.. $EXCLUDE_FILES | \
- sed "s!^\([^ ]*\)!$ARK_COMMIT_URL/\1\n &!; s!\$!\n!" \
- > "$SOURCES"/Patchlist.changelog
-
# We depend on work splitting of BUILDOPTS
# shellcheck disable=SC2086
for opt in $BUILDOPTS; do
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
@@ -7,6 +7,8 @@
%global include_fedora %%INCLUDE_FEDORA_FILES%%
# Include RHEL files
%global include_rhel %%INCLUDE_RHEL_FILES%%
+# Provide Patchlist.changelog file
+%global patchlist_changelog %%PATCHLIST_CHANGELOG%%
# Disable LTO in userspace packages.
%global _lto_cflags %{nil}
@@ -828,7 +830,9 @@ Source2002: kvm_stat.logrotate
# source tree, but in the mean time we carry this to support the legacy workflow
Source3000: merge.pl
Source3001: kernel-local
-Source3003: Patchlist.changelog
+%if %{patchlist_changelog}
+Source3002: Patchlist.changelog
+%endif
Source4000: README.rst
Source4001: rpminspect.yaml
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1415