2012-02-28 16:18:09 +00:00
|
|
|
#!/bin/sh
|
2016-06-21 20:12:16 +00:00
|
|
|
# This script allows for the generation of a git snapshot between the upstream
|
|
|
|
# git tree and the current tree.
|
2012-02-28 16:18:09 +00:00
|
|
|
#
|
2016-06-21 20:12:16 +00:00
|
|
|
# Prerequisites:
|
|
|
|
# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc
|
|
|
|
# or wherever.
|
2012-02-28 16:18:09 +00:00
|
|
|
|
2016-06-21 20:12:16 +00:00
|
|
|
# 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
|
2013-07-19 00:10:36 +00:00
|
|
|
|
2016-12-29 15:29:39 +00:00
|
|
|
VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | sed s/[\(\)]//g)
|
2012-02-28 16:18:09 +00:00
|
|
|
|
2015-09-01 14:14:49 +00:00
|
|
|
if [ -z "$VER" ] ;
|
|
|
|
then
|
2019-01-08 23:14:13 +00:00
|
|
|
VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.gz// | sed s/[\(\)]//g)
|
2015-09-01 14:14:49 +00:00
|
|
|
fi
|
|
|
|
|
2012-02-28 16:51:25 +00:00
|
|
|
OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //)
|
|
|
|
export NEWGIT=$(($OLDGIT+1))
|
|
|
|
|
2012-02-28 16:18:09 +00:00
|
|
|
pushd $LINUX_GIT
|
|
|
|
|
2015-07-24 12:26:40 +00:00
|
|
|
git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT
|
2012-02-28 16:51:25 +00:00
|
|
|
xz -9 /tmp/patch-$VER-git$NEWGIT
|
2012-02-28 16:18:09 +00:00
|
|
|
DESC=$(git describe)
|
2015-09-28 14:14:34 +00:00
|
|
|
git rev-list --max-count=1 HEAD > /tmp/gitrev
|
2012-02-28 16:18:09 +00:00
|
|
|
popd
|
|
|
|
|
2012-02-28 16:51:25 +00:00
|
|
|
mv /tmp/patch-$VER-git$NEWGIT.xz .
|
2015-09-28 14:14:34 +00:00
|
|
|
mv /tmp/gitrev .
|
2012-02-28 16:51:25 +00:00
|
|
|
|
|
|
|
perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
|
2012-02-28 16:18:09 +00:00
|
|
|
|
2012-02-28 16:51:25 +00:00
|
|
|
perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec
|
2012-02-28 16:26:27 +00:00
|
|
|
|
2012-02-28 16:18:09 +00:00
|
|
|
rpmdev-bumpspec -c "Linux $DESC" kernel.spec
|