summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2012-02-28 11:51:25 -0500
committerDave Jones <davej@redhat.com>2012-02-28 11:51:25 -0500
commit80fb791180177e3801805405e728cf1bf79c484c (patch)
tree4afb1738971943dabca3b19b4ff7533e13525915
parente0d8aaf39773475164d131dd8f2ab3a2004b41fd (diff)
downloadkernel-80fb791180177e3801805405e728cf1bf79c484c.tar.gz
kernel-80fb791180177e3801805405e728cf1bf79c484c.tar.xz
kernel-80fb791180177e3801805405e728cf1bf79c484c.zip
auto-generate the gitN rev
-rwxr-xr-xscripts/generate-git-snapshot.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/generate-git-snapshot.sh b/scripts/generate-git-snapshot.sh
index 5e84a0af8..618d80c08 100755
--- a/scripts/generate-git-snapshot.sh
+++ b/scripts/generate-git-snapshot.sh
@@ -1,22 +1,23 @@
#!/bin/sh
#
# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc or wherever.
-#
-# TODO: Generate the gitN number.
-#
VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/.xz//)
+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
-xz -9 /tmp/patch-$VER-git
+git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT
+xz -9 /tmp/patch-$VER-git$NEWGIT
DESC=$(git describe)
popd
-mv /tmp/patch-$VER-git.xz .
+mv /tmp/patch-$VER-git$NEWGIT.xz .
+
+perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
-perl -p -i -e 's|%global baserelease.*|%global baserelease 1|' kernel.spec
+perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec
-#FIXME: Need the right gitN number for the version to be correct.
rpmdev-bumpspec -c "Linux $DESC" kernel.spec