[OS-BUILD PATCHv4] genspec.sh: rebase the broken-out patches

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

 



From: Ondrej Mosnacek <omosnace@xxxxxxxxxx>

When generating the patches under $SINGLE_TARBALL == 0, cherry-pick each
commit on top of $MARKER before generating the patch from it. This
partly solves the problem of patches generated from old commits not
applying on the current tree any more.

To avoid polluting the current working copy, this is done in a temporary
worktree inside a temporary directory, which is automatically deleted
when the script exits.

Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 redhat/genspec.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index b72dffe14729..a2c4257bfeda 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -23,7 +23,6 @@ TARFILE_RELEASE=${16}
 SNAPSHOT=${17}
 BUILDID=${18}
 RPMVERSION=${KVERSION}.${KPATCHLEVEL}.${KSUBLEVEL}
-clogf="$SOURCES/changelog"
 # hide [redhat] entries from changelog
 HIDE_REDHAT=1;
 # hide entries for unsupported arches
@@ -36,6 +35,17 @@ LC_TIME=
 STAMP=$(echo $MARKER | cut -f 1 -d '-' | sed -e "s/v//");
 RPM_VERSION="$RPMVERSION-$PKGRELEASE";
 
+function cleanup() {
+	[ -n "$tmpwt" ] && git worktree remove -f "$tmpwt"
+	[ -n "$tmpdir" ] && rm -rf "$tmpdir"
+	return 0
+}
+
+trap cleanup EXIT
+
+tmpdir="$(mktemp -d)"
+clogf="$tmpdir/changelog"
+
 echo >$clogf
 
 lasttag=$(git rev-list --first-parent --grep="^\[redhat\] kernel-${RPMVERSION}" --max-count=1 HEAD)
@@ -255,7 +265,12 @@ if [ "$SINGLE_TARBALL" = 0 ]; then
 		":(exclude,top)makefile" \
 		":(exclude,top)Makefile.rhelver" \
 		":(exclude,top)redhat")
-	for c in $COMMITS; do
+	git worktree add --detach "$tmpdir/work" "$MARKER"
+	tmpwt="$tmpdir/work"
+	for origc in $COMMITS; do
+		git -C "$tmpwt" cherry-pick --allow-empty --keep-redundant-commits \
+			"$origc" || exit 1
+		c="$(git -C "$tmpwt" rev-parse --verify HEAD)"
 		patch=$(git format-patch --zero-commit -1 "$c")
 		echo "$patch" >> $plistf
 		mv $patch $SOURCES/
@@ -274,5 +289,3 @@ for opt in $BUILDOPTS; do
 	[ -z "${opt##-*}" ] && add_opt="_without_${opt#?}"
 	[ -n "$add_opt" ] && sed -i "s/^\\(# The following build options\\)/%define $add_opt 1\\n\\1/" $SPECFILE
 done
-
-rm -f $clogf{,.rev,.stripped};
-- 
GitLab
_______________________________________________
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




[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