X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=do_release;h=f88d4a43a497c1cb096629e239e59454926b036f;hb=ee38a438aafef7a04b7df628ca5ad38810a1d63e;hp=b1f79c08e39f2af13af73180a9a450a1a0ad8fa6;hpb=4d59bff95ed91fcc3384ef45b1b23f4d08bf7e0a;p=mirror_smartmontools-debian.git diff --git a/do_release b/do_release index b1f79c0..f88d4a4 100755 --- a/do_release +++ b/do_release @@ -1,51 +1,29 @@ -#!/bin/bash -ev +#!/bin/bash # # do a smartmontools release -# (C) 2003-6 Bruce Allen , -# Guido Guenther -# $Id: do_release,v 1.39 2006/05/19 16:33:33 chrfranke Exp $ +# (C) 2003-11 Bruce Allen , +# Guido Guenther +# (C) 2006-13 Christian Franke +# $Id: do_release 3765 2013-02-05 17:17:13Z chrfranke $ # Notes on generating releases: # (1) update NEWS -# (2) update CHANGELOG -- put in release number -# (3) update release number in configure.in and smartmontools.spec -# (4) update internal changelog in smartmontools.spec -# (5) to test, set USECVS below to 0 -# (6) when satisfied, set USECVS below to 1 +# (2) update ChangeLog -- put in release number +# (3) update release number in configure.ac +# (4) to test, run without '--commit' +# (5) when satisfied, add option '--commit' -USECVS=1 +set -e -KEYID=0x841ABAE8 - -if [ -f /etc/redhat-release ]; then - RPM_BASE=/usr/src/redhat/ -else - RPM_BASE=/usr/src/rpm/ -fi -SOURCES=$RPM_BASE/SOURCES/ - -setup_cvs() -{ - CVS_SERVER=fakevalue - unset CVS_SERVER || echo "can't unset CVS_SERVER=$CVS_SERVER" - CVS_RSH=ssh - CVSROOT=:ext:ballen4705@smartmontools.cvs.sourceforge.net:/cvsroot/smartmontools -} - -get_release() -{ - VERSION=`grep 'AC_INIT' configure.in | awk '{ print $2 }' | sed s/,//g` - RELEASE="RELEASE_${VERSION//\./_}" - echo "Version: $VERSION" - echo "Release: $RELEASE" -} +# Smartmontools Signing Key (through 2014) +KEYID=0x8F6ED8AA inc_release() { MINOR=`echo $VERSION | cut -d. -f2` MAJOR=`echo $VERSION | cut -d. -f1` PERL_OLD=$MAJOR\\.$MINOR - ((MINOR++)) + ((++MINOR)) NEW_VERSION=$MAJOR.$MINOR PERL_NEW=$MAJOR\\.$MINOR NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}" @@ -53,61 +31,116 @@ inc_release() echo "New Release: $NEW_RELEASE" } -# run automake/autoconf -if [ -f Makefile ] ; then - make distcheck || exit 1 - make clean - make distclean - rm -f Makefile configure +COMMIT= +RC= + +case "$1" in + --commit) COMMIT=yes; shift ;; +esac + +case "$*" in + RC[1-9]) RC="$1" ;; + FINAL) ;; + *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;; +esac + +# Check workdir +case "`/bin/pwd`" in + */trunk/smartmontools) WDROOT="../.."; DIRPAT="trunk" ;; + */branches/*/smartmontools) WDROOT="../../.."; DIRPAT="branches/*" ;; + *) echo "`/bin/pwd`: no trunk or branch working dir"; exit 1 ;; +esac + +if [ ! -d "$WDROOT/tags" ]; then + echo "tags directory missing"; exit 1 fi -smartmontools_release_date=`date -u +"%Y/%m/%d"` -smartmontools_release_time=`date -u +"%T %Z"` -cat configure.in | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp -cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.in -rm -f configure.tmp +REVX="`(cd $WDROOT && svnversion)`" || exit 1 +REV="${REVX/%[PM]/}"; REV="${REV/%[PM]/}" +if [ -n "${REV//[0-9]/}" ]; then + echo "Working directory not clean: $REVX"; exit 1 +fi -./autogen.sh +(cd $WDROOT && svn status) | while read s; do + case "`echo $s | tr -s ' '`" in + "M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";; + "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";; + "M "$DIRPAT/smartmontools/configure.ac) echo "$s: OK";; + *) echo "$s: not allowed"; exit 1;; + esac +done +if [ $? -ne 0 ]; then + exit 1 +fi + +# Get release number +VERSION=`sed -n 's|^AC_INIT[^,]*, *\([0-9.]*\) *,.*$|\1|p' configure.ac` +if [ -z "$VERSION" ]; then + echo "AC_INIT not found in configure.ac"; exit 1 +fi +VERSIONRC="$VERSION" +RELEASE="RELEASE_${VERSION//\./_}" + +if [ "$RC" ]; then + VERSIONRC="${VERSION}-${RC/#RC/rc}" + RELEASE="${RELEASE}_${RC}" +fi + +if [ -e "$WDROOT/tags/$RELEASE" ]; then + echo "tags/$RELEASE exists"; exit 1 +fi + +echo "r$REV: Release $VERSIONRC $RELEASE" -get_release +# Update timestamp +smartmontools_release_date=`date -u +"%Y-%m-%d"` +smartmontools_release_time=`date -u +"%T %Z"` +cat configure.ac | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp +cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.ac +rm -f configure.tmp -# tag CVS version -if [ $USECVS -ne 0 ] ; then - setup_cvs - cvs commit -m "Release $VERSION $RELEASE" - cvs tag -d $RELEASE - cvs tag $RELEASE +# Review changes +svn diff +echo "===================================================================" +echo ">>> Continuing in 20 seconds ..." +sleep 20 +set -v + +# Create tag and commit +if [ "$COMMIT" = "yes" ]; then + svn mkdir $WDROOT/tags/$RELEASE + svn copy ../smartmontools $WDROOT/tags/$RELEASE/smartmontools + svn commit -m "Release $VERSIONRC $RELEASE" $WDROOT fi -# build .tar.gz -rm -rf build +# Build +./autogen.sh + mkdir build cd build ../configure make distcheck || exit 1 +make maintainer-clean cd .. -cp build/smartmontools-$VERSION.tar.gz $SOURCES -# build rpm -rpmbuild -ba --sign smartmontools.spec +TARFILE=smartmontools-$VERSIONRC.tar.gz + +mv -f build/smartmontools-$VERSION.tar.gz $TARFILE +rm -rvf build -# remove source tarball -rm -f $SOURCES/smartmontools-$VERSION.tar.gz +md5sum $TARFILE > $TARFILE.md5 -# increase release number: -inc_release -if [ $USECVS -ne 0 ] ; then - perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.in - perl -p -i.bak -e "s/Version:\t$PERL_OLD/Version:\t$PERL_NEW/" smartmontools.spec +# Increase release number +if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then + inc_release + if [ "$COMMIT" = "yes" ]; then + perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.ac + # svn commit -m "Bump release number to $NEW_VERSION" configure.ac + fi fi -mv -f $RPM_BASE/RPMS/i386/smartmontools-$VERSION-*.i386.rpm . || mv -f $RPM_BASE/RPMS/x86_64/smartmontools-$VERSION-*.x86_64.rpm . -mv -f $RPM_BASE/SRPMS/smartmontools-$VERSION-*.src.rpm . -cp -f build/smartmontools-$VERSION.tar.gz . -if [ "$KEYID" ]; then - gpg --default-key $KEYID --armor --detach-sign ./smartmontools-$VERSION.tar.gz +# Sign tarball +if [ -n "$KEYID" ] && gpg --list-secret-keys $KEYID >/dev/null 2>/dev/null; then + gpg --default-key $KEYID --armor --detach-sign ./smartmontools-$VERSIONRC.tar.gz fi -# cleanup -rm -rf autom4te.cache build/ config.h.in Makefile.in examplescripts/Makefile.in \ - depcomp mkinstalldirs install-sh configure aclocal.m4 missing *.bak