diff options
author | Justin M. Forbes <jforbes@fedoraproject.org> | 2020-08-12 08:03:24 -0500 |
---|---|---|
committer | Justin M. Forbes <jforbes@fedoraproject.org> | 2020-08-12 08:03:24 -0500 |
commit | 47a895f435cccb2cb14eb5d0c52d2f6d4d904907 (patch) | |
tree | 628be9cf983bcdfedd940131f8f7187020cff5f2 /scripts/generate-git-snapshot.sh | |
parent | 29d3f64f7e887d5cf9ae5f496febe5954fc49117 (diff) | |
download | kernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.tar.gz kernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.tar.xz kernel-47a895f435cccb2cb14eb5d0c52d2f6d4d904907.zip |
Linux v5.8.1
Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
Diffstat (limited to 'scripts/generate-git-snapshot.sh')
-rwxr-xr-x | scripts/generate-git-snapshot.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/generate-git-snapshot.sh b/scripts/generate-git-snapshot.sh new file mode 100755 index 000000000..242200ef6 --- /dev/null +++ b/scripts/generate-git-snapshot.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# This script allows for the generation of a git snapshot between the upstream +# git tree and the current tree. +# +# Prerequisites: +# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc +# or wherever. + +# Look to see if LINUX_GIT is set in local .bashrc +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + +if [ ! -d "$LINUX_GIT" ]; then + echo "error: set \$LINUX_GIT to point at upstream git tree" + exit 1 +fi + +VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | sed s/[\(\)]//g) + +if [ -z "$VER" ] ; +then + VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | sed s/[\(\)]//g) +fi + +OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //) +export NEWGIT=$(($OLDGIT+1)) + +pushd $LINUX_GIT + +git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT +xz -9 /tmp/patch-$VER-git$NEWGIT +DESC=$(git describe) +git rev-list --max-count=1 HEAD > /tmp/gitrev +popd + +mv /tmp/patch-$VER-git$NEWGIT.xz . +mv /tmp/gitrev . + +perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec + +perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec + +rpmdev-bumpspec -c "Linux $DESC" kernel.spec |