]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - do_release
Refreshed patches
[mirror_smartmontools-debian.git] / do_release
1 #!/bin/bash
2 #
3 # do a smartmontools release
4 # (C) 2003-9 Bruce Allen <ballen4705@users.sourceforge.net>,
5 # Guido Guenther <agx@sigxcpu.org>
6 # Christian Franke <smartmontools-support@lists.sourceforge.net>
7 # $Id: do_release 2970 2009-10-26 18:36:22Z chrfranke $
8
9 # Notes on generating releases:
10 # (1) update NEWS
11 # (2) update CHANGELOG -- put in release number
12 # (3) update release number in configure.in
13 # (4) to test, run without '--commit'
14 # (5) when satisfied, add option '--commit'
15
16 set -e
17
18 inc_release()
19 {
20 MINOR=`echo $VERSION | cut -d. -f2`
21 MAJOR=`echo $VERSION | cut -d. -f1`
22 PERL_OLD=$MAJOR\\.$MINOR
23 ((MINOR++))
24 NEW_VERSION=$MAJOR.$MINOR
25 PERL_NEW=$MAJOR\\.$MINOR
26 NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}"
27 echo "New Version: $NEW_VERSION"
28 echo "New Release: $NEW_RELEASE"
29 }
30
31 COMMIT=
32 RC=
33
34 case "$1" in
35 --commit) COMMIT=yes; shift ;;
36 esac
37
38 case "$*" in
39 RC[1-9]) RC="$1" ;;
40 FINAL) ;;
41 *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
42 esac
43
44 # Check workdir
45 case "`/bin/pwd`" in
46 */trunk/smartmontools) ;;
47 *) echo "not run from trunk checkout"; exit 1 ;;
48 esac
49
50 if [ ! -d ../../tags ]; then
51 echo "tags directory missing"; exit 1
52 fi
53
54 REV=`(cd ../.. && svnversion)` || exit 1
55 if [ -z "`echo "$REV" | sed -n '/^[0-9][0-9]*$/p'`" ]; then
56 echo "Working directory not clean: $REV"; exit 1
57 fi
58
59 # Get release number
60 VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.in`
61 if [ -z "$VERSION" ]; then
62 echo "AC_INIT not found in configure.in"; exit 1
63 fi
64 VERSIONRC="$VERSION"
65 RELEASE="RELEASE_${VERSION//\./_}"
66
67 if [ "$RC" ]; then
68 VERSIONRC="${VERSION}-${RC/#RC/rc}"
69 RELEASE="${RELEASE}_${RC}"
70 fi
71
72 if [ -e "../../tags/$RELEASE" ]; then
73 echo "tags/$RELEASE exists"; exit 1
74 fi
75
76 echo "r$REV: Release $VERSIONRC $RELEASE"
77 set -v
78
79 # Update timestamp
80 smartmontools_release_date=`date -u +"%Y-%m-%d"`
81 smartmontools_release_time=`date -u +"%T %Z"`
82 cat configure.in | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
83 cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.in
84 rm -f configure.tmp
85
86 # Create tag and commit
87 cd ../..
88 if [ "$COMMIT" = "yes" ]; then
89 svn mkdir tags/$RELEASE
90 svn copy trunk/smartmontools tags/$RELEASE/smartmontools
91 svn commit -m "Release $VERSIONRC $RELEASE"
92 fi
93 cd trunk/smartmontools
94
95 # Build
96 ./autogen.sh
97
98 mkdir build
99 cd build
100 ../configure
101 make distcheck || exit 1
102 make maintainer-clean
103 cd ..
104
105 TARFILE=smartmontools-$VERSIONRC.tar.gz
106
107 mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
108 rm -rvf build
109
110 md5sum $TARFILE > $TARFILE.md5
111 sha1sum $TARFILE > $TARFILE.sha1
112
113 # Increase release number
114 if [ -z "$RC" ]; then
115 inc_release
116 if [ "$COMMIT" = "yes" ]; then
117 perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.in
118 # svn commit -m "Bump release number to $NEW_VERSION" configure.in
119 fi
120 fi
121