From: Prarit Bhargava on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2174
Create a git repo when the srpm code is installed.
Signed-off-by: Prarit Bhargava prarit@redhat.com
--- redhat/kernel.spec.template | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-)
From: Prarit Bhargava prarit@redhat.com
redhat/kernel.spec.template: Create srpm git repo
Other packages (ex, grub2) create an git repo when the source tree is installed. This changeset adds that functionality to the kernel.spec.
This changeset drops support for other SCM in favor of only supporting git and the standard 'git apply' command. This choice then drops the need for additional apply options and simplifies the patch applicaition code.
Create a git repo when the source tree is installed from an SRPM.
Signed-off-by: Prarit Bhargava prarit@redhat.com
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 @@ -1405,10 +1405,10 @@ ApplyPatch() fi fi 2>/dev/null case "$patch" in - *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.gz) gunzip < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.xz) unxz < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;; + *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command $patch ;; + *.gz) gunzip < "$RPM_SOURCE_DIR/$patch" | $patch_command $patch ;; + *.xz) unxz < "$RPM_SOURCE_DIR/$patch" | $patch_command $patch ;; + *) $patch_command < "$RPM_SOURCE_DIR/$patch" ;; esac }
@@ -1416,13 +1416,18 @@ ApplyPatch() ApplyOptionalPatch() { local patch=$1 + commit_msg=$2 shift if [ ! -f $RPM_SOURCE_DIR/$patch ]; then exit 1 fi local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}') if [ "$C" -gt 9 ]; then - ApplyPatch $patch ${1+"$@"} + ApplyPatch "$patch" "$commit_msg" + if ! git-diff --quiet --exit-code ; then + git add -A + git commit -q --author "Fedora Kernel Team kernel-team@fedoraproject.org" -m "$commit_msg" + fi fi }
@@ -1432,12 +1437,19 @@ mv linux-%{tarfile_release} linux-%{KVERREL} cd linux-%{KVERREL} cp -a %{SOURCE1} .
+git init . +# disable autopacking in repository +git config --worktree gc.autopacklimit 0 +git config --worktree gc.auto 0 +git add -A +git commit . -q --author "Fedora Kernel Team kernel-team@fedoraproject.org" -m "Base commit for linux %kabiversion" + %if !%{nopatches}
-ApplyOptionalPatch patch-%{patchversion}-redhat.patch +ApplyOptionalPatch patch-%{patchversion}-redhat.patch "Fedora/ARK %patchversion changes" %endif
-ApplyOptionalPatch linux-kernel-test.patch +ApplyOptionalPatch linux-kernel-test.patch "linux-kernel-test changes"
# END OF PATCH APPLICATIONS
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2174
From: Prarit Bhargava prarit@redhat.com
redhat/kernel.spec.template: Set worktree git user information
Builds fail with:
Committer identity unknown *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'mockbuild@a6a1262f1b604ce09d24d04d7a377c59.(none)') RPM build errors: error: Bad exit status from /var/tmp/rpm-tmp.BdLSyq (%prep) Bad exit status from /var/tmp/rpm-tmp.BdLSyq (%prep)
This can be avoided by setting and unsetting git user information in the patch application section.
Signed-off-by: Prarit Bhargava prarit@redhat.com
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 @@ -1441,6 +1441,10 @@ git init . # disable autopacking in repository git config --worktree gc.autopacklimit 0 git config --worktree gc.auto 0 +# set email and name for initial commits (these are reset at the end of the +# patch applications) +git config --worktree user.email "kernel-team@fedoraproject.org" +git config --worktree user.name "Fedora Kernel Team" git add -A git commit . -q --author "Fedora Kernel Team kernel-team@fedoraproject.org" -m "Base commit for linux %kabiversion"
@@ -1451,6 +1455,11 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch "Fedora/ARK %patchversion
ApplyOptionalPatch linux-kernel-test.patch "linux-kernel-test changes"
+# These command must be done last in patch applications. If these git +# configuration variables are left set then future commits to the repository +# will be attributed incorrectly. +git config --worktree --unset user.email +git config --worktree --unset user.name # END OF PATCH APPLICATIONS
# Any further pre-build tree manipulations happen here.
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2174
From: Justin M. Forbes on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2174#note_1196429...
Curious as to why. We did have this in Fedora for years before we had kernel- ark. But we also had every single patch broken out, and applied each with git am. There was some utility to it from that perspective, it made sure patches had at least some headers, etc. With kernel-ark now, providing more utility, and our srpm patches being 1 large diff from upstream, what does this 30-40 seconds buy us?
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2174#note_1196666...
Agreed. What problem are we solving here?
kernel@lists.fedoraproject.org