opensuse: RPM spec from the SuSE mainteiners
[siplcs.git] / git-snapshot.sh
blobbaec41d65aaed4ec050a368da163767586574fff
1 #!/bin/sh
3 # Take a snapshot of the current pidgin-sipe git HEAD from the mob branch.
5 # You can specify the path to a local repository to speed up the cloning
6 # process. The output will be a bzip2 compressed tarball whose name includes
7 # the current date and the abbreviated commit object name of HEAD.
9 # Adapted from several examples found on the Internet.
11 # Configuration
12 PROJECT=pidgin-sipe
13 BRANCH=mob
15 # Create clone
16 set -e
17 TODAY=$(date +%Y%m%d)
18 CLONEDIR=${PROJECT}-${TODAY}
19 echo "Clone directory '$CLONEDIR'."
20 REFERENCE=${1:+--reference $1}
21 if [ -n "$1" ]; then
22 echo "Using local repository under '$1'."
24 rm -rf $CLONEDIR
25 git clone -n $REFERENCE git+ssh://mob@repo.or.cz/srv/git/siplcs.git $CLONEDIR
26 cd $CLONEDIR
27 git checkout -q -b $CLONEDIR origin/$BRANCH
29 # Create archive
30 COMMIT=$(git log -n 1 --abbrev-commit --pretty=oneline | cut -d' ' -f1| sed -e 's/\.//g')
31 PREFIX=${PROJECT}-${TODAY}git${COMMIT}
32 ARCHIVE=${PREFIX}.tar.bz2
33 echo "Creating archive '$ARCHIVE'..."
34 git archive --format=tar --prefix=$PREFIX/ HEAD | bzip2 >../${PREFIX}.tar.bz2
36 # Cleanup
37 echo "Cleanup..."
38 cd ..
39 rm -rf $CLONEDIR
40 echo "DONE."