maint: changed make-rpm.sh to accept full command line to build package
[barry/progweb.git] / maintainer / git-extract.sh
blob20090b3b97a61b3322b8d057d70a67ddc58e0d53
1 #!/bin/bash
3 if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ] ; then
4 echo
5 echo "Usage: ./git-extract.sh LOGICAL MAJOR MINOR commit"
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 "commit is a git commit tag to use for the extraction"
11 echo
12 echo "A build directory, containing the packaged results,"
13 echo "will be created in the directory in which this script is _run_."
14 echo
15 echo "It will be assumed _this_ script is inside the git repository"
16 echo "you wish to use. i.e. you are running this script from the"
17 echo "same git repository you want to package."
18 echo
19 echo "Example: mkdir /tmp/play"
20 echo " cd /tmp/play"
21 echo " /path/to/git/repo/barry/maintainer/git-extract.sh 0 14 master"
22 echo
23 echo "This will create /tmp/play/build containing the results, and"
24 echo "use /path/to/git/repo as the repository."
25 echo
26 exit 1
29 DIRNAME="barry-$1.$2.$3"
30 LOGICAL="$1"
31 MAJOR="$2"
32 MINOR="$3"
33 COMMIT="$4"
34 RUNDIR="$(dirname "$0")/.."
36 set -e
38 echo "Using git dir: $RUNDIR"
39 sleep 3s
41 mkdir build
42 umask 0022
43 (cd "$RUNDIR" && git archive --format=tar --prefix=$DIRNAME/ $COMMIT) |\
44 tar -x -C build -f -
45 echo "Extracted $COMMIT..."