Update make-libpciaccess-snapshot.sh to edit spec file on update.

This commit is contained in:
Kristian Høgsberg 2007-10-31 17:31:16 +00:00
parent 8759fd2dfa
commit 5398dc329c
2 changed files with 32 additions and 14 deletions

View File

@ -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)

View File

@ -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