Dave Jones c325fa4
#!/bin/sh
Dave Jones c325fa4
#
Dave Jones c325fa4
# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc or wherever.
Dave Jones c325fa4
Kyle McMartin 5fda1eb
[ ! -d "$LINUX_GIT" ] && echo "error: set \$LINUX_GIT to point at upstream git tree" && exit 1
Kyle McMartin 5fda1eb
79b876c
VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz//)
Dave Jones c325fa4
Dave Jones 80fb791
OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //)
Dave Jones 80fb791
export NEWGIT=$(($OLDGIT+1))
Dave Jones 80fb791
Dave Jones c325fa4
pushd $LINUX_GIT
Dave Jones c325fa4
Dave Jones 80fb791
git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT
Dave Jones 80fb791
xz -9 /tmp/patch-$VER-git$NEWGIT
Dave Jones c325fa4
DESC=$(git describe)
Dave Jones c325fa4
popd
Dave Jones c325fa4
Dave Jones 80fb791
mv /tmp/patch-$VER-git$NEWGIT.xz .
Dave Jones 80fb791
Dave Jones 80fb791
perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
Dave Jones c325fa4
Dave Jones 80fb791
perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec
Dave Jones ac1a857
Dave Jones c325fa4
rpmdev-bumpspec -c "Linux $DESC" kernel.spec