summaryrefslogtreecommitdiffstats
path: root/scripts/generate-git-snapshot.sh
diff options
context:
space:
mode:
authorJustin M. Forbes <jforbes@redhat.com>2017-02-20 13:20:23 -0600
committerJustin M. Forbes <jforbes@redhat.com>2017-02-20 13:20:23 -0600
commita98ed5ce60a3a27dd83f47a33d8993eaaef3685e (patch)
tree2390fe67f35cf364436421355cf15e7fab72e294 /scripts/generate-git-snapshot.sh
parent7a011b1bac9aea1fdb059ef767f1445c7062b79d (diff)
downloadkernel-a98ed5ce60a3a27dd83f47a33d8993eaaef3685e.tar.gz
kernel-a98ed5ce60a3a27dd83f47a33d8993eaaef3685e.tar.xz
kernel-a98ed5ce60a3a27dd83f47a33d8993eaaef3685e.zip
Linux 4.10 rebase for stabilization
Diffstat (limited to 'scripts/generate-git-snapshot.sh')
-rwxr-xr-xscripts/generate-git-snapshot.sh25
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/generate-git-snapshot.sh b/scripts/generate-git-snapshot.sh
index b6fe0d6c1..242200ef6 100755
--- a/scripts/generate-git-snapshot.sh
+++ b/scripts/generate-git-snapshot.sh
@@ -1,10 +1,27 @@
#!/bin/sh
+# This script allows for the generation of a git snapshot between the upstream
+# git tree and the current tree.
#
-# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc or wherever.
+# Prerequisites:
+# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc
+# or wherever.
-[ ! -d "$LINUX_GIT" ] && echo "error: set \$LINUX_GIT to point at upstream git tree" && exit 1
+# Look to see if LINUX_GIT is set in local .bashrc
+if [ -f ~/.bashrc ]; then
+ source ~/.bashrc
+fi
-VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz//)
+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))
@@ -14,9 +31,11 @@ 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