summaryrefslogtreecommitdiffstats
path: root/scripts/generate-git-snapshot.sh
blob: 618d80c0827ee3a2a04738d6765b92e728398486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc or wherever.

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$NEWGIT
xz -9 /tmp/patch-$VER-git$NEWGIT
DESC=$(git describe)
popd

mv /tmp/patch-$VER-git$NEWGIT.xz .

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