]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - do_release
Closes #831504
[mirror_smartmontools-debian.git] / do_release
CommitLineData
a23d5117
GI
1#!/bin/bash
2#
3# do a smartmontools release
293b5ab8
JD
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 $
a23d5117
GI
7
8# Notes on generating releases:
9# (1) update NEWS
ee38a438
GI
10# (2) update ChangeLog -- put in release number
11# (3) update release number in configure.ac
a23d5117
GI
12# (4) to test, run without '--commit'
13# (5) when satisfied, add option '--commit'
14
15set -e
16
293b5ab8
JD
17# Smartmontools Signing Key (through 2016)
18KEYID=0xC4A4903A
cfbba5b9 19
a23d5117
GI
20inc_release()
21{
22 MINOR=`echo $VERSION | cut -d. -f2`
23 MAJOR=`echo $VERSION | cut -d. -f1`
24 PERL_OLD=$MAJOR\\.$MINOR
ee38a438 25 ((++MINOR))
a23d5117
GI
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
33COMMIT=
34RC=
35
36case "$1" in
37 --commit) COMMIT=yes; shift ;;
38esac
39
40case "$*" in
41 RC[1-9]) RC="$1" ;;
42 FINAL) ;;
43 *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
44esac
45
46# Check workdir
47case "`/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 ;;
51esac
52
53if [ ! -d "$WDROOT/tags" ]; then
54 echo "tags directory missing"; exit 1
55fi
56
57REVX="`(cd $WDROOT && svnversion)`" || exit 1
58REV="${REVX/%[PM]/}"; REV="${REV/%[PM]/}"
59if [ -n "${REV//[0-9]/}" ]; then
60 echo "Working directory not clean: $REVX"; exit 1
61fi
62
63(cd $WDROOT && svn status) | while read s; do
cfbba5b9 64 case "`echo $s | tr -s ' '`" in
ee38a438 65 "M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";;
cfbba5b9 66 "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";;
ee38a438 67 "M "$DIRPAT/smartmontools/configure.ac) echo "$s: OK";;
a23d5117
GI
68 *) echo "$s: not allowed"; exit 1;;
69 esac
70done
71if [ $? -ne 0 ]; then
72 exit 1
73fi
74
75# Get release number
ee38a438 76VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.ac`
a23d5117 77if [ -z "$VERSION" ]; then
ee38a438 78 echo "AC_INIT not found in configure.ac"; exit 1
a23d5117
GI
79fi
80VERSIONRC="$VERSION"
81RELEASE="RELEASE_${VERSION//\./_}"
82
83if [ "$RC" ]; then
84 VERSIONRC="${VERSION}-${RC/#RC/rc}"
85 RELEASE="${RELEASE}_${RC}"
86fi
87
88if [ -e "$WDROOT/tags/$RELEASE" ]; then
89 echo "tags/$RELEASE exists"; exit 1
90fi
91
92echo "r$REV: Release $VERSIONRC $RELEASE"
93
94# Update timestamp
95smartmontools_release_date=`date -u +"%Y-%m-%d"`
96smartmontools_release_time=`date -u +"%T %Z"`
ee38a438
GI
97cat configure.ac | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
98cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.ac
a23d5117
GI
99rm -f configure.tmp
100
101# Review changes
102svn diff
103echo "==================================================================="
104echo ">>> Continuing in 20 seconds ..."
105sleep 20
106set -v
107
108# Create tag and commit
109if [ "$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
113fi
114
115# Build
116./autogen.sh
117
118mkdir build
119cd build
120../configure
121make distcheck || exit 1
122make maintainer-clean
123cd ..
124
125TARFILE=smartmontools-$VERSIONRC.tar.gz
126
127mv -f build/smartmontools-$VERSION.tar.gz $TARFILE
128rm -rvf build
129
130md5sum $TARFILE > $TARFILE.md5
a23d5117
GI
131
132# Increase release number
133if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then
134 inc_release
135 if [ "$COMMIT" = "yes" ]; then
ee38a438
GI
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
a23d5117
GI
138 fi
139fi
140
cfbba5b9
GI
141# Sign tarball
142if [ -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
144fi
145