diff --git a/libpciaccess.spec b/libpciaccess.spec index 606b034..fa19c3f 100644 --- a/libpciaccess.spec +++ b/libpciaccess.spec @@ -3,16 +3,17 @@ Name: libpciaccess Version: 0.9.1 -Release: 1%{?dist} +Release: 1.%{gitdate}%{?dist} Summary: PCI access library Group: System Environment/Libraries License: MIT URL: http://gitweb.freedesktop.org/?p=xorg/lib/libpciaccess.git + # git snapshot. To recreate, run # % ./make-libpciaccess-snapshot.sh %{gitrev} -#Source0: libpciaccess-%{gitdate}.tar.bz2 -Source0: http://xorg.freedesktop.org/archive/individual/lib/%{name}-%{version}.tar.bz2 +Source0: libpciaccess-%{gitdate}.tar.bz2 +#Source0: http://xorg.freedesktop.org/archive/individual/lib/%{name}-%{version}.tar.bz2 Source1: make-libpciaccess-snapshot.sh BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) diff --git a/make-libpciaccess-snapshot.sh b/make-libpciaccess-snapshot.sh index 87f0899..85d80b1 100755 --- a/make-libpciaccess-snapshot.sh +++ b/make-libpciaccess-snapshot.sh @@ -1,16 +1,33 @@ #!/bin/sh -DIRNAME=libpciaccess-$( date +%Y%m%d ) +DATE=$( date +%Y%m%d ) +DIRNAME=libpciaccess +REV=${1:-master} -rm -rf $DIRNAME -git clone git://git.freedesktop.org/git/xorg/lib/libpciaccess $DIRNAME -cd $DIRNAME -if [ -z "$1" ]; then - git log | head -1 +if test -e $DIRNAME.git; then + GIT_DIR=$DIRNAME.git git fetch git://git.freedesktop.org/git/xorg/lib/libpciaccess else - git checkout $1 + git clone --bare git://git.freedesktop.org/git/xorg/lib/libpciaccess $DIRNAME.git + GIT_DIR=$DIRNAME.git git archive --prefix=$DIRNAME-$DATE/ --format=tar $REV | \ + bzip2 -c > $DIRNAME-$DATE.tar.bz2 fi -rm -rf .git -cd .. -tar jcf $DIRNAME.tar.bz2 $DIRNAME -rm -rf $DIRNAME + +HASH=$(GIT_DIR=gah.git git-show-ref -s $REV) + +version=$(sed -n -e "s/^Version: *\(.*\)/\1/p" < libpciaccess.spec) +release=$(sed -n -e "s/^Release: *\([^.]*\).*/\1/p" < libpciaccess.spec) +release=$(($release + 1)) + +user=$(id -un) +IFS=: info=($(grep ^$user: /etc/passwd)) + +msg="* $(date +'%a %b %d %Y') ${info[4]} <$user@redhat.com> $version-$release.$DATE\\ +- New snapshot, git revision $HASH.\\ +" + +sed -ie "s/^%define gitdate.*/%define gitdate $DATE/" \ + -e "s/^%define gitrev.*/%define gitrev $HASH/" \ + -e "s/^Source0:.*/Source0: $DIRNAME-$DATE.tar.bz2/" \ + -e "s/^Release:.*/Release: $release.%{gitdate}%{?dist}/" \ + -e "/%changelog/ a $msg" \ + libpciaccess.spec