[OS-BUILD PATCHv2] redhat: make Patchlist.changelog generation conditional

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

 



From: Herton R. Krzesinski <herton@xxxxxxxxxx>

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 contain the kernel-ark repo URLs even if we
are already in another repository.

Drop the URL from the file, and make the Patchlist.changelog generation
conditional because any downstream, like RHEL or CentOS, might backport
a lot of upstream changes which makes Patchlog.changelog not very useful
in this case.

Signed-off-by: Herton R. Krzesinski <herton@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -236,7 +236,7 @@ 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) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES) $(BUILDID)
+	@$(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) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES) $(INCLUDE_PATCHLIST) $(BUILDID)
 	@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,8 @@ BUMP_RELEASE:=yes
 # to '0'.
 INCLUDE_FEDORA_FILES:=1
 INCLUDE_RHEL_FILES:=1
+
+# INCLUDE_PATCHLIST controls whether or not a list of patches that didn't
+# come from upstream is generated, and included in the Patchlist.changelog
+# file in the kernel src.rpm
+INCLUDE_PATCHLIST:=1
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -24,7 +24,8 @@ SNAPSHOT=${17}
 UPSTREAM_BRANCH=${18}
 INCLUDE_FEDORA_FILES=${19}
 INCLUDE_RHEL_FILES=${20}
-BUILDID=${21}
+INCLUDE_PATCHLIST=${21}
+BUILDID=${22}
 RPMVERSION=${KVERSION}.${KPATCHLEVEL}
 clogf="$SOURCES/changelog"
 # hide [redhat] entries from changelog
@@ -126,6 +127,24 @@ else
 	BUILDID_DEFINE="# define buildid .local"
 fi
 
+EXCLUDE_FILES=":(exclude,top).get_maintainer.conf \
+		:(exclude,top).gitattributes \
+		:(exclude,top).gitignore \
+		:(exclude,top).gitlab-ci.yml \
+		:(exclude,top)makefile \
+		:(exclude,top)Makefile.rhelver \
+		:(exclude,top)redhat \
+		:(exclude,top)configs"
+
+# Generate Patchlist.changelog file that holds the shas and commits of
+# changes that didn't come from upstream.
+if [ "$INCLUDE_PATCHLIST" -ne 0 ]; then
+	# May need to preserve word splitting in EXCLUDE_FILES
+	# shellcheck disable=SC2086
+	git log --no-merges --pretty=oneline --no-decorate ${UPSTREAM}.. $EXCLUDE_FILES \
+		> "$SOURCES"/Patchlist.changelog
+fi
+
 test -n "$SPECFILE" &&
         sed -i -e "
 	/%%CHANGELOG%%/r $CHANGELOG
@@ -141,19 +160,11 @@ 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/%%INCLUDE_PATCHLIST%%/$INCLUDE_PATCHLIST/
 	s/%%TARBALL_VERSION%%/$TARFILE_RELEASE/" "$SPECFILE"
 
 echo "MARKER is $MARKER"
 
-EXCLUDE_FILES=":(exclude,top).get_maintainer.conf \
-		:(exclude,top).gitattributes \
-		:(exclude,top).gitignore \
-		:(exclude,top).gitlab-ci.yml \
-		:(exclude,top)makefile \
-		:(exclude,top)Makefile.rhelver \
-		:(exclude,top)redhat \
-		:(exclude,top)configs"
-
 if [ "$SINGLE_TARBALL" = 0 ]; then
 	# May need to preserve word splitting in EXCLUDE_FILES
 	# shellcheck disable=SC2086
@@ -164,22 +175,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 %%INCLUDE_PATCHLIST%%
 
 # 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
_______________________________________________
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