summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2019-09-13 17:56:14 +0200
committerDidier Raboud <odyx@debian.org>2019-09-13 17:56:14 +0200
commitb38516f13a1f563aa1eb7faf80965755ac63e3e6 (patch)
treefd60cd4095a45f7327d28dfe04bbfb34b7d7215a /scripts
parente50542121e724e851fc5d6c68bb773f80c0bc12c (diff)
New upstream version 5.3.3
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am24
-rw-r--r--scripts/Makefile.in37
-rw-r--r--scripts/autogen.sh390
-rwxr-xr-xscripts/build-release796
-rwxr-xr-xscripts/count-cpus1
-rwxr-xr-xscripts/gversion21
-rw-r--r--scripts/gversion.in21
-rwxr-xr-xscripts/mkgitlog19
-rw-r--r--scripts/mkgitlog.in19
-rwxr-xr-xscripts/snapstamp20
-rwxr-xr-xscripts/wzpaq74
-rw-r--r--scripts/wzpaq.in74
12 files changed, 925 insertions, 571 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 506dd14..1f7577f 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -24,12 +24,16 @@ include $(top_srcdir)/scripts/global.mk
## Variables
# The autotools-installed scripts /should/ be automatically distributed.
+# build-release needs to be in the tarball because it's run during
+# make distcheck, although it's not intended to be used outside
+# of the development sandbox
EXTRA_DIST = \
autogen.sh \
build-release \
count-cpus \
global.mk \
gversion \
+ snapstamp \
test-gversion \
mkgitlog \
wzpaq
@@ -37,6 +41,7 @@ EXTRA_DIST = \
noinst_SCRIPTS= \
build-release \
gversion \
+ snapstamp \
test-gversion \
mkgitlog \
wzpaq
@@ -45,7 +50,20 @@ noinst_SCRIPTS= \
MAINTAINERCLEANFILES = \
Makefile.in \
- build-release \
- count-cpus \
+ compile \
+ config.guess \
+ config.rpath \
+ config.sub \
+ depcomp \
+ gversion \
+ install-sh \
+ ltconfig \
+ ltmain.sh \
+ mdate-sh \
+ missing \
mkgitlog \
- wzpaq
+ mkinstalldirs \
+ test-driver \
+ test-gversion \
+ wzpaq \
+ ylwrap
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index deb1a69..d8bca4a 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -95,16 +95,17 @@ build_triplet = @build@
host_triplet = @host@
subdir = scripts
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4local/stp.m4 \
+ $(top_srcdir)/m4local/stp_cups.m4 \
+ $(top_srcdir)/m4local/stp_option.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \
- $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_option.m4 \
- $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp_release.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
@@ -186,7 +187,6 @@ EXEEXT = @EXEEXT@
FGREP = @FGREP@
FIND = @FIND@
GENPPD_LIBS = @GENPPD_LIBS@
-GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GIMP2_CFLAGS = @GIMP2_CFLAGS@
GIMP2_LIBS = @GIMP2_LIBS@
GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@
@@ -295,7 +295,6 @@ VERSION = @VERSION@
WHICH_PPDS = @WHICH_PPDS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
-XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
XZ = @XZ@
YACC = @YACC@
YFLAGS = @YFLAGS@
@@ -369,12 +368,16 @@ top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)
# The autotools-installed scripts /should/ be automatically distributed.
+# build-release needs to be in the tarball because it's run during
+# make distcheck, although it's not intended to be used outside
+# of the development sandbox
EXTRA_DIST = \
autogen.sh \
build-release \
count-cpus \
global.mk \
gversion \
+ snapstamp \
test-gversion \
mkgitlog \
wzpaq
@@ -382,16 +385,30 @@ EXTRA_DIST = \
noinst_SCRIPTS = \
build-release \
gversion \
+ snapstamp \
test-gversion \
mkgitlog \
wzpaq
MAINTAINERCLEANFILES = \
Makefile.in \
- build-release \
- count-cpus \
+ compile \
+ config.guess \
+ config.rpath \
+ config.sub \
+ depcomp \
+ gversion \
+ install-sh \
+ ltconfig \
+ ltmain.sh \
+ mdate-sh \
+ missing \
mkgitlog \
- wzpaq
+ mkinstalldirs \
+ test-driver \
+ test-gversion \
+ wzpaq \
+ ylwrap
all: all-am
diff --git a/scripts/autogen.sh b/scripts/autogen.sh
index 7b88ee2..739d406 100644
--- a/scripts/autogen.sh
+++ b/scripts/autogen.sh
@@ -17,30 +17,46 @@ else
fi
if test -d m4 ; then
- :
-else
- echo "Directory \`m4' does not exist. Creating it."
- if test -e m4 ; then
- echo "**Error**: A file \`m4' exists and is not a directory."
- echo "Please remove it."
- DIE=1
- fi
- mkdir m4
+ rm -rf m4
+elif test -e m4 ; then
+ echo "**Error**: A file \`m4local' exists and is not a directory."
+ echo "Please remove it."
+ exit 1
fi
-test -f $srcdir/configure.ac && sed "s/XXXRELEASE_DATE=XXX/RELEASE_DATE=\"`date '+%d %b %Y'`\"/" $srcdir/m4extra/stp_release.m4.in > $srcdir/m4/stp_release.m4
+mkdir m4
+
+# shellcheck disable=SC2006,SC2154
+test -f "$srcdir/configure.ac" && sed "s/XXXRELEASE_DATE=XXX/RELEASE_DATE=\"`date '+%d %b %Y'`\"/" "$srcdir/m4extra/stp_release.m4.in" > "$srcdir/m4/stp_release.m4"
# Make sure all of our auto* bits are up to date.
autoreconf -ivf
+# shellcheck disable=SC2006
libtoolv=`libtool --version | head -1 | sed 's,.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\)\?\).*[a-z]*\([ ]?.*\|\)$,\1,'`
-libtool_major=`echo $libtoolv | awk -F. '{print $1}'`
-libtool_minor=`echo $libtoolv | awk -F. '{print $2}'`
-libtool_point=`echo $libtoolv | awk -F. '{print $3}'`
+if [ -n "$libtoolv" ] ; then
+# shellcheck disable=SC2006
+ libtool_major=`echo "$libtoolv" | awk -F. '{print $1}'`
+# shellcheck disable=SC2006
+ libtool_minor=`echo "$libtoolv" | awk -F. '{print $2}'`
+# shellcheck disable=SC2006,SC2034
+ libtool_point=`echo "$libtoolv" | awk -F. '{print $3}'`
+ if [ "$libtool_major" -le 1 ] && [ "$libtool_minor" -lt 5 ] ; then
+ libtool_err=1
+ fi
+else
+ libtool_err=1
+fi
-test "$libtool_major" -le 1 && {
- test "$libtool_minor" -lt 5
-} && {
+if [ -z "`type -p glib-mkenums`" ] ; then
+ echo
+ echo "**Error**: You must have \`glib2-mkenums' installed to create a"
+ echo "Gutenprint distribution. This is usually distributed in the"
+ echo "glib2-devel, glib2-dev, or similar package."
+ DIE=1
+fi
+
+if [ -n "$libtool_err" ] ; then
echo
echo "**Warning**: You should have \`libtool' 1.5 or newer installed to"
echo "create a Gutenprint distribution. Earlier versions of libtool do"
@@ -48,7 +64,7 @@ test "$libtool_major" -le 1 && {
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
-}
+fi
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
@@ -59,9 +75,9 @@ test "$libtool_major" -le 1 && {
DIE=1
}
-test -f $srcdir/ChangeLog || echo > $srcdir/ChangeLog
+test -f "$srcdir/ChangeLog" || echo > "$srcdir/ChangeLog"
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
+(grep "^AM_PROG_LIBTOOL" "$srcdir/configure.ac" >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed to"
@@ -72,8 +88,8 @@ test -f $srcdir/ChangeLog || echo > $srcdir/ChangeLog
}
}
-grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
- grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
+grep "^AM_GNU_GETTEXT" "$srcdir/configure.ac" >/dev/null && {
+ grep "sed.*POTFILES" "$srcdir/configure.ac" >/dev/null || \
(gettext --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`gettext' installed to"
@@ -98,21 +114,28 @@ grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
#### versions of gettext *do* work, they just don't create the
#### right uninstall code.
+# shellcheck disable=SC2006
gettextv=`gettext --version | head -1 | awk '{print $NF}'`
-gettext_major=`echo $gettextv | awk -F. '{print $1}'`
-gettext_minor=`echo $gettextv | awk -F. '{print $2}'`
-gettext_point=`echo $gettextv | awk -F. '{print $3}'`
-
-test "$gettext_major" -eq 0 && {
- test "$gettext_minor" -lt 16
-} && {
+gettext_err=1
+if [ -n "$gettextv" ] ; then
+# shellcheck disable=SC2006
+ gettext_major=`echo "$gettextv" | awk -F. '{print $1}'`
+# shellcheck disable=SC2006
+ gettext_minor=`echo "$gettextv" | awk -F. '{print $2}'`
+# shellcheck disable=SC2006,SC2034
+ gettext_point=`echo "$gettextv" | awk -F. '{print $3}'`
+ if [ "$gettext_major" -gt 0 ] || [ "$gettext_minor" -ge 16 ] ; then
+ gettext_err=
+ fi
+fi
+if [ -n "$gettext_err" ] ; then
echo
echo "**Warning**: You must have \`gettext' 0.16 or newer installed to"
echo "create a Gutenprint distribution. Earlier versions of gettext do"
echo "not generate the correct 'make uninstall' code."
echo "Get ftp://ftp.gnu.org/gnu/gettext/gettext-0.16.tar.gz"
echo "(or a newer version if it is available)"
-}
+fi
(autopoint --version) < /dev/null > /dev/null 2>&1 || {
echo
@@ -150,77 +173,94 @@ test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
jade_err=0
# Exists?
-jade_exists=`type -p $jade`
-test -z "$jade_exists" && jade_err=1
+command -V jade >/dev/null 2>&1 || jade_err=1
# Proper rev?
test "$jade_err" -eq 0 && {
# echo "Checking for proper revision of jade..."
- jade_version=`jade -v < /dev/null 2>&1 | grep -i "jade version" | awk -F\" '{print $2}'`
+# shellcheck disable=SC2006
+ jade_version=`jade -v < /dev/null 2>&1 | grep -i "jade\"? version" | awk -F\" '{print $2}'`
- jade_version_major=`echo $jade_version | awk -F. '{print $1}'`
- jade_version_minor=`echo $jade_version | awk -F. '{print $2}'`
- jade_version_point=`echo $jade_version | awk -F. '{print $3}'`
-
- test "$jade_version_major" -ge 1 || jade_err=1
-
- test "$jade_version_minor" -lt 2 || {
- test "$jade_version_minor" -eq 2 -a "$jade_version_point" -lt 1
- } && jade_err=1
-
- test "$jade_err" -eq 1 && {
- echo " "
- echo "***Warning***: You must have \"Jade\" version 1.2.1 or"
- echo "newer installed to build the Gutenprint user's guide."
- echo "Get ftp://ftp.jclark.com/pub/jade/jade-1.2.1.tar.gz"
- echo "(or a newer version if available)"
- echo " "
- }
+ # jade:I: "openjade" version "1.3.2"
+ if [ -z "$jade_version" ] ; then
+# shellcheck disable=SC2006
+ jade_version=`jade -v < /dev/null 2>&1 | grep -i 'jade"* version' | sed 's/"//g' | awk '{print $NF}'`
+ fi
+ if [ -z "$jade_version" ] ; then
+ jade -v < /dev/null 2>&1
+ jade_err=1
+ else
+# shellcheck disable=SC2006
+ jade_version_major=`echo "$jade_version" | awk -F. '{print $1}'`
+# shellcheck disable=SC2006
+ jade_version_minor=`echo "$jade_version" | awk -F. '{print $2}'`
+# shellcheck disable=SC2006
+ jade_version_point=`echo "$jade_version" | awk -F. '{print $3}'`
+
+ test "$jade_version_major" -ge 1 || jade_err=1
+
+ test "$jade_version_minor" -lt 2 || {
+ test "$jade_version_minor" -eq 2 -a "$jade_version_point" -lt 1
+ } && jade_err=1
+ fi
+}
+test "$jade_err" -gt 0 && {
+ echo
+ echo "***Warning***: You must have \"Jade\" version 1.2.1 or"
+ echo "newer installed to build the Gutenprint user's guide."
+ echo "Get ftp://ftp.jclark.com/pub/jade/jade-1.2.1.tar.gz"
+ echo "(or a newer version if available)"
+ echo
}
# Check for existence of dvips
-dvipsloc=`type -p dvips`
-
-test -z "$dvipsloc" && {
- echo " "
+command -V dvips >/dev/null 2>&1 || {
+ echo
echo "***Warning***: You must have \"dvips\" installed to"
echo "build the Gutenprint user's guide."
- echo " "
+ echo
}
# Check for existence of jadetex
-jadetexloc=`type -p jadetex`
-
-test -z "$jadetexloc" && {
- echo " "
+command -V jadetex >/dev/null 2>&1 || {
+ echo
echo "***Warning***: You must have \"jadetex\" version 3.5 or"
echo "newer installed to build the Gutenprint user's guide."
echo "Get ftp://prdownloads.sourceforge.net/jadetex/jadetex-3.5.tar.gz"
echo "(or a newer version if available)"
- echo " "
+ echo
}
# Check for OpenJade >= 1.3
openjade_err=0
-openjadeloc=`type -p openjade`
-
# Exists?
-test -z "$openjadeloc" && openjade_err=1
+command -V openjade >/dev/null 2>&1 || openjade_err=1
# Proper rev?
test "$openjade_err" -eq 0 && {
# echo "Checking for proper revision of openjade..."
- openjade_version=`openjade -v < /dev/null 2>&1 | sed 's/"//g' | grep -i "openjade version" $tmp_file | awk -F ' ' '{print $4}'`
- openjade_version_major=`echo $openjade_version | awk -F. '{print $1}'`
- openjade_version_minor=`echo $openjade_version | awk -F. '{print $2}'`
- openjade_version_minor=`echo $openjade_version_minor | awk -F- '{print $1}' | sed -e 's/\([0-9][0-9]*\).*/\1/'`
-
- test "$openjade_version_major" -ge 1 || openjade_err=1
- test "$openjade_version_minor" -ge 3 || openjade_err=1
+# shellcheck disable=SC2006
+ openjade_version=`openjade -v < /dev/null 2>&1 | sed 's/"//g' | grep -i "openjade version" | awk -F ' ' '{print $4}'`
+ if [ -n "$openjade_version" ] ; then
+# shellcheck disable=SC2006
+ openjade_version_major=`echo "$openjade_version" | awk -F. '{print $1}'`
+# shellcheck disable=SC2006
+ openjade_version_minor=`echo "$openjade_version" | awk -F. '{print $2}'`
+# shellcheck disable=SC2006
+ openjade_version_minor=`echo "$openjade_version_minor" | awk -F- '{print $1}' | sed -e 's/\([0-9][0-9]*\).*/\1/'`
+
+ if [ "$openjade_version_major" -lt 1 ] ; then
+ openjade_error=1
+ elif [ "$openjade_version_major" -eq 1 ] && [ "$openjade_version_minor" -lt 3 ] ; then
+ openjade_error=1
+ fi
+ else
+ openjade_err=1
+ fi
test "$openjade_err" -eq 1 && {
echo " "
@@ -232,9 +272,7 @@ test "$openjade_err" -eq 0 && {
}
}
-db2htmlloc=`type -p db2html`
-
-test -z "$db2htmlloc" && {
+command -V db2html >/dev/null 2>&1 || {
echo " "
echo "***Warning***: You must have \"db2html\" installed to"
echo "build the Gutenprint user's guide."
@@ -242,9 +280,7 @@ test -z "$db2htmlloc" && {
echo " "
}
-db2pdfloc=`type -p db2pdf`
-
-test -z "$db2pdfloc" && {
+command -V db2pdf >/dev/null 2>&1 || {
echo " "
echo "***Warning***: You must have \"db2pdf\" installed to"
echo "build the Gutenprint user's guide."
@@ -258,37 +294,45 @@ test -z "$db2pdfloc" && {
sgmltools_err=0
# Exists?
-sgmltoolsloc=`type -p sgmltools`
-test -z "$sgmltoolsloc" && sgmltools_err=1
+command -V sgmltools >/dev/null 2>&1
+test $? -ne 0 && sgmltools_err=1
# Proper rev?
test "$sgmltools_err" -eq 0 && {
# echo "Checking for proper revision of sgmltools..."
+# shellcheck disable=SC2006
sgmltools_version=`sgmltools --version | awk '{print $3}'`
- sgmltools_version_major=`echo $sgmltools_version | awk -F. '{print $1}'`
- sgmltools_version_minor=`echo $sgmltools_version | awk -F. '{print $2}'`
- sgmltools_version_point=`echo $sgmltools_version | awk -F. '{print $3}'`
-
- test "$sgmltools_version_major" -ge 3 || sgmltools_err=1
- test "$sgmltools_version_minor" -gt 0 ||
- (test "$sgmltools_version_minor" -eq 0 -a "$sgmltools_version_point" -ge 2) ||
+ if [ -n "$sgmltools_version" ] ; then
+# shellcheck disable=SC2006
+ sgmltools_version_major=`echo "$sgmltools_version" | awk -F. '{print $1}'`
+# shellcheck disable=SC2006
+ sgmltools_version_minor=`echo "$sgmltools_version" | awk -F. '{print $2}'`
+# shellcheck disable=SC2006
+ sgmltools_version_point=`echo "$sgmltools_version" | awk -F. '{print $3}'`
+
+ test "$sgmltools_version_major" -ge 3 || sgmltools_err=1
+ test "$sgmltools_version_minor" -gt 0 ||
+ (test "$sgmltools_version_minor" -eq 0 -a "$sgmltools_version_point" -ge 2) ||
+ sgmltools_err=1
+ else
sgmltools_err=1
+ fi
+}
- test "$sgmltools_err" -eq 1 && {
- echo " "
- echo "***Warning***: You must have \"sgmltools-lite\" version 3.0.2"
- echo "or newer installed to build the Gutenprint user's guide."
- echo "Get https://sourceforge.net/projects/sgmltools-lite/files/latest/download"
- echo "(or a newer version if available)"
- echo " "
- }
+test "$sgmltools_err" -eq 1 && {
+ echo " "
+ echo "***Warning***: You must have \"sgmltools-lite\" version 3.0.2"
+ echo "or newer installed to build the Gutenprint user's guide."
+ echo "Get https://sourceforge.net/projects/sgmltools-lite/files/latest/download"
+ echo "(or a newer version if available)"
+ echo " "
}
# Check for convert
-convertloc=`type -p convert`
-test -z "$convertloc" && {
+command -V convert >/dev/null 2>&1
+test $? -ne 0 && {
echo " "
echo "***Warning***: You must have \"convert\" installed to"
echo "build the Gutenprint user's guide."
@@ -309,6 +353,7 @@ test -z "$convertloc" && {
# results.
if test -d /usr/share/sgml/docbook ; then
+# shellcheck disable=SC2006
fedora_docbook=`find /usr/share/sgml/docbook -type d -name 'sgml-dtd-4.*' -print`
fi
@@ -328,7 +373,8 @@ fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
- echo \`$0\'" command line."
+ # shellcheck disable=SC1117
+ echo "\`$0\' command line."
echo
fi
@@ -339,96 +385,100 @@ esac
# We don't have subdirectories. We don't want any untarred directories that
# contain configure.ac files to mess things up for us.
-for coin in "$srcdir/configure.ac"
-do
- dr=`dirname $coin`
- if test -f $dr/NO-AUTO-GEN; then
- echo skipping $dr -- flagged as no auto-gen
- else
- echo processing $dr
- macrodirs=`sed -n -e 's,^dnl AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
- ( cd $dr
- aclocalinclude="$ACLOCAL_FLAGS"
- for k in $macrodirs; do
- if test -d $k; then
- aclocalinclude="$aclocalinclude -I $k"
- ##else
- ## echo "**Warning**: No such directory \`$k'. Ignored."
- fi
- done
- if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
- if grep "sed.*POTFILES" configure.ac >/dev/null; then
- : do nothing -- we still have an old unmodified configure.ac
- else
- echo "Creating $dr/aclocal.m4 ..."
- rm -f aclocal.m4
- test -r aclocal.m4 || touch aclocal.m4
- # We've removed po/ChangeLog from the repository. Version
- # 0.10.40 of gettext appends an entry to the ChangeLog every time
- # anyone runs autogen.sh. Since developers do that a lot, and
- # then proceed to commit their entire sandbox, we wind up with
- # an ever-growing po/ChangeLog that generates conflicts on
- # a routine basis. There's no good reason for this.
- echo 'This ChangeLog is redundant. Please see the main ChangeLog for i18n changes.' > po/ChangeLog
- echo >> po/ChangeLog
- echo 'This file is present only to keep po/Makefile.in.in happy.' >> po/ChangeLog
- echo "Running autopoint... Ignore non-fatal messages."
- autopoint --force
- if [ $? -ne 0 ] ; then
- echo 'Autopoint failed!'
- exit 1
- fi
- echo "Making $dr/aclocal.m4 writable ..."
- test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
- fi
- fi
- if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
- echo "Running libtoolize..."
- libtoolize --force --copy || (echo "libtoolize failed!"; exit 1)
- if [ $? -ne 0 ] ; then
- echo 'libtoolize failed!'
- exit 1
- fi
- fi
- echo "Running aclocal $aclocalinclude ..."
- aclocal $aclocalinclude
- if [ $? -ne 0 ] ; then
- echo 'aclocal failed!'
- exit 1
+coin="$srcdir/configure.ac"
+# shellcheck disable=SC2006
+dr=`dirname "$coin"`
+if test -f "$dr/NO-AUTO-GEN"; then
+ echo skipping "$dr" -- flagged as no auto-gen
+else
+ echo processing "$dr"
+# shellcheck disable=SC2006
+ macrodirs=`sed -n -e 's,^dnl AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < "$coin"`
+ ( cd "$dr"
+ aclocalinclude="$ACLOCAL_FLAGS"
+ for k in $macrodirs; do
+ if test -d "$k"; then
+ aclocalinclude="$aclocalinclude -I $k"
+ ##else
+ ## echo "**Warning**: No such directory \`$k'. Ignored."
fi
- if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
- echo "Running autoheader..."
- autoheader
+ done
+ if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
+ if grep "sed.*POTFILES" configure.ac >/dev/null; then
+ : #do nothing -- we still have an old unmodified configure.ac
+ else
+ echo "Creating $dr/aclocal.m4 ..."
+ rm -f aclocal.m4
+ test -r aclocal.m4 || touch aclocal.m4
+ # We've removed po/ChangeLog from the repository. Version
+ # 0.10.40 of gettext appends an entry to the ChangeLog every time
+ # anyone runs autogen.sh. Since developers do that a lot, and
+ # then proceed to commit their entire sandbox, we wind up with
+ # an ever-growing po/ChangeLog that generates conflicts on
+ # a routine basis. There's no good reason for this.
+ echo 'This ChangeLog is redundant. Please see the main ChangeLog for i18n changes.' > po/ChangeLog
+ echo >> po/ChangeLog
+ echo 'This file is present only to keep po/Makefile.in.in happy.' >> po/ChangeLog
+ echo "Running autopoint... Ignore non-fatal messages."
+ autopoint --force
+ # shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
- echo 'autoheader failed!'
+ echo 'Autopoint failed!'
exit 1
fi
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r "$dr/aclocal.m4" && chmod u+w "$dr/aclocal.m4"
fi
- echo "Running automake --gnu $am_opt ..."
- automake --add-missing --force-missing --copy --gnu $am_opt
+ fi
+ if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ # shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
- echo 'automake failed!'
+ echo 'Libtoolize failed!'
exit 1
fi
- echo "Running autoconf ..."
- autoconf
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ # shellcheck disable=SC2086
+ aclocal $aclocalinclude
+ # shellcheck disable=SC2181
+ if [ $? -ne 0 ] ; then
+ echo 'aclocal failed!'
+ exit 1
+ fi
+ if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ # shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
- echo 'autoconf failed!'
+ echo 'autoheader failed!'
exit 1
fi
- )
+ fi
+ echo "Running automake --gnu $am_opt ..."
+ automake --add-missing --force-missing --copy --gnu $am_opt
+ # shellcheck disable=SC2181
if [ $? -ne 0 ] ; then
- exit $?
+ echo 'automake failed!'
+ exit 1
fi
- fi
-done
+ echo "Running autoconf ..."
+ autoconf
+ # shellcheck disable=SC2181
+ if [ $? -ne 0 ] ; then
+ echo 'autoconf failed!'
+ exit 1
+ fi
+ ) || exit 1
+fi
conf_flags="--enable-maintainer-mode" #--enable-iso-c
-if test x$NOCONFIGURE = x; then
- echo Running $srcdir/configure $conf_flags "$@" ...
- $srcdir/configure $conf_flags "$@" \
- && echo Now type \`make\' to compile $PKG_NAME || exit 1
+if test -z "$NOCONFIGURE"; then
+ echo Running "$srcdir/configure" $conf_flags "$@" ...
+ "$srcdir/configure" $conf_flags "$@" \
+ && echo Now type \`make\' to compile "$PKG_NAME" || exit 1
else
echo Skipping configure process.
fi
diff --git a/scripts/build-release b/scripts/build-release
index 37082a8..fa04593 100755
--- a/scripts/build-release
+++ b/scripts/build-release
@@ -23,46 +23,78 @@
# it can find the script directory to get the version without having to be
# autotool-processed.
-# 0) Ensure that we're in the root directory and have a sane environment
-
-declare GIT=$(type -p git)
-declare -a failed_modules
+function xtput() {
+ if [[ -z ${STP_TEST_RECURSIVE:-} && -n ${TERM:-} && ${TERM:-} != dumb ]] ; then
+ tput "$@"
+ fi
+}
-if [[ ! -s ChangeLog.pre-5.2.11 ]] ; then
- echo "$0 must be run from repository top level"
+set -u
+
+# shellcheck disable=SC2155
+{
+declare -r tbold="$(xtput bold)"
+declare -r tred="$(xtput setaf 1)$tbold"
+declare -r tyellow="$(xtput setaf 3)$tbold"
+declare -r tgreen="$(xtput setaf 2)$tbold"
+declare -r tpurple="$(xtput setaf 5)$tbold"
+declare -r tblue=$(xtput setaf 4)
+declare -r tcyan=$(xtput setaf 6)
+declare -r treset=$(xtput sgr0)
+}
+declare -i exitstatus=1
+declare -i stepstatus=-1
+declare currentmodule=
+declare -a failedmodules=()
+declare top_log
+function fatal() {
+ echo "${tred}FATAL: $*${treset}"
exit 1
-fi
-declare ROOT=$(pwd)
+}
-STP_PARALLEL=${STP_PARALLEL:-$($ROOT/scripts/count-cpus)}
+# shellcheck disable=SC2155
+declare GIT=$(type -p git)
+[[ -n $GIT ]] || fatal "Can't find git"
-if [[ -z $GIT ]] ; then
- echo "Can't find git. Cannot continue."
- exit 1
-fi
+"$GIT" rev-parse --show-toplevel >/dev/null 2>&1 || fatal "Current directory is not a git workspace"
+declare rootdir
+rootdir="$("$GIT" rev-parse --show-toplevel 2>/dev/null)"
+[[ -n $rootdir ]] || fatal "Can't find workspace root"
+cd "$rootdir" || fatal "Can't cd to workspace root ($rootdir)"
+[[ -s ChangeLog.pre-5.2.11 ]] || fatal "$rootdir does not appear to be a Gutenprint tree"
+# shellcheck disable=SC2155
declare MAKE=$(type -p make)
+[[ -n $MAKE ]] || fatal "Can't find make"
-if [[ -z $MAKE ]] ; then
- echo "Can't find make. Cannot continue."
- exit 1
-fi
+# shellcheck disable=SC2155
+declare -r ROOT=$(pwd)
+declare tmpfile=/dev/null
+export STP_PARALLEL=${STP_PARALLEL:-$("$ROOT/scripts/count-cpus")}
+declare counter=1
+declare git_dirty=
+declare build_type=release
+[[ -n ${STP_BUILD_SNAPSHOT:-} ]] && build_type=snapshot
-function pkg_version {
- $ROOT/scripts/gversion pkg
+# This can't simply be a constant because scripts/gversion might
+# not exist (or may be incorrect) prior to autogen being run.
+function pkg_version() {
+ "$ROOT/scripts/gversion" pkg
}
-function pkg_tag {
- declare version=$(pkg_version)
- echo gutenprint-${version//./_}
+function pkg_tag() {
+ # shellcheck disable=SC2155
+ local version=$(pkg_version)
+ echo "gutenprint-${version//./_}"
}
# Clean up any trailing whitespace.
-function preflight {
+function preflight() {
+ # shellcheck disable=SC2155
local trailing_ws="$("$GIT" grep -Il '[ ]$')"
if [[ -n $trailing_ws ]] ; then
- console_log "The following files have trailing whitespace:"
+ console_log "*** ERROR: The following files have trailing whitespace:"
console_log "$trailing_ws"
return 2
fi
@@ -71,14 +103,15 @@ function preflight {
# Git pre-checks (not version-specific)
-function check_git {
+function check_git() {
"$GIT" fetch
+ local gstatus=0
# Check for uncommitted files.
if [[ -n $("$GIT" status -uno --porcelain) ]] ; then
console_log "*** ERROR: Uncommitted changes in repository:"
- "$GIT" status -uno | console_log
- return 2
+ "$GIT" status -uno --porcelain | console_log
+ gstatus=2
fi
# Ensure that the workspace is up to date (git status -uno
@@ -86,8 +119,10 @@ function check_git {
# but not behind) and that we don't need to rebase (no merges.
# Also check that we haven't diverged.
- ahead=$("$GIT" rev-list $("$GIT" rev-parse @{u})..@)
- behind=$("$GIT" rev-list $("$GIT" rev-parse @)..@{u})
+ # shellcheck disable=SC2155
+ local ahead=$("$GIT" rev-list '@{u}..@')
+ # shellcheck disable=SC2155
+ local behind=$("$GIT" rev-list '@..@{u}')
if [[ -n $ahead && -n $behind ]] ; then
# Oops! Both ahead *and* behind remote. Really bad news!
console_log "*** ERROR: HEAD and remote have diverged!"
@@ -95,77 +130,128 @@ function check_git {
return 2
elif [[ -n $behind ]] ; then
# We're behind. Not good.
- console_log "*** ERROR: Behind remote by $(wc -w <<< $behind) commits."
+ console_log "*** ERROR: Behind remote by $(wc -w <<< "$behind") commits."
return 2
elif [[ -n $ahead ]] ; then
- # We're ahead. That's OK as long as there are no merge commits...
- merges=0
+ # We're ahead. That's OK as long as there are no merge commits.
+ local merges=0
for h in $ahead ; do
- parents=$("$GIT" rev-parse $h^@ |wc -w)
- (( $parents > 1 )) && merges=$((merges + 1))
+ (( $("$GIT" rev-parse "$h^@" |wc -w) > 1 )) && merges=$((merges + 1))
done
console_log "*** Warning: Ahead of remote."
- if (( $merges > 0 )) ; then
- (( $merges != 1 )) && pl=s
- console_log "*** ERROR: $merges merge$pl between HEAD and remote"
+ if (( merges > 0 )) ; then
+ (( merges != 1 )) && pl=s
+ console_log "*** ERROR: $merges merge${pl:-} between HEAD and remote"
return 2
fi
fi
- return 0
+ return $gstatus
}
# Run autogen.sh to ensure that we're using default build settings
# Everything else depends on this.
-function run_build {
- ./autogen.sh && make clean && make ${STP_PARALLEL:+-j$STP_PARALLEL} && return 0
- echo "FATAL error: preliminary build failed!"
+function run_target() {
+ make "$1" && return 0
+ local lstatus=$?
+ console_log "*** ERROR: ${3:+$3 }make $1 failed"
+ (( lstatus >= 127 )) && return $lstatus
+ return "${2:-2}"
+}
+
+function run_maintainer_clean() {
+ if [[ -f Makefile ]] ; then
+ run_target maintainer-clean
+ else
+ return 0
+ fi
+}
+
+function run_autogen() {
+ # shellcheck disable=SC2086
+ ./autogen.sh ${STP_CONFIG_ARGS:-} && return 0
+ console_log "*** FATAL: autogen failed!"
return 1
}
+function colorize() {
+ sed \
+ -e "s/\*\*\* \(FATAL\|ERROR\):\(.*\)/${tred}*** \1:\2${treset}/" \
+ -e "s/\*\*\* Warning:\(.*\)/${tyellow}*** Warning:\1${treset}/"
+}
+
+function run_clean() {
+ run_target clean
+}
+
+function run_build() {
+ run_target "${STP_PARALLEL:+-j$STP_PARALLEL}" 1
+}
+
# Same as above, without make clean if we know we're in a clean
# environment (e. g. CI)
-function run_build_fresh {
- ./autogen.sh && make ${STP_PARALLEL:+-j$STP_PARALLEL} && return 0
- echo "FATAL error: preliminary build failed!"
+function run_build_fresh() {
+ # shellcheck disable=SC2086
+ ./autogen.sh ${STP_CONFIG_ARGS:-} && make "${STP_PARALLEL:+-j$STP_PARALLEL}" && return 0
+ console_log "*** FATAL preliminary build failed!"
return 1
}
# Git check tag. This can't be run until after the build, because we
# don't have the version available until autogen.
-function check_git_tag {
+function check_git_tag() {
# Make sure that the tag that we're going to want to apply isn't
# already present.
+ [[ $build_type != release ]] && return 0
if [[ -n $("$GIT" show-ref "refs/tags/$(pkg_tag)") ]] ; then
console_log "*** ERROR: Tag named $(pkg_tag) is already present"
return 2
fi
- return 0
}
-# Check that we can build a clone of this workspace
-function _check_git_builds {
- rev=$("$GIT" rev-parse @)
- cwd=$(pwd)
- cd $TESTREPO || return 1
- git clone $cwd .
- if [[ $? != 0 ]] ; then
- echo "Unable to clone repo"
- return 1
+function _cleanup_test_repo() {
+ if [[ -d $TESTREPO ]] ; then
+ rm -rf -- "$TESTREPO"
fi
- git checkout "$rev" || return 1
- STP_LOG_NO_SUBDIR=1 STP_LOG_DIR=$STP_TEST_LOG_PREFIX scripts/build-release preflight run_build run_valgrind_minimal run_distcheck_minimal
}
-function check_git_builds {
- export TESTREPO=$(mktemp -d)
- cwd=$(pwd)
- _check_git_builds
- status=$?
- cd $cwd
- [[ -d $TESTREPO ]] && rm -rf $TESTREPO
- return $status
+# Check that we can build a clone of this workspace
+function _check_git_builds() {
+ # shellcheck disable=SC2155
+ export TESTREPO=$(mktemp -d "/tmp/stpbuild.XXXXXXXX")
+ trap _cleanup_test_repo EXIT SIGHUP SIGINT SIGQUIT SIGTERM
+ # shellcheck disable=SC2155
+ local rev=$("$GIT" rev-parse @)
+ cwd=$(pwd -P)
+ [[ -n $cwd ]] || {
+ console_log "*** ERROR: Can't find directory!"
+ return 2
+ }
+ cd "$TESTREPO" || {
+ console_log "*** ERROR: Can't cd to test repo directory $cwd!"
+ (( $? >= 127 )) && return 127
+ return 2
+ }
+ "$GIT" clone "$cwd" . || {
+ console_log "*** ERROR: Unable to clone repo"
+ (( $? >= 127 )) && return 127
+ return 2
+ }
+ "$GIT" checkout "$rev" || {
+ console_log "*** ERROR: Unable to check out rev $rev"
+ (( $? >= 127 )) && return 127
+ return 2
+ }
+ STP_TEST_RECURSIVE=$((${STP_TEST_RECURSIVE?-0}+1)) STP_LOG_NO_SUBDIR=1 STP_LOG_DIR=$STP_TEST_LOG_PREFIX scripts/build-release preflight run_autogen run_build run_distcheck_minimal || {
+ console_log "*** ERROR: Repo build failed!"
+ (( $? >= 127 )) && return 127
+ return 2
+ }
+}
+
+function check_git_builds() {
+ (_check_git_builds)
}
# Run make valgrind-minimal.
@@ -175,16 +261,20 @@ function check_git_builds {
# printers. It takes about 30 seconds on my laptop. Smoketest and
# all.
-function run_valgrind_minimal {
- make check-valgrind-minimal && return 0
- echo "make check-valgrind-minimal failed"
- return 2
+function run_valgrind_minimal() {
+ run_target check-valgrind-minimal
}
-function run_valgrind_fast {
- make check-valgrind-fast && return 0
- echo "make check-valgrind-fast failed"
- return 2
+function run_valgrind_fast() {
+ run_target check-valgrind-fast
+}
+
+function run_check_minimal() {
+ run_target check-minimal
+}
+
+function run_check_fast() {
+ run_target check-fast
}
# Run make distcheck-fast.
@@ -239,10 +329,8 @@ function run_valgrind_fast {
# which isn't too bad for a prerelease smoke test. The rest of this
# takes a lot longer.
-function run_distcheck_fast {
- make distcheck-fast && return 0
- echo "make distcheck-fast failed"
- return 2
+function run_distcheck_fast() {
+ run_target distcheck-fast
}
# Run make check-valgrind
@@ -256,10 +344,8 @@ function run_distcheck_fast {
# things to make their way in. For CI purposes, if we ever go
# there, like to find a happy medium.
-function run_valgrind {
- make check-valgrind && return 0
- echo "make check-valgrind failed"
- return 2
+function run_valgrind() {
+ run_target check-valgrind
}
# Run make check-full
@@ -285,10 +371,8 @@ function run_valgrind {
# IIRC this takes 60-90 minutes on my laptop, but again, it
# parallelizes very well.
-function run_full {
- make check-full && return 0
- echo "make check-full failed"
- return 2
+function run_full() {
+ run_target check-full
}
# Run make checksums-release to generate a new regression file.
@@ -309,16 +393,21 @@ function run_full {
# will run really fast.
function run_checksums() {
- if make checksums ; then
- CSUM_FILE="src/testpattern/Checksums/sums.$(pkg_version).zpaq"
- if [[ ! -f $CSUM_FILE ]] ; then
- echo "Can't find new checksums file $CSUM_FILE"
+ make checksums
+ local lstatus=$?
+ if (( lstatus == 0 )) ; then
+ # shellcheck disable=SC2155
+ local csum_file="src/testpattern/Checksums/sums.$(pkg_version).zpaq"
+ if [[ ! -f $csum_file ]] ; then
+ console_log "*** ERROR: Can't find new checksums file $csum_file"
+ (( lstatus > 127 )) && return $lstatus
return 2
fi
- cp -p "$CSUM_FILE" "$ARTIFACTDIR"
+ cp -p "$csum_file" "$ARTIFACTDIR"
return 0
fi
- echo "make checksums failed"
+ console_log "*** ERROR: make checksums failed"
+ (( lstatus > 127 )) && return $lstatus
return 2
}
@@ -326,19 +415,30 @@ function run_checksums() {
function git_prep_release() {
# .po files might have changed; nothing else should have!
- if [[ -n $("${GIT}" status -uno --porcelain |egrep -v 'po/.*\.po') ]] ; then
- console_log "ERROR: Unexpected untracked files:"
- "${GIT}" status -uno --porcelain |egrep -v 'po/.*\.po' | console_log
+ # Add any of those changed files.
+ if [[ $build_type == release ]] ; then
+ "$GIT" add -u || return 1
+ # Add the checksums file.
+ # TBD whether to do this for snapshots. The file's not very big,
+ # but it's completely incompressible!
+ "$GIT" add -f "src/testpattern/Checksums/sums.$(pkg_version).zpaq" || return 1
+ # Commit this change
+ "$GIT" commit -m"Gutenprint $(pkg_version) release" || return 1
+ else
+ # Don't update the .po files for every snapshot.
+ echo "Cleaning up .po files"
+ "$GIT" checkout -- po
+ fi
+ # Shouldn't have anything left after this.
+ if "$GIT" status -uno --porcelain |grep -q -E -v 'po/.*\.po' ; then
+ console_log "*** ERROR: Unexpected untracked files:"
+ "$GIT" status -uno --porcelain |grep -E -v 'po/.*\.po' | console_log
return 1
fi
- # Add any of those changed files.
- ${GIT} add -u || return 1
- # Add the checksums file.
- ${GIT} add src/testpattern/Checksums/sums.$(pkg_version).zpaq || return 1
- # Commit this change
- ${GIT} commit -m"Gutenprint $(pkg_version) release" || return 1
# Apply the tag. Ideally we should sign the tag too.
- ${GIT} tag -a "$(pkg_tag)" -m "Gutenprint $(pkg_version) release" || return 1
+ # But don't tag snapshot builds.
+ [[ $build_type != release ]] && return 0
+ "$GIT" tag -a "$(pkg_tag)" -m "Gutenprint $(pkg_version) release" || return 1
}
# make distcheck-minimal
@@ -348,38 +448,53 @@ function git_prep_release() {
# A minimal distcheck only takes about a minute; we might as well
# do a final sanity check.
-function run_distcheck_minimal {
- make distcheck-minimal && return 0
- echo "Final make distcheck-minimal failed"
- return 1
+function run_distcheck_minimal() {
+ run_target distcheck-minimal 1 Final
}
-function run_check_minimal {
- make check-minimal && return 0
- echo "Final make distcheck-minimal failed"
- return 2
+function run_check_minimal() {
+ run_target check-minimal
}
# Save away build
-function save_build_artifacts {
- tarball=gutenprint-$(pkg_version).tar.xz
- [[ -s $tarball ]] && cp -p $tarball $ARTIFACTDIR
+function save_build_artifacts() {
+ # shellcheck disable=SC2155
+ local tarball="$(pkg_version).tar.xz"
+ if [[ -s $tarball ]] ; then
+ cp -p "$tarball" "$ARTIFACTDIR"
+ else
+ echo "Cannot find $tarball"
+ return 1
+ fi
}
# Final release prep
-function finis {
- STP_DATA_PATH=src/xml test/gen-printer-list > printer-list.$(pkg_version) || return 1
- console_log "Remainder to be done manually:"
- console_log
- console_log " * git push"
- console_log
- console_log " * Upload the tarball (.xz)"
- console_log
- console_log " * Update the web site"
- console_log
- console_log " * Merge the updated printer list into p_Supported_Printers.php"
- console_log " and upload that"
+function finis() {
+ local extra_verbiage=
+ [[ $build_type == release ]] && {
+ STP_DATA_PATH=src/xml test/gen-printer-list > "printer-list.$(pkg_version)" || return 1
+ extra_verbiage=$(cat <<EOF
+
+ * Update the web site
+
+ * Merge the updated printer list in ${tcyan}printer-list.$(pkg_version)${tpurple}
+ into p_Supported_Printers.php and upload that to the web site
+EOF
+)
+}
+ console_log <<EOF
+${tpurple}
+================================================================
+Remainder to be done manually:
+
+ * git push
+
+ * Upload the tarball (${tcyan}gutenprint-$(pkg_version).tar.xz${tpurple})
+$extra_verbiage
+================================================================
+$treset
+EOF
return 0
}
@@ -393,255 +508,374 @@ function finis {
# change console_log if the width changes.
#
# Unfortunately the shell built-in printf can't specify UTC.
-function stamp {
- printf '%(%Y-%m-%d.%H:%M:%S%z)T'
+function stamp() {
+ printf '%(%Y-%m-%dT%H:%M:%S%z)T' -1
}
-function date_sec {
- printf '%(%s)T'
+function date_sec() {
+ printf '%(%s)T' -1
}
-function report_progress {
- idx=$1
+function report_progress() {
+ local outst="RUNNING[$1]: "
shift
- case "$quiet" in
- 1)
- declare outst=.
- [[ -n "$DONTRUN_OP" ]] && outst=-
- echo -n $outst
- ;;
- 2)
- ;;
- *)
- declare outst="RUNNING[$idx]: "
- [[ -n "$DONTRUN_OP" ]] && outst='Skipping:'
- echo " >>> $(stamp) $outst $@"
- ;;
- esac
+ # shellcheck disable=SC2046
+ echo $([[ -z ${BUILD_VERBOSE:-} ]] && echo '' -n) ">>> $(stamp) $outst $*"
}
# This allows us to log to multiple outputs, including stdout and
# (where available) file descriptors. Ideally we'd be able to build a
# pipeline and eval it, but it's not clear that that's possible.
-function log1 {
- if [[ $# == 0 || ($# == 1 && $1 == -) ]] ; then
- cat
+function log1() {
+ if [[ $# -eq 0 || ($# == 1 && $1 == -) ]] ; then
+ exec cat
else
- dest="$1"
+ local dest="$1"
shift
# stdout needs to come last, because we just want to send data
# to stdout rather than teeing off or explicitly going to a file.
- if [[ $dest == - && $# > 0 ]] ; then
- # Protect against someone inadvertently specifying - twice!
- if [[ $1 == - ]] ; then
- log1 "$@"
- else
- log1 "$@" -
- fi
+ if [[ $dest == - && $# -gt 0 ]] ; then
+ # Protect against someone inadvertently specifying '-' twice!
+ # shellcheck disable=SC2046
+ log1 "$@" $([[ $1 == - ]] || echo -)
elif [[ $dest == -* ]] ; then
dest=${dest:1}
- if [[ $# == 0 ]] ; then
- cat > "$dest"
+ destdir=${dest%/*}
+ [[ -n $destdir && ! -d $destdir ]] && mkdir -p "$destdir"
+ if (( $# == 0 )) ; then
+ exec cat > "$dest"
+ elif [[ $* == - ]] ; then
+ exec tee "$dest"
else
- tee "$dest" | log1 "$@"
+ exec tee "$dest" | log1 "$@"
fi
else
- if [[ $# == 0 ]] ; then
- cat >> "$dest"
+ destdir=${dest%/*}
+ [[ -n $destdir && ! -d $destdir ]] && mkdir -p "$destdir"
+ if (( $# == 0 )) ; then
+ exec cat >> "$dest"
+ elif [[ $* == - ]] ; then
+ exec tee -a "$dest"
else
- tee -a "$dest" | log1 "$@"
+ exec tee -a "$dest" | log1 "$@"
fi
fi
fi
}
-function log {
- log1 "$@" ${BUILD_VERBOSE:+-}
+function log() {
+ (log1 "$@" ${BUILD_VERBOSE:+-})
}
-function time_delta {
- start=$1
- end=$2
- interval=$((end - start))
- h=$((interval / 3600))
- m=$(((interval % 3600) / 60))
- s=$((interval % 60))
- printf "%d:%02d:%02d" $h $m $s
+function log_top1() {
+ log "$top_log" -
}
-function finish {
- status=$1
- etime=$(date_sec)
- msg=completed
- [[ $status != 0 || -n ${failedmodules[*]} ]] && msg=FAILED
- estamp=$(stamp)
- [[ $quiet = 1 ]] && echo
- if [[ -n ${failedmodules[*]} ]] ; then
- echo "The following modules failed:" | log "$top_log" -
- for f in ${failedmodules[@]} ; do
- echo " $f" | log "$top_log" -
- done
- fi
- echo "*** Gutenprint release build $msg at $estamp ($(time_delta $STIME $etime))" | log "$top_log" -
- echo "================================================================" | log "$top_log"
- if [[ -n $TRAVIS_MODE ]] ; then
- # We really don't want the termination message
- exec 3>&2
- exec 2>/dev/null
- kill %1
- wait %1
- exec 2>&3
- exec 3>&-
+function red() {
+ sed -e "s/^/${tred}/" -e "s/$/${treset}/"
+}
+
+function green() {
+ sed -e "s/^/${tgreen}/" -e "s/$/${treset}/"
+}
+
+function log_top() {
+ if [[ -n "$*" ]] ; then
+ log_top1 <<< "$*"
+ else
+ log_top1
fi
- exit $status
}
# Log the output to the console as well as the master log file and the
# per-operation log file.
#
-# fd#3 (/dev/fd/3 -- let's hope we're building the package on
+# fd#4 (/dev/fd/4 -- let's hope we're building the package on
# a system that supports /dev/fd, but linux does)
# in the operation gets tied to stderr
#
+# Note that fd#3 is used by lower levels
+#
# Then we timestamp the data and send it to the top-level log (which
# is not normally timestamped).
#
# Finally, we remove the existing timestamp (which relies upon the timestamp
# format, ugh) and send it to stdout where it gets picked up and timestamped
# again.
-function console_log {
- if [[ -n "$@" ]] ; then
- echo "$@" | log /dev/fd/3 - | timestamp | log - "$top_log" - | cut -c26-
+function console_log1() {
+ if [[ -n ${STP_TEST_RECURSIVE:-} ]] ; then
+ tee >(exec cat 1>&4) >(timestamp | log_top | cut -c26-)
else
- log /dev/fd/3 - | timestamp | log - "$top_log" - | cut -c26-
+ timestamp | log_top - | cut -c26-
fi
}
+function console_log_immediate1() {
+ case "${STP_TEST_RECURSIVE:-0}" in
+ 2)
+ tee >(exec cat 1>&6) >(exec cat 1>&5) >(exec cat 1>&4) >(timestamp | log_top | cut -c26-)
+ ;;
+ 1)
+ tee >(exec cat 1>&5) >(exec cat 1>&4) >(timestamp | log_top | cut -c26-)
+ ;;
+ *)
+ tee >(exec cat 1>&2) >(timestamp | log_top | cut -c26-)
+ ;;
+ esac
+}
+
+function console_log() {
+ if [[ -n "$*" ]] ; then
+ console_log1 <<< "$*"
+ else
+ console_log1
+ fi
+}
+
+function console_log_immediate() {
+ if [[ -n "$*" ]] ; then
+ console_log_immediate1 <<< "$*"
+ else
+ console_log_immediate1
+ fi
+}
+
+function time_delta() {
+ local -i i=$((${2:-0} - ${1:-0}))
+ printf "%d:%02d:%02d" $((i / 3600)) $(((i % 3600) / 60)) $((i % 60))
+}
+
+function report_step_status() {
+ (( stepstatus == -1 )) && return
+ [[ -z ${BUILD_VERBOSE:-} ]] && {
+ local ststatus=OK
+ local stcolor="${tgreen}"
+ if (( stepstatus)) ; then
+ ststatus=FAILED
+ stcolor="${tred}"
+ if (( stepstatus == 126 )) ; then
+ ststatus="NOT FOUND"
+ stcolor="${tpurple}"
+ elif (( stepstatus >= 127 )) ; then
+ ststatus=INTERRUPTED
+ fi
+ fi
+ printf "$stcolor%$((longest_op - ${#op} ))s $ststatus$treset\n"
+ }
+ [[ -n $currentmodule && $stepstatus -ne 0 ]] && failedmodules+=("$currentmodule")
+ currentmodule=
+ if [[ -f $tmpfile ]] ; then
+ [[ -s $tmpfile ]] && colorize < "$tmpfile"
+ rm -f -- "$tmpfile"
+ fi
+ stepstatus=-1
+}
+
+# shellcheck disable=SC2155
+function finish() {
+ local status=$exitstatus
+ local etime=$(date_sec)
+ local estamp=$(stamp)
+ report_step_status
+ if [[ $status != 0 || -n ${failedmodules[*]:-} ]] ; then
+ log_top "The following modules failed:"
+ log_top "$(printf " %s\n" "${failedmodules[@]:-}")"
+ log_top "*** Gutenprint $build_type build FAILED at $estamp ($(time_delta "$stime" "$etime"))" |red
+ else
+ log_top "*** Gutenprint $build_type build completed at $estamp ($(time_delta "$stime" "$etime"))" |green
+ fi
+ log "$top_log" <<< "================================================================"
+ if [[ -n ${TRAVIS_MODE:-} ]] ; then
+ # We really don't want the termination message from the deadman
+ exec 3>&2 2>/dev/null
+ kill %travis_deadman
+ wait %travis_deadman
+ exec 2>&3 3>&-
+ fi
+ trap - EXIT
+ exit "$status"
+}
+
# Travis times out if there's no output for 10 minutes, but some things
# go silent for quite a while
-function travis_deadman {
- while : ; do sleep 60; echo Mark | timestamp | log -; done
+function travis_deadman() {
+ while : ; do sleep 60; echo -e "\n${tblue}Mark $(uptime)${treset}" | log -; done
}
-function timestamp {
- while read -r ; do
- echo "$(stamp) $REPLY"
- done
+function timestamp() {
+ while read -r ; do echo "$(stamp) $REPLY"; done
}
# Run one operation.
-function runit {
- cmdname=$1
- cmd="$@"
- fcounter=$(printf "%02d" $counter)
- local_logdir="$LOGDIR/$fcounter.${cmd// /_/}"
- mkdir -p $local_logdir
- logfile="$local_logdir/Master"
- [[ -n $DONTRUN_OP ]] && logfile=/dev/null
- sstime=$(date_sec)
- ssstamp=$(stamp)
- status=0
- msg=completed
- echo "----------------------------------------------------------------" | log "-$logfile" "$top_log"
- if [[ -z $DONTRUN_OP ]] ; then
+# shellcheck disable=SC2155
+function runit() {
+ local cmdname=$1
+ local cmd="$*"
+ local fcounter=$(printf "%02d" "$counter")
+ local local_logdir="$logdir/$fcounter.${cmd// /_/}"
+ mkdir -p "$local_logdir"
+ local logfile="$local_logdir/Master"
+ [[ -n ${DONTRUN_OP:-} ]] && logfile=/dev/null
+ local sstime=$(date_sec)
+ local ssstamp=$(stamp)
+ local status=0
+ local msg=completed
+ log "-$logfile" "$top_log" <<< "----------------------------------------------------------------"
+ if [[ -z ${DONTRUN_OP:-} ]] ; then
echo "$cmdname started at $ssstamp" | log "$logfile" "$top_log"
echo "Command: $cmd" | log "$logfile" "$top_log"
- echo "Log file: ${logfile#${LOGDIR}/}" | log "$top_log"
+ echo "Log file: ${logfile#${logdir}/}" | log "$top_log"
else
echo "$cmdname SKIPPED" | log "$top_log"
fi
- report_progress $fcounter $cmdname
-
- if [[ -z $DONTRUN_OP ]] ; then
- STP_TEST_LOG_PREFIX="$local_logdir/" $cmd </dev/null 3>&2 2>&1 | timestamp | log "$logfile"
- status=${PIPESTATUS[0]}
- (( $status > 0 )) && msg=FAILED
- for f in $local_logdir/* ; do
- [[ -f $f && ! -s $f ]] && rm -f $f
+ report_progress "$fcounter" "$cmdname"
+
+ if [[ -z ${DONTRUN_OP:-} ]] ; then
+ #
+ stepstatus=127
+ currentmodule="$cmdname"
+ # Run the command, capturing console output as well as logged output.
+ if [[ -z $(type -t "$cmdname") ]] ; then
+ msg="NOT FOUND"
+ # 126 is also used for "permission denied", which amounts
+ # to the same thing -- it's something the user should not
+ # have tried to run.
+ stepstatus=126
+ else
+ if [[ -n ${STP_TEST_RECURSIVE:-} ]] ; then
+ STP_TEST_RECURSIVE=2 STP_TEST_LOG_PREFIX="$local_logdir/" $cmd </dev/null 4>"$tmpfile" 6>&5 5>&2 3>&1 2>&1 | timestamp | log "$logfile"
+ else
+ STP_TEST_RECURSIVE=1 STP_TEST_LOG_PREFIX="$local_logdir/" $cmd </dev/null 4>"$tmpfile" 5>&2 3>&1 2>&1 | timestamp | log "$logfile"
+ fi
+ stepstatus=${PIPESTATUS[0]}
+ (( stepstatus > 0 )) && msg=FAILED
+ fi
+ local -a emptyfiles=()
+ for f in "$local_logdir"/* ; do
+ [[ -f $f && ! -s $f ]] && emptyfiles+=("$f")
done
+ [[ -n "${emptyfiles[*]:-}" ]] && rm -f -- "${emptyfiles[@]}"
else
msg='(SKIPPED)'
fi
- setime=$(date_sec)
- sestamp=$(stamp)
- if [[ -z $DONTRUN_OP ]] ; then
- echo "$cmd $msg at $sestamp ($(time_delta $sstime $setime))" | log "$logfile" "$top_log"
+ local setime=$(date_sec)
+ local sestamp=$(stamp)
+ if [[ -z ${DONTRUN_OP:-} ]] ; then
+ echo "$cmd $msg at $sestamp ($(time_delta "$sstime" "$setime"))" | log "$logfile" "$top_log"
echo "----------------------------------------------------------------" | log "$logfile" "$top_log"
fi
counter=$((counter+1))
-
- return $status
}
declare -a OPERATIONS=(preflight
check_git
- run_build
check_git_tag
+ run_maintainer_clean
+ run_autogen
+ run_clean
+ run_build
check_git_builds
run_valgrind_minimal
run_distcheck_fast
run_valgrind
run_full
run_checksums
- git_prep_release
run_distcheck_minimal
+ git_prep_release
save_build_artifacts
finis)
-[[ -n "$@" ]] && OPERATIONS=("$@")
-
-declare HOST=$(uname -n)
-declare SSTAMP=$(stamp)
-declare STIME=$(date_sec)
-declare TOPLOGDIR=${STP_LOG_DIR:-"$ROOT/BuildLogs"}
-declare LOGDIR="$TOPLOGDIR/Log.${SSTAMP// /_}"
-[[ -n $STP_LOG_NO_SUBDIR ]] && LOGDIR=$TOPLOGDIR
-mkdir -p $LOGDIR
-if [[ -z $STP_LOG_NO_SUBDIR ]] ; then
- if [[ -L $TOPLOGDIR/Current ]] ; then
- rm -f $TOPLOGDIR/Previous
- mv $TOPLOGDIR/Current $TOPLOGDIR/Previous
- rm -f "$TOPLOGDIR/Current"
+function get_longest_op() {
+ local longest_op=0
+ local op
+ for op in "${OPERATIONS[@]}" ; do
+ (( ${#op} > longest_op )) && longest_op=${#op}
+ done
+ echo $((longest_op + 2))
+}
+
+# shellcheck disable=SC2206
+[[ -n ${STP_BUILD_OPERATIONS:-} ]] && OPERATIONS=($STP_BUILD_OPERATIONS)
+[[ -n "$*" ]] && OPERATIONS=("$@")
+
+trap finish EXIT SIGHUP SIGINT SIGQUIT SIGTERM
+
+# shellcheck disable=SC2155
+{
+declare sstamp=$(stamp)
+declare stime=$(date_sec)
+}
+declare toplogdir=${STP_LOG_DIR:-"$ROOT/BuildLogs"}
+declare logdir="$toplogdir/Log.${sstamp// /_}"
+[[ -n ${STP_LOG_NO_SUBDIR:-} ]] && logdir=$toplogdir
+top_log="$logdir/00.Master"
+mkdir -p "$logdir"
+if [[ -z ${STP_LOG_NO_SUBDIR:-} ]] ; then
+ if [[ -L $toplogdir/Current ]] ; then
+ rm -f -- "$toplogdir/Previous"
+ mv "$toplogdir/Current" "$toplogdir/Previous"
fi
- ln -s $(basename "$LOGDIR") "$TOPLOGDIR/Current"
+ ln -s "${logdir##*/}" "$toplogdir/Current"
fi
-declare ARTIFACTDIR="$LOGDIR/Artifacts"
-mkdir -p $ARTIFACTDIR
-export ARTIFACTDIR
+export ARTIFACTDIR="$logdir/Artifacts"
+mkdir -p "$ARTIFACTDIR"
-skip_ops=${STP_BUILD_SKIP//,/ }
+[[ -n $("$GIT" status --porcelain -uno) ]] && git_dirty=' (dirty)'
+log "-$top_log" <<< "================================================================"
-declare -A SKIP_OPS
+log_top <<EOF
+${tbold}*** Gutenprint $build_type build started at $sstamp on $(uname -n)${treset}
-for o in $skip_ops ; do
- SKIP_OPS[$o]=1
-done
+Directory: $ROOT
+Logs: ${logdir#${ROOT}/}
+Kernel: $(uname -o) $(uname -rv)
+Revision: $("$GIT" rev-parse @)$git_dirty
+Parallel: $STP_PARALLEL
+EOF
-declare counter=1
-declare top_log="$LOGDIR/00.Master"
-declare git_dirty=
+[[ -n ${STP_TEST_ROTOR_CIRCUMFERENCE:-} && -n ${STP_TEST_ROTOR:-} ]] &&
+ log_top "Rotor: $STP_TEST_ROTOR / $STP_TEST_ROTOR_CIRCUMFERENCE"
+
+# Or we could just do "env" here, but having them sorted makes it
+# easier to read. Variables containing '%%' are functions
+log_top <<EOF
+
+Environment:
+$(while read -r var ; do
+ eval "echo ' '$var=\${$var@Q}"
+done <<< "$(compgen -e)")
+
+CPU information:
+$(lscpu -e)
+$(lscpu)
-if [[ -n $TRAVIS_MODE ]] ; then
+Memory information:
+$(free)
+
+Running operations:
+$(printf " %s\n" "${OPERATIONS[@]}")
+EOF
+
+if [[ -n ${TRAVIS_MODE:-} ]] ; then
export BUILD_VERBOSE=1
travis_deadman&
fi
-echo "================================================================" | log "-$top_log"
-echo "*** Gutenprint release build started at $SSTAMP on $HOST" | log "$top_log" -
-echo "Directory: $ROOT" | log "$top_log" -
-echo "Log Directory: ${LOGDIR#${ROOT}/}" | log "$top_log" -
-echo "Parallelism: $STP_PARALLEL" | log "$top_log" -
-[[ -n $("$GIT" status --porcelain -uno) ]] && git_dirty=' (dirty)'
-echo "Git revision: $("$GIT" rev-parse @)$git_dirty" | log "$top_log" -
-
+declare -A SKIP_OPS
+[[ -n ${STP_BUILD_SKIP:-} ]] &&
+ for o in ${STP_BUILD_SKIP//,/ } ; do SKIP_OPS[$o]=1; done
declare -i runstatus=0
-for op in ${OPERATIONS[@]} ; do
- DONTRUN_OP=${DONTRUN}${SKIP_OPS[$op]} runit $op
- case "$?" in
- 0) true ;;
- 2) failedmodules=($failedmodules $op); runstatus=1 ;;
- *) failedmodules=($failedmodules $op); finish 1 ;;
- esac
+# shellcheck disable=SC2155
+declare -i longest_op=$(get_longest_op)
+declare -i lstatus=0
+for op in "${OPERATIONS[@]}" ; do
+ [[ -z ${BUILD_VERBOSE:-} ]] && tmpfile=$(mktemp "/tmp/stpconsole.XXXXXXXX")
+ DONTRUN_OP="${DONTRUN:-}${SKIP_OPS[$op]:-}" runit "$op"
+ lstatus=$stepstatus
+ report_step_status
+ if (( lstatus > 0 )) ; then
+ runstatus=1
+ (( lstatus != 2 )) && break
+ fi
done
-
-finish $runstatus
+exitstatus="$runstatus"
diff --git a/scripts/count-cpus b/scripts/count-cpus
index 1a16889..83c8150 100755
--- a/scripts/count-cpus
+++ b/scripts/count-cpus
@@ -27,7 +27,6 @@ if [ -n "$STP_PARALLEL" ] ; then
fi
# Linux
-
nproc=$(type -p nproc)
if [ -n "$nproc" ] ; then
nproc
diff --git a/scripts/gversion b/scripts/gversion
index e9b20f3..7abb4fb 100755
--- a/scripts/gversion
+++ b/scripts/gversion
@@ -36,14 +36,22 @@ if [ "$#" -gt 3 ] ; then
fi
root="/home/rlk/sandbox/gimp-print-source"
-gutenprint_version=5.3.1
+gutenprint_version=gutenprint-5.3.3
+gutenprint_base=gutenprint-5.3.3
+gutenprint_release=gutenprint-5.3
if [ -z "$3" ] ; then
if [ -d "$root/.git" ] ; then
- git describe --dirty --always --first-parent 2>/dev/null | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
+ tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_version//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_base//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_release//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "gutenprint*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --always --first-parent 2>/dev/null)
+ echo $tag | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
fi
if [ -f "$root/git-version-stamp" ] ; then
+ # shellcheck disable=SC2006
description=`cat "$root/git-version-stamp"`
else
description='(unknown)'
@@ -59,7 +67,8 @@ if [ -z "$description" ] ; then
fi
xed() {
- if [[ -n "$PREFIX" ]] ; then
+ if [ -n "$PREFIX" ] ; then
+ # shellcheck disable=SC1117
sed -e h -e "s/$/ $PREFIX => /" -e x -e 's/^[^0-9]*-//' "$@" -e H -e x -e "s/\n//"
else
sed -e 's/^[^0-9]*-//' "$@"
@@ -164,9 +173,9 @@ doit() {
}
case "$description" in
- -) doit $1 ;;
- --) PREFIX="$1" doit $1 ;;
- *) doit $1 <<< $description
+ -) doit "$1" ;;
+ --) PREFIX="$1" doit "$1" ;;
+ *) echo "$description" | doit "$1" ;;
esac
exit 0
diff --git a/scripts/gversion.in b/scripts/gversion.in
index 8609f54..c60a024 100644
--- a/scripts/gversion.in
+++ b/scripts/gversion.in
@@ -36,14 +36,22 @@ if [ "$#" -gt 3 ] ; then
fi
root="@PKGROOT@"
-gutenprint_version=@VERSION@
+gutenprint_version=gutenprint-@VERSION@
+gutenprint_base=gutenprint-@GUTENPRINT_BASE_VERSION@
+gutenprint_release=gutenprint-@GUTENPRINT_RELEASE_VERSION@
if [ -z "$3" ] ; then
if [ -d "$root/.git" ] ; then
- git describe --dirty --always --first-parent 2>/dev/null | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
+ tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_version//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_base//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "${gutenprint_release//./_}*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --first-parent --candidates=1000 --match "gutenprint*" 2>/dev/null)
+ [[ -z $tag ]] && tag=$(git describe --tags --dirty --always --first-parent 2>/dev/null)
+ echo $tag | sed 's/^[^0-9]*-//' > "$root/git-version-stamp"
fi
if [ -f "$root/git-version-stamp" ] ; then
+ # shellcheck disable=SC2006
description=`cat "$root/git-version-stamp"`
else
description='(unknown)'
@@ -59,7 +67,8 @@ if [ -z "$description" ] ; then
fi
xed() {
- if [[ -n "$PREFIX" ]] ; then
+ if [ -n "$PREFIX" ] ; then
+ # shellcheck disable=SC1117
sed -e h -e "s/$/ $PREFIX => /" -e x -e 's/^[^0-9]*-//' "$@" -e H -e x -e "s/\n//"
else
sed -e 's/^[^0-9]*-//' "$@"
@@ -164,9 +173,9 @@ doit() {
}
case "$description" in
- -) doit $1 ;;
- --) PREFIX="$1" doit $1 ;;
- *) doit $1 <<< $description
+ -) doit "$1" ;;
+ --) PREFIX="$1" doit "$1" ;;
+ *) echo "$description" | doit "$1" ;;
esac
exit 0
diff --git a/scripts/mkgitlog b/scripts/mkgitlog
index 154bf02..351ee5d 100755
--- a/scripts/mkgitlog
+++ b/scripts/mkgitlog
@@ -34,18 +34,25 @@ my (%addlines);
my (%removelines);
my (%filechanges);
my (%files);
+my (@ignore_files) = (".travis.yml",
+ "scripts/travis/checksums",
+ "scripts/travis/integration",
+ "scripts/travis/smoke");
my ($state) = 0;
my ($ostate) = 0;
my ($firsttime) = 1;
sub print_it {
+ my (@files) = sort keys %files;
+ my (%tmp_files);
+ map {$tmp_files{$_} = 1} @files;
+ map {delete $tmp_files{$_}} @ignore_files;
if ($curtag ne "") {
print "===============================================================================\n";
- print "Name: $curtag\n\n"
+ print "Name: $curtag\n\n";
}
- print "$autline\n";
- my (@files) = sort keys %files;
+ print "$autline\n" if (keys %tmp_files > 0);
if ($#files >= 0) {
my ($add) = 0;
my ($remove) = 0;
@@ -78,10 +85,10 @@ sub print_it {
}
$file_detail .= ")\n";
}
- print " Lines: +$add, -$remove\n";
- print "$file_detail\n";
+ print " Lines: +$add, -$remove\n" if (keys %tmp_files > 0);
+ print "$file_detail\n" if (keys %tmp_files > 0);
}
- print "$curmsg\n";
+ print "$curmsg\n" if (keys %tmp_files > 0);
$autline = "";
$curmsg = "";
$curtag = "";
diff --git a/scripts/mkgitlog.in b/scripts/mkgitlog.in
index 2234b88..626a714 100644
--- a/scripts/mkgitlog.in
+++ b/scripts/mkgitlog.in
@@ -34,18 +34,25 @@ my (%addlines);
my (%removelines);
my (%filechanges);
my (%files);
+my (@ignore_files) = (".travis.yml",
+ "scripts/travis/checksums",
+ "scripts/travis/integration",
+ "scripts/travis/smoke");
my ($state) = 0;
my ($ostate) = 0;
my ($firsttime) = 1;
sub print_it {
+ my (@files) = sort keys %files;
+ my (%tmp_files);
+ map {$tmp_files{$_} = 1} @files;
+ map {delete $tmp_files{$_}} @ignore_files;
if ($curtag ne "") {
print "===============================================================================\n";
- print "Name: $curtag\n\n"
+ print "Name: $curtag\n\n";
}
- print "$autline\n";
- my (@files) = sort keys %files;
+ print "$autline\n" if (keys %tmp_files > 0);
if ($#files >= 0) {
my ($add) = 0;
my ($remove) = 0;
@@ -78,10 +85,10 @@ sub print_it {
}
$file_detail .= ")\n";
}
- print " Lines: +$add, -$remove\n";
- print "$file_detail\n";
+ print " Lines: +$add, -$remove\n" if (keys %tmp_files > 0);
+ print "$file_detail\n" if (keys %tmp_files > 0);
}
- print "$curmsg\n";
+ print "$curmsg\n" if (keys %tmp_files > 0);
$autline = "";
$curmsg = "";
$curtag = "";
diff --git a/scripts/snapstamp b/scripts/snapstamp
new file mode 100755
index 0000000..4e037e0
--- /dev/null
+++ b/scripts/snapstamp
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Emit a snapshot identifier if STP_BUILD_SNAPSHOT is set
+#
+# Copyright (C) 2019 Robert Krawitz
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+[[ -n $STP_BUILD_SNAPSHOT && -d .git ]] && printf '%s%(%Y-%m-%dT%H-%M)T-%s' - -1 $(git describe --dirty --always --first-parent --exclude '*')
diff --git a/scripts/wzpaq b/scripts/wzpaq
index 0f9b6eb..2008f57 100755
--- a/scripts/wzpaq
+++ b/scripts/wzpaq
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Wrap zpaq as a more generic compression utility
#
@@ -26,11 +26,9 @@ declare FORCE=
declare KEEP=
declare SAVE_META=
declare RECURSE=
-declare STDIN=
declare STATUS=0
declare -r PROGNAME=$0
declare -r BASEDIR=$(pwd)
-declare -r RM=rm
declare TMP_FILE=
declare TMP_DIR=
declare TMP_ARCHIVE=
@@ -54,10 +52,10 @@ usage() {
echo " -5 Use maximum compression"
echo
echo "With no FILE, or when only FILE is -, read standard input"
- exit $USTATUS
+ exit "$USTATUS"
}
-while getopts "qvcdhfknNz0123456789" opt ; do
+while getopts "qvcdhfknNrz0123456789" opt ; do
case "$opt" in
q) VERBOSE= ;;
v) VERBOSE=1 ;;
@@ -74,16 +72,16 @@ while getopts "qvcdhfknNz0123456789" opt ; do
*) usage 1 ;;
esac
done
-shift $(($OPTIND-1))
+shift $((OPTIND-1))
if [[ -n $RECURSE && -n $ZPCAT ]] ; then
echo "May not combine recursive and output to stdout"
- usage $0 1
+ usage "$0" 1
fi
if [[ -n $RECURSE && -z $* ]] ; then
echo "May not use recursive with no inputs"
- usage $0 1
+ usage "$0" 1
fi
declare -a FILES
@@ -103,13 +101,13 @@ build_file_list() {
OIFS=$IFS
IFS=
if [[ -n $DECOMPRESS ]] ; then
- for f in $(find "$f" -type f -name '*.zpaq' -print) ; do
- FILES+=($(g "$f"))
- done
+ while read -r FILE ; do
+ FILES+=("$(g "$f1")")
+ done <<< "$(find "$f" -type f -name '*.zpaq' -print)"
else
- for f in $(find "$f" -type f \! -name '*.zpaq' -print) ; do
- FILES+=($(g "$f"))
- done
+ while read -r FILE ; do
+ FILES+=("$(g "$f1")")
+ done <<< "$(find "$f" -type f \! -name '*.zpaq' -print)"
fi
IFS=$OIFS
else
@@ -124,7 +122,7 @@ build_file_list() {
echo "$f: is a zpaq archive, skipping" 1>&2
STATUS=1
else
- FILES+=($(g "$f"))
+ FILES+=("$(g "$f")")
fi
else
echo "$f: not a plain file, skipping" 1>&2
@@ -134,13 +132,12 @@ build_file_list() {
}
if [[ -z $* || $* == '-' ]] ; then
- STDIN=1
ZPCAT=1
else
build_file_list "$@"
fi
-if [[ -n $ZPCAT && ${#FILES[@]} > 1 ]] ; then
+if [[ -n $ZPCAT && ${#FILES[@]} -gt 1 ]] ; then
echo "May not compress/decompress more than one file to stdout" 1>&2
usage 1
fi
@@ -157,8 +154,8 @@ run_zpaq() {
RM() {
for f in "$@" ; do
- if [[ $1 != $TMP_FILE && $1 != $TMP_DIR || $1 != $TMP_ARCHIVE ]] ; then
- rm -rf $f
+ if [[ $1 != "$TMP_FILE" && $1 != "$TMP_DIR" && $1 != "$TMP_ARCHIVE" ]] ; then
+ rm -rf "$f"
fi
done
}
@@ -166,10 +163,10 @@ RM() {
do_decompress() {
FILE="$1"
DEST="$2"
- [[ -n $3 && -d $3 ]] && cd $3
- run_zpaq extract "$FILE" $SAVE_META
- [[ $? > 0 ]] && STATUS=1
- if [[ $(wc -l <<< "$(find . -type f -print)") > 1 ]] ; then
+ # shellcheck disable=SC2164
+ [[ -n $3 && -d $3 ]] && cd "$3"
+ run_zpaq extract "$FILE" $SAVE_META || STATUS=1
+ if [[ $(wc -l <<< "$(find . -type f -print)") -gt 1 ]] ; then
echo "Multiple file archive $TMP_ARCHIVE, skipping" 1>&2
exit 1
fi
@@ -191,9 +188,10 @@ decompress_file() {
# (which may be problematic if the directory is remote and we
# spend a lot of time in the temp directory).
(do_decompress "$FILE" "$DEST" "$TMP_DIR")
- if [[ $? > 0 ]] ; then
+ # shellcheck disable=2181
+ if (( $? > 0 )) ; then
STATUS=1
- elif [[ -z $ZPCAT && ! -n $KEEP ]] ; then
+ elif [[ -z $ZPCAT && -z $KEEP ]] ; then
RM "$FILE"
fi
fi
@@ -204,10 +202,9 @@ decompress() {
if [[ -z ${FILES[*]} ]] ; then
# Decompress stdin implies output to stdout
ZPCAT=1
- cat > "$TMP_ARCHIVE"
- [[ $? == 0 ]] && decompress_file "$TMP_ARCHIVE"
+ cat > "$TMP_ARCHIVE" && decompress_file "$TMP_ARCHIVE"
else
- for f in ${FILES[@]} ; do
+ for f in "${FILES[@]}" ; do
declare DEST=
[[ -z $ZPCAT ]] && DEST="${f%.zpaq}"
if [[ -n $DEST && -e $DEST && -z $FORCE ]] ; then
@@ -223,7 +220,7 @@ decompress() {
do_compress() {
FILE="$1"
DEST=$(g "$2")
- cd "${FILE%/*}"
+ cd "${FILE%/*}" || return 1
run_zpaq add "$DEST" "${FILE##*/}" $SAVE_META -method "$METHOD"
}
@@ -232,10 +229,8 @@ compress_file() {
DEST=${2:-${FILE}.zpaq}
# Make sure that DEST really is empty.
RM "$DEST"
- (do_compress "$FILE" "$DEST")
- if [[ $? > 0 ]] ; then
- return 1
- elif [[ -n "$ZPCAT" ]] ; then
+ (do_compress "$FILE" "$DEST") || return 1
+ if [[ -n "$ZPCAT" ]] ; then
# zpaq won't send anything to stdout; we have to
cat "$DEST"
RM "$DEST"
@@ -249,21 +244,18 @@ compress() {
if [[ -z ${FILES[*]} ]] ; then
# Compress stdin implies output to stdout
ZPCAT=1
- cat > "$TMP_FILE"
- if [[ $? == 0 ]] ; then
- compress_file "$TMP_FILE" "$TMP_ARCHIVE"
- [[ $? > 0 ]] && STATUS=1
- fi
+ cat > "$TMP_FILE" && {
+ compress_file "$TMP_FILE" "$TMP_ARCHIVE" || STATUS=1
+ }
else
- for f in ${FILES[@]} ; do
+ for f in "${FILES[@]}" ; do
declare DEST="${f}.zpaq"
[[ -n $ZPCAT ]] && DEST="$TMP_ARCHIVE"
if [[ -z $ZPCAT && -e $DEST && -z $FORCE ]] ; then
echo "${DEST#${BASEDIR}/} exists, skipping" 1>&2
STATUS=1
else
- compress_file "$f" "$DEST"
- [[ $? > 0 ]] && STATUS=1
+ compress_file "$f" "$DEST" || STATUS=1
fi
done
fi
diff --git a/scripts/wzpaq.in b/scripts/wzpaq.in
index 7998ba8..5de7d70 100644
--- a/scripts/wzpaq.in
+++ b/scripts/wzpaq.in
@@ -1,4 +1,4 @@
-#!@BASH@
+#!@BASHREAL@
# Wrap zpaq as a more generic compression utility
#
@@ -26,11 +26,9 @@ declare FORCE=
declare KEEP=
declare SAVE_META=
declare RECURSE=
-declare STDIN=
declare STATUS=0
declare -r PROGNAME=$0
declare -r BASEDIR=$(pwd)
-declare -r RM=rm
declare TMP_FILE=
declare TMP_DIR=
declare TMP_ARCHIVE=
@@ -54,10 +52,10 @@ usage() {
echo " -5 Use maximum compression"
echo
echo "With no FILE, or when only FILE is -, read standard input"
- exit $USTATUS
+ exit "$USTATUS"
}
-while getopts "qvcdhfknNz0123456789" opt ; do
+while getopts "qvcdhfknNrz0123456789" opt ; do
case "$opt" in
q) VERBOSE= ;;
v) VERBOSE=1 ;;
@@ -74,16 +72,16 @@ while getopts "qvcdhfknNz0123456789" opt ; do
*) usage 1 ;;
esac
done
-shift $(($OPTIND-1))
+shift $((OPTIND-1))
if [[ -n $RECURSE && -n $ZPCAT ]] ; then
echo "May not combine recursive and output to stdout"
- usage $0 1
+ usage "$0" 1
fi
if [[ -n $RECURSE && -z $* ]] ; then
echo "May not use recursive with no inputs"
- usage $0 1
+ usage "$0" 1
fi
declare -a FILES
@@ -103,13 +101,13 @@ build_file_list() {
OIFS=$IFS
IFS=
if [[ -n $DECOMPRESS ]] ; then
- for f in $(find "$f" -type f -name '*.zpaq' -print) ; do
- FILES+=($(g "$f"))
- done
+ while read -r FILE ; do
+ FILES+=("$(g "$f1")")
+ done <<< "$(find "$f" -type f -name '*.zpaq' -print)"
else
- for f in $(find "$f" -type f \! -name '*.zpaq' -print) ; do
- FILES+=($(g "$f"))
- done
+ while read -r FILE ; do
+ FILES+=("$(g "$f1")")
+ done <<< "$(find "$f" -type f \! -name '*.zpaq' -print)"
fi
IFS=$OIFS
else
@@ -124,7 +122,7 @@ build_file_list() {
echo "$f: is a zpaq archive, skipping" 1>&2
STATUS=1
else
- FILES+=($(g "$f"))
+ FILES+=("$(g "$f")")
fi
else
echo "$f: not a plain file, skipping" 1>&2
@@ -134,13 +132,12 @@ build_file_list() {
}
if [[ -z $* || $* == '-' ]] ; then
- STDIN=1
ZPCAT=1
else
build_file_list "$@"
fi
-if [[ -n $ZPCAT && ${#FILES[@]} > 1 ]] ; then
+if [[ -n $ZPCAT && ${#FILES[@]} -gt 1 ]] ; then
echo "May not compress/decompress more than one file to stdout" 1>&2
usage 1
fi
@@ -157,8 +154,8 @@ run_zpaq() {
RM() {
for f in "$@" ; do
- if [[ $1 != $TMP_FILE && $1 != $TMP_DIR || $1 != $TMP_ARCHIVE ]] ; then
- rm -rf $f
+ if [[ $1 != "$TMP_FILE" && $1 != "$TMP_DIR" && $1 != "$TMP_ARCHIVE" ]] ; then
+ @RM@ -rf "$f"
fi
done
}
@@ -166,10 +163,10 @@ RM() {
do_decompress() {
FILE="$1"
DEST="$2"
- [[ -n $3 && -d $3 ]] && cd $3
- run_zpaq extract "$FILE" $SAVE_META
- [[ $? > 0 ]] && STATUS=1
- if [[ $(wc -l <<< "$(find . -type f -print)") > 1 ]] ; then
+ # shellcheck disable=SC2164
+ [[ -n $3 && -d $3 ]] && cd "$3"
+ run_zpaq extract "$FILE" $SAVE_META || STATUS=1
+ if [[ $(wc -l <<< "$(find . -type f -print)") -gt 1 ]] ; then
echo "Multiple file archive $TMP_ARCHIVE, skipping" 1>&2
exit 1
fi
@@ -191,9 +188,10 @@ decompress_file() {
# (which may be problematic if the directory is remote and we
# spend a lot of time in the temp directory).
(do_decompress "$FILE" "$DEST" "$TMP_DIR")
- if [[ $? > 0 ]] ; then
+ # shellcheck disable=2181
+ if (( $? > 0 )) ; then
STATUS=1
- elif [[ -z $ZPCAT && ! -n $KEEP ]] ; then
+ elif [[ -z $ZPCAT && -z $KEEP ]] ; then
RM "$FILE"
fi
fi
@@ -204,10 +202,9 @@ decompress() {
if [[ -z ${FILES[*]} ]] ; then
# Decompress stdin implies output to stdout
ZPCAT=1
- cat > "$TMP_ARCHIVE"
- [[ $? == 0 ]] && decompress_file "$TMP_ARCHIVE"
+ cat > "$TMP_ARCHIVE" && decompress_file "$TMP_ARCHIVE"
else
- for f in ${FILES[@]} ; do
+ for f in "${FILES[@]}" ; do
declare DEST=
[[ -z $ZPCAT ]] && DEST="${f%.zpaq}"
if [[ -n $DEST && -e $DEST && -z $FORCE ]] ; then
@@ -223,7 +220,7 @@ decompress() {
do_compress() {
FILE="$1"
DEST=$(g "$2")
- cd "${FILE%/*}"
+ cd "${FILE%/*}" || return 1
run_zpaq add "$DEST" "${FILE##*/}" $SAVE_META -method "$METHOD"
}
@@ -232,10 +229,8 @@ compress_file() {
DEST=${2:-${FILE}.zpaq}
# Make sure that DEST really is empty.
RM "$DEST"
- (do_compress "$FILE" "$DEST")
- if [[ $? > 0 ]] ; then
- return 1
- elif [[ -n "$ZPCAT" ]] ; then
+ (do_compress "$FILE" "$DEST") || return 1
+ if [[ -n "$ZPCAT" ]] ; then
# zpaq won't send anything to stdout; we have to
cat "$DEST"
RM "$DEST"
@@ -249,21 +244,18 @@ compress() {
if [[ -z ${FILES[*]} ]] ; then
# Compress stdin implies output to stdout
ZPCAT=1
- cat > "$TMP_FILE"
- if [[ $? == 0 ]] ; then
- compress_file "$TMP_FILE" "$TMP_ARCHIVE"
- [[ $? > 0 ]] && STATUS=1
- fi
+ cat > "$TMP_FILE" && {
+ compress_file "$TMP_FILE" "$TMP_ARCHIVE" || STATUS=1
+ }
else
- for f in ${FILES[@]} ; do
+ for f in "${FILES[@]}" ; do
declare DEST="${f}.zpaq"
[[ -n $ZPCAT ]] && DEST="$TMP_ARCHIVE"
if [[ -z $ZPCAT && -e $DEST && -z $FORCE ]] ; then
echo "${DEST#${BASEDIR}/} exists, skipping" 1>&2
STATUS=1
else
- compress_file "$f" "$DEST"
- [[ $? > 0 ]] && STATUS=1
+ compress_file "$f" "$DEST" || STATUS=1
fi
done
fi