From 90b4c88276e8117491b6f91c1dc789d484725848 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Mon, 21 Apr 2014 10:55:55 +0100 Subject: [PATCH] Use make-tarball.sh for nightlies too --- Makefile.in | 2 +- make-tarball.sh | 69 ++++++++++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Makefile.in b/Makefile.in index b92f0fac..cfa5141b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,7 @@ $(GTEST_DIR)/src/gtest-all.cc $(GTEST_DIR)/src/gtest_main.cc $(GTEST_DIR)/includ $(Q)touch -c $@ endif -ifneq "THIS_IS_NOT_NIGHTLY" "" +ifneq "THIS_IS_NOT_TARBALL" "" # If git commit was changed since previous build, add a phony target to dependencies, forcing version.o to be recompiled # Nightlies have pregenerated version.cpp src/version.cpp: Makefile version.sh $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(srcdir)/version.sh $(GIT) 2> /dev/null` ]; then echo version_extra_recompile; fi) diff --git a/make-tarball.sh b/make-tarball.sh index 73919c94..d7336162 100755 --- a/make-tarball.sh +++ b/make-tarball.sh @@ -2,8 +2,6 @@ set -e TMPDIR=`mktemp -d` -VERSION=$1 - trap 'rm -rf $TMPDIR' EXIT if [ ! -f include/znc/main.h ] ; then @@ -11,47 +9,60 @@ if [ ! -f include/znc/main.h ] ; then exit -1 fi -if [ "x$VERSION" = "x" ] ; then - AWK_ARG='/#define VERSION_MAJOR/ { maj = $3 } - /#define VERSION_MINOR/ { min = $3 } - END { printf "%.1f", (maj + min / 10) }' - VERSION=$(awk "$AWK_ARG" include/znc/main.h) -fi -if [ "x$VERSION" = "x" ] ; then - echo "Couldn't get version number" - exit -1 +if [ "x$1" = "x--nightly" ]; then + # e.g. ./make-tarball.sh --nightly znc-git-2014-04-21 path/to/output/znc-foo.tar.gz + ZNCDIR=$2 + TARGZ=$3 + SIGN=0 + DESC=-nightly-`date +%Y%m%d`-`git $GITDIR rev-parse HEAD | cut -b-8` +else + VERSION=$1 + if [ "x$VERSION" = "x" ] ; then + AWK_ARG='/#define VERSION_MAJOR/ { maj = $3 } + /#define VERSION_MINOR/ { min = $3 } + END { printf "%.1f", (maj + min / 10) }' + VERSION=$(awk "$AWK_ARG" include/znc/main.h) + fi + if [ "x$VERSION" = "x" ] ; then + echo "Couldn't get version number" + exit -1 + fi + + ZNCDIR=znc-$VERSION + TARGZ=$ZNCDIR.tar.gz + SIGN=1 + DESC="" + # DESC="-rc1" fi -ZNC=znc-$VERSION -TAR=$ZNC.tar -TARGZ=$TAR.gz +TARGZ=`realpath $TARGZ` -echo "Exporting . to $TMPDIR/$ZNC..." -git checkout-index --all --prefix=$TMPDIR/$ZNC/ +echo "Exporting . to $TMPDIR/$ZNCDIR..." +git checkout-index --all --prefix=$TMPDIR/$ZNCDIR/ ( - cd $TMPDIR/$ZNC + cd $TMPDIR/$ZNCDIR echo "Generating configure" AUTOMAKE_FLAGS="--add-missing --copy" ./autogen.sh rm -r autom4te.cache/ mkdir -p modules/.depend - make -C modules -f modperl/Makefile.gen srcdir=. SWIG=/usr/bin/swig - make -C modules -f modpython/Makefile.gen srcdir=. SWIG=/usr/bin/swig - rm -fr modules/.depend + make -C modules -f modperl/Makefile.gen srcdir=. SWIG=/usr/bin/swig PERL=/usr/bin/perl + make -C modules -f modpython/Makefile.gen srcdir=. SWIG=/usr/bin/swig PERL=/usr/bin/perl + rm -f modules/.depend rm .travis* rm make-tarball.sh - sed -e "s/THIS_IS_NOT_NIGHTLY//" -i Makefile.in + sed -e "s/THIS_IS_NOT_TARBALL//" -i Makefile.in echo '#include ' > src/version.cpp - echo "const char* ZNC_VERSION_EXTRA = \"-rc1\";" >> src/version.cpp - # "rc1" part is to be fixed later + echo "const char* ZNC_VERSION_EXTRA = \"$DESC\";" >> src/version.cpp ) ( cd $TMPDIR echo "Creating tarball" - tar -cf $TAR $ZNC - gzip -9 $TAR + env GZIP=-9 tar -czf $TARGZ $ZNCDIR ) echo "Done" -mv $TMPDIR/$TARGZ . -echo "Signing $TARGZ..." -gpg --detach-sig $TARGZ -echo "Created $TARGZ and $TARGZ.sig" + +if [ $SIGN = 1 ]; then + echo "Signing $TARGZ..." + gpg --detach-sig $TARGZ + echo "Created $TARGZ and $TARGZ.sig" +fi