Blame SOURCES/make-libpciaccess-snapshot.sh

565c3d
#!/bin/sh
565c3d
565c3d
DATE=$( date +%Y%m%d )
565c3d
DIRNAME=libpciaccess
565c3d
REV=${1:-master}
565c3d
565c3d
if test -e $DIRNAME.git; then
565c3d
    GIT_DIR=$DIRNAME.git git fetch git://git.freedesktop.org/git/xorg/lib/libpciaccess
565c3d
else
565c3d
    git clone --bare git://git.freedesktop.org/git/xorg/lib/libpciaccess $DIRNAME.git
565c3d
    GIT_DIR=$DIRNAME.git git archive --prefix=$DIRNAME-$DATE/ --format=tar $REV | \
565c3d
	bzip2 -c > $DIRNAME-$DATE.tar.bz2
565c3d
fi
565c3d
565c3d
HASH=$(GIT_DIR=$DIRNAME.git git show-ref -s $REV)
565c3d
565c3d
echo $HASH
565c3d
565c3d
exit 
565c3d
565c3d
# the rest of this is supposed to work?  i guess.
565c3d
565c3d
version=$(sed -n -e "s/^Version: *\(.*\)/\1/p" < libpciaccess.spec)
565c3d
release=$(sed -n -e "s/^Release: *\([^.]*\).*/\1/p" < libpciaccess.spec)
565c3d
release=$(($release + 1))
565c3d
565c3d
user=$(id -un)
565c3d
IFS=: info=($(grep ^$user: /etc/passwd))
565c3d
565c3d
msg="* $(date +'%a %b %d %Y') ${info[4]} <$user@redhat.com> $version-$release.$DATE\\
565c3d
- New snapshot, git revision $HASH.\\
565c3d
"
565c3d
565c3d
sed -i -e "s/^%define gitdate.*/%define gitdate $DATE/" \
565c3d
	-e "s/^%define gitrev.*/%define gitrev $HASH/" \
565c3d
	-e "s/^Source0:.*/Source0:        $DIRNAME-$DATE.tar.bz2/" \
565c3d
	-e "s/^Release:.*/Release:        $release.%{gitdate}%{?dist}/" \
565c3d
	-e "/%changelog/ a $msg" \
565c3d
	libpciaccess.spec
565c3d
565c3d
make new-sources FILES=$DIRNAME-$DATE.tar.bz2