]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - do_release
Merge commit 'upstream/5.39.1+svn3060'
[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 2997 2009-12-11 21:25:59Z 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) WDROOT="../.."; DIRPAT="trunk" ;;
47 */branches/*/smartmontools) WDROOT="../../.."; DIRPAT="branches/*" ;;
48 *) echo "`/bin/pwd`: no trunk or branch working dir"; exit 1 ;;
49 esac
50
51 if [ ! -d "$WDROOT/tags" ]; then
52 echo "tags directory missing"; exit 1
53 fi
54
55 REVX="`(cd $WDROOT && svnversion)`" || exit 1
56 REV="${REVX/%[PM]/}"; REV="${REV/%[PM]/}"
57 if [ -n "${REV//[0-9]/}" ]; then
58 echo "Working directory not clean: $REVX"; exit 1
59 fi
60
61 (cd $WDROOT && svn status) | while read s; do
62 case "$s" in
63 "M "$DIRPAT/smartmontools/CHANGELOG) echo "$s: OK";;
64 "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";;
65 "M "$DIRPAT/smartmontools/configure.in) echo "$s: OK";;
66 *) echo "$s: not allowed"; exit 1;;
67 esac
68 done
69 if [ $? -ne 0 ]; then
70 exit 1
71 fi
72
73 # Get release number
74 VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.in`
75 if [ -z "$VERSION" ]; then
76 echo "AC_INIT not found in configure.in"; exit 1
77 fi
78 VERSIONRC="$VERSION"
79 RELEASE="RELEASE_${VERSION//\./_}"
80
81 if [ "$RC" ]; then
82 VERSIONRC="${VERSION}-${RC/#RC/rc}"
83 RELEASE="${RELEASE}_${RC}"
84 fi
85
86 if [ -e "$WDROOT/tags/$RELEASE" ]; then
87 echo "tags/$RELEASE exists"; exit 1
88 fi
89
90 echo "r$REV: Release $VERSIONRC $RELEASE"
91
92 # Update timestamp
93 smartmontools_release_date=`date -u +"%Y-%m-%d"`
94 smartmontools_release_time=`date -u +"%T %Z"`
95 cat configure.in | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
96 cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.in
97 rm -f configure.tmp
98
99 # Review changes
100 svn diff
101 echo "==================================================================="
102 echo ">>> Continuing in 20 seconds ..."
103 sleep 20
104 set -v
105
106 # Create tag and commit
107 if [ "$COMMIT" = "yes" ]; then
108 svn mkdir $WDROOT/tags/$RELEASE
109 svn copy ../smartmontools $WDROOT/tags/$RELEASE/smartmontools
110 svn commit -m "Release $VERSIONRC $RELEASE" $WDROOT
111 fi
112
113 # Build
114 ./autogen.sh
115
116 mkdir build
117 cd build
118 ../configure
119 make distcheck || exit 1
120 make maintainer-clean
121 cd ..
122
123 TARFILE=smartmontools-$VERSIONRC.tar.gz
124
125 mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
126 rm -rvf build
127
128 md5sum $TARFILE > $TARFILE.md5
129 sha1sum $TARFILE > $TARFILE.sha1
130
131 # Increase release number
132 if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then
133 inc_release
134 if [ "$COMMIT" = "yes" ]; then
135 perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.in
136 # svn commit -m "Bump release number to $NEW_VERSION" configure.in
137 fi
138 fi
139