Blame SOURCES/scripts/generate-git-snapshot.sh
|
Justin Vreeland |
794d92 |
#!/bin/sh
|
|
Justin Vreeland |
794d92 |
# This script allows for the generation of a git snapshot between the upstream
|
|
Justin Vreeland |
794d92 |
# git tree and the current tree.
|
|
Justin Vreeland |
794d92 |
#
|
|
Justin Vreeland |
794d92 |
# Prerequisites:
|
|
Justin Vreeland |
794d92 |
# Set LINUX_GIT to point to an upstream Linux git tree in your .bashrc
|
|
Justin Vreeland |
794d92 |
# or wherever.
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
# Look to see if LINUX_GIT is set in local .bashrc
|
|
Justin Vreeland |
794d92 |
if [ -f ~/.bashrc ]; then
|
|
Justin Vreeland |
794d92 |
source ~/.bashrc
|
|
Justin Vreeland |
794d92 |
fi
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
if [ ! -d "$LINUX_GIT" ]; then
|
|
Justin Vreeland |
794d92 |
echo "error: set \$LINUX_GIT to point at upstream git tree"
|
|
Justin Vreeland |
794d92 |
exit 1
|
|
Justin Vreeland |
794d92 |
fi
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
VER=$(grep patch sources | head -n1 | awk '{ print $2 }' | sed s/patch-// | sed s/-git.*// | sed s/.xz// | sed s/[\(\)]//g)
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
if [ -z "$VER" ] ;
|
|
Justin Vreeland |
794d92 |
then
|
|
Justin Vreeland |
794d92 |
VER=$(grep linux sources | head -1 | awk '{ print $2 }' | sed s/linux-// | sed s/.tar.xz// | sed s/[\(\)]//g)
|
|
Justin Vreeland |
794d92 |
fi
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
OLDGIT=$(grep gitrev kernel.spec | head -n1 | sed s/%define\ gitrev\ //)
|
|
Justin Vreeland |
794d92 |
export NEWGIT=$(($OLDGIT+1))
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
pushd $LINUX_GIT
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
git diff v$VER.. > /tmp/patch-$VER-git$NEWGIT
|
|
Justin Vreeland |
794d92 |
xz -9 /tmp/patch-$VER-git$NEWGIT
|
|
Justin Vreeland |
794d92 |
DESC=$(git describe)
|
|
Justin Vreeland |
794d92 |
git rev-list --max-count=1 HEAD > /tmp/gitrev
|
|
Justin Vreeland |
794d92 |
popd
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
mv /tmp/patch-$VER-git$NEWGIT.xz .
|
|
Justin Vreeland |
794d92 |
mv /tmp/gitrev .
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
perl -p -i -e 's|%global baserelease.*|%global baserelease 0|' kernel.spec
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
perl -p -i -e 's|%define gitrev.*|%define gitrev $ENV{'NEWGIT'}|' kernel.spec
|
|
Justin Vreeland |
794d92 |
|
|
Justin Vreeland |
794d92 |
rpmdev-bumpspec -c "Linux $DESC" kernel.spec
|