spec: BuildPreReq -> BuildRequires; need -devel package
[tftp-hpa.git] / release.sh
blob1f72922f409695c9c7a6e4360498db3e2a285fdd
1 #!/bin/sh -xe
2 #
3 # Script for generating a release
6 PACKAGE=tftp-hpa
8 if [ -z "$1" ]; then
9 echo "Usage: $0 release-id" 1>&2
10 exit 1
13 release="$1"
14 releasetag=$PACKAGE-$release
15 releasedir=$PACKAGE-$release
17 GIT_DIR=`cd "${GIT_DIR-.git}" && pwd`
18 export GIT_DIR
20 if [ `git diff --cached | wc -l` -ne 0 ]; then
21 echo "$0: index not clean" 1>&2
22 exit 1
25 if [ x"$release" = x'test' ]; then
26 release=`cat version`
27 releasetag=HEAD
28 releasedir=$PACKAGE-$release
29 else
30 echo $release > version
31 if [ `git diff version | wc -l` -ne 0 ]; then
32 git add version
33 git commit -m "Update version for release $release" version
34 else
35 git checkout version
37 rm -f "$GIT_DIR"/refs/tags/$releasetag
38 git tag -a -m "$releasetag" -f "$releasetag"
41 here=`pwd`
43 tmpdir=/var/tmp/release.$$
44 rm -rf $tmpdir
45 mkdir -p $tmpdir
46 cd $tmpdir
47 mkdir -p $releasedir
48 git archive --format=tar $releasetag | tar -xf - -C $releasedir
49 cd $releasedir
50 make release
51 rm -f release.sh
52 cd ..
53 tar cvvf $releasedir.tar $releasedir
54 gzip -9 $releasedir.tar
55 mv -f $releasedir.tar.gz $here/..
56 cd ..
57 rm -rf $tmpdir