]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - do_release
Stop passing arguments to dh_installinit
[mirror_smartmontools-debian.git] / do_release
1 #!/bin/bash
2 #
3 # do a smartmontools release
4 # (C) 2003-11 Bruce Allen, Guido Guenther
5 # (C) 2006-15 Christian Franke
6 # $Id: do_release 4071 2015-04-26 18:25:12Z chrfranke $
7
8 # Notes on generating releases:
9 # (1) update NEWS
10 # (2) update ChangeLog -- put in release number
11 # (3) update release number in configure.ac
12 # (4) to test, run without '--commit'
13 # (5) when satisfied, add option '--commit'
14
15 set -e
16
17 # Smartmontools Signing Key (through 2016)
18 KEYID=0xC4A4903A
19
20 inc_release()
21 {
22 MINOR=`echo $VERSION | cut -d. -f2`
23 MAJOR=`echo $VERSION | cut -d. -f1`
24 PERL_OLD=$MAJOR\\.$MINOR
25 ((++MINOR))
26 NEW_VERSION=$MAJOR.$MINOR
27 PERL_NEW=$MAJOR\\.$MINOR
28 NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}"
29 echo "New Version: $NEW_VERSION"
30 echo "New Release: $NEW_RELEASE"
31 }
32
33 COMMIT=
34 RC=
35
36 case "$1" in
37 --commit) COMMIT=yes; shift ;;
38 esac
39
40 case "$*" in
41 RC[1-9]) RC="$1" ;;
42 FINAL) ;;
43 *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
44 esac
45
46 # Check workdir
47 case "`/bin/pwd`" in
48 */trunk/smartmontools) WDROOT="../.."; DIRPAT="trunk" ;;
49 */branches/*/smartmontools) WDROOT="../../.."; DIRPAT="branches/*" ;;
50 *) echo "`/bin/pwd`: no trunk or branch working dir"; exit 1 ;;
51 esac
52
53 if [ ! -d "$WDROOT/tags" ]; then
54 echo "tags directory missing"; exit 1
55 fi
56
57 REVX="`(cd $WDROOT && svnversion)`" || exit 1
58 REV="${REVX/%[PM]/}"; REV="${REV/%[PM]/}"
59 if [ -n "${REV//[0-9]/}" ]; then
60 echo "Working directory not clean: $REVX"; exit 1
61 fi
62
63 (cd $WDROOT && svn status) | while read s; do
64 case "`echo $s | tr -s ' '`" in
65 "M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";;
66 "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";;
67 "M "$DIRPAT/smartmontools/configure.ac) echo "$s: OK";;
68 *) echo "$s: not allowed"; exit 1;;
69 esac
70 done
71 if [ $? -ne 0 ]; then
72 exit 1
73 fi
74
75 # Get release number
76 VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.ac`
77 if [ -z "$VERSION" ]; then
78 echo "AC_INIT not found in configure.ac"; exit 1
79 fi
80 VERSIONRC="$VERSION"
81 RELEASE="RELEASE_${VERSION//\./_}"
82
83 if [ "$RC" ]; then
84 VERSIONRC="${VERSION}-${RC/#RC/rc}"
85 RELEASE="${RELEASE}_${RC}"
86 fi
87
88 if [ -e "$WDROOT/tags/$RELEASE" ]; then
89 echo "tags/$RELEASE exists"; exit 1
90 fi
91
92 echo "r$REV: Release $VERSIONRC $RELEASE"
93
94 # Update timestamp
95 smartmontools_release_date=`date -u +"%Y-%m-%d"`
96 smartmontools_release_time=`date -u +"%T %Z"`
97 cat configure.ac | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
98 cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.ac
99 rm -f configure.tmp
100
101 # Review changes
102 svn diff
103 echo "==================================================================="
104 echo ">>> Continuing in 20 seconds ..."
105 sleep 20
106 set -v
107
108 # Create tag and commit
109 if [ "$COMMIT" = "yes" ]; then
110 svn mkdir $WDROOT/tags/$RELEASE
111 svn copy ../smartmontools $WDROOT/tags/$RELEASE/smartmontools
112 svn commit -m "Release $VERSIONRC $RELEASE" $WDROOT
113 fi
114
115 # Build
116 ./autogen.sh
117
118 mkdir build
119 cd build
120 ../configure
121 make distcheck || exit 1
122 make maintainer-clean
123 cd ..
124
125 TARFILE=smartmontools-$VERSIONRC.tar.gz
126
127 mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
128 rm -rvf build
129
130 md5sum $TARFILE > $TARFILE.md5
131
132 # Increase release number
133 if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then
134 inc_release
135 if [ "$COMMIT" = "yes" ]; then
136 perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.ac
137 # svn commit -m "Bump release number to $NEW_VERSION" configure.ac
138 fi
139 fi
140
141 # Sign tarball
142 if [ -n "$KEYID" ] && gpg --list-secret-keys $KEYID >/dev/null 2>/dev/null; then
143 gpg --default-key $KEYID --armor --detach-sign ./smartmontools-$VERSIONRC.tar.gz
144 fi
145