From: Don Zickus <dzickus(a)redhat.com>
This in spirit reverts 0409b218390b564c44dd0181c5d0fe177d4c6bc3
and converts the broken out Red Hat patches back into a single diff.
The original idea was to make it easy for the Fedora community to see
what changes Red Hat was making on top of upstream's tarball. The
concept was good, the reality with a source git tree had a flaw.
While 'git merging' with upstream, various conflicts were resolved
through git or the merge. However, when broken out into individual
patches and placed on top of a tarball, this becomes a rebase.
The conflicts could not be resolved with later patches as the initial
patch was a problem. The only solution was to periodically rebase
the source git tree which dampens the spirit of the idea of source-git.
This patch takes another apporach to solve the original problem:
- create a diff from upstream as a single patch
- create a Patchlist.changelog file to list the individual patches
and their shas1 as seen in the source git tree.
This is what was there original and hence the partial revert (though
that patch went through many changes since then).
It isn't perfect, but we are still evolving. This should resolve the
CKI build failures they continuously run into.
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
---
redhat/genspec.sh | 47 ++++++++++++++-----------------------
redhat/kernel.spec.template | 5 ++--
2 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index a2bfa07a5ef6..966fe85f132f 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -28,9 +28,6 @@ clogf="$SOURCES/changelog"
HIDE_REDHAT=1;
# hide entries for unsupported arches
HIDE_UNSUPPORTED_ARCH=1;
-# Set up for broken out patches
-plistf="$SOURCES/Patchlist"
-pnum=2
# override LC_TIME to avoid date conflicts when building the srpm
LC_TIME=
STAMP=$(echo $MARKER | cut -f 1 -d '-' | sed -e "s/v//");
@@ -252,37 +249,29 @@ test -n "$SPECFILE" &&
s/%%DEBUG_BUILDS_ENABLED%%/$DEBUG_BUILDS_ENABLED/
s/%%TARBALL_VERSION%%/$TARFILE_RELEASE/" $SPECFILE
-touch $plistf
+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
- truncate -s 0 $plistf
- COMMITS=$(git log --reverse --pretty=format:"%h" --no-merges
"$MARKER".. \
- ":(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")
- for c in $COMMITS; do
- patch=$(git format-patch --zero-commit -1 "$c")
- echo "$patch" >> $plistf
- mv $patch $SOURCES/
- sed -i "s/%%PATCHLIST%%/Patch$pnum: $patch\n%%PATCHLIST%%/" $SPECFILE
- sed -i "s/%%APPLYPATCH%%/ApplyOptionalPatch $patch\n%%APPLYPATCH%%/"
$SPECFILE
- ((pnum++))
- done
+ git diff -p --no-renames --stat $MARKER.. $EXCLUDE_FILES \
+ > $SOURCES/patch-${RPMVERSION}-redhat.patch
+else
+ # Need an empty file for dist-git compatibility
+ touch $SOURCES/patch-${RPMVERSION}-redhat.patch
fi
# generate Patchlist.changelog file that holds the shas and commits not
# included upstream.
-git log --no-merges --pretty=oneline --no-decorate master.. \
- ":(exclude,top).gitlab-ci.yml" \
- ":(exclude,top)makefile" \
- ":(exclude,top)Makefile.rhelver" \
- ":(exclude,top)redhat" > $plistf.changelog
-
-sed -i "s/%%PATCHLIST%%//" $SPECFILE
-sed -i "s/%%APPLYPATCH%%//" $SPECFILE
+git log --no-merges --pretty=oneline --no-decorate master.. $EXCLUDE_FILES \
+ > $SOURCES/Patchlist.changelog
for opt in $BUILDOPTS; do
add_opt=
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index bc12211a7d6b..7cbfb9c139eb 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -707,7 +707,6 @@ Source2001: cpupower.config
# source tree, but in the mean time we carry this to support the legacy workflow
Source3000: merge.pl
Source3001: kernel-local
-Source3002: Patchlist
Source3003: Patchlist.changelog
Source4000: README.rst
@@ -716,7 +715,7 @@ Source4000: README.rst
%if !%{nopatches}
-%%PATCHLIST%%
+Patch1: patch-%{rpmversion}-redhat.patch
%endif
# empty final patch to facilitate testing of kernel patches
@@ -1219,7 +1218,7 @@ cp -a %{SOURCE1} .
%if !%{nopatches}
-%%APPLYPATCH%%
+ApplyOptionalPatch patch-%{rpmversion}-redhat.patch
%endif
ApplyOptionalPatch linux-kernel-test.patch
--
GitLab