tzwrapper.cc: fixed use of iterator after erase
[barry.git] / maintainer / git-tagged-release.sh
blobcd735cee867f83a107d708c05c5c0a2bf9b0e6af
1 #!/bin/bash
3 if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
4 echo
5 echo "Usage: ./git-tagged-tar.sh LOGICAL MAJOR MINOR"
6 echo
7 echo "LOGICAL is the desired logical version number"
8 echo "MAJOR is the desired libmajor version number"
9 echo "MINOR is the desired libminor version number"
10 echo
11 echo "This script is an alternative to git-release-tar.sh, and"
12 echo "produces the same output, with the additional side effect of"
13 echo "having 2 pristine tar deltas available to generate the"
14 echo "debian and the tar.bz2 tarballs directly from the repository."
15 echo
16 echo "This script assumes that a tag called 'barry-LOGICAL.MAJOR.MINOR' already"
17 echo "exists. This script will create two more tags:"
18 echo
19 echo " barry-LOGICAL.MAJOR.MINOR.tar.bz2"
20 echo " barry_LOGICAL.MAJOR.MINOR.orig.tar.gz"
21 echo
22 echo "Both tags will contain trees with the same contents as the"
23 echo "tarballs of the same name."
24 echo
25 echo "In addition, pristine-tar will be run against the above generated"
26 echo "tarballs, and will produce deltas in the usual pristine-tar branch."
27 echo
28 echo "The main difference between git-release-tar.sh and this script"
29 echo "is that this script must be run from inside the root of the"
30 echo "git repository you wish to use."
31 echo
32 echo "Example: cd barry-repo"
33 echo " git tag barry-0.17.0"
34 echo " maintainer/git-tagged-tar.sh 0 17 0"
35 echo
36 exit 1
39 DIRNAME="barry-$1.$2.$3"
40 LOGICAL="$1"
41 MAJOR="$2"
42 MINOR="$3"
43 COMMIT="barry-$1.$2.$3"
45 # make sure that git has its tar.umask set to 0022
46 GITUMASK=$(git config tar.umask)
47 if [ "$GITUMASK" != "0022" ] ; then
48 echo "Please set:"
49 echo
50 echo " git config tar.umask 0022"
51 echo
52 exit 1
55 set -e
57 # Are we in a Barry root tree?
58 if ! [ -f AUTHORS -a -f ChangeLog -a -f COPYING -a -f buildgen.sh ] ; then
59 echo "Can't find Barry files. Please run from root of Barry tree."
60 exit 1
63 # start fresh
64 git checkout -f master
65 git clean -xdf
67 mkdir maintainer/build
69 # generate tarball trees
70 git checkout -b git-tagged-tar "$COMMIT"
71 maintainer/tar-prepare.sh
72 git add .
73 git commit -m "Tarball tree for barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2"
74 git tag -s "barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2"
75 git rm -r debian
76 git commit -m "Tarball tree for barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz"
77 git tag -s "barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz"
79 # generate bzip2 tarball
80 git archive --prefix="$DIRNAME/" "barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2" | \
81 bzip2 -9c > "maintainer/build/barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2"
83 # generate debian source package... create tar.gz without debian/, and
84 # a tree with debian, and then run dpkg-source to bundle it up
85 git archive --prefix="$DIRNAME/" "barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz" | \
86 gzip -9c > "maintainer/build/barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz"
87 git archive --prefix="$DIRNAME/" "barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2" | \
88 (cd maintainer/build && tar xf -)
89 (cd maintainer/build && dpkg-source -b $DIRNAME barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz)
91 # finally, generate pristine-tar deltas
92 pristine-tar -m "Release tarball barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2" commit \
93 maintainer/build/barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2 \
94 barry-$LOGICAL.$MAJOR.$MINOR.tar.bz2
95 pristine-tar -m "Release tarball barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz" commit \
96 maintainer/build/barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz \
97 barry_$LOGICAL.$MAJOR.$MINOR.orig.tar.gz
99 # cleanup
100 git checkout master
101 git branch -D git-tagged-tar