bin/mdw-build, etc.: Add option to suppress tests during Debian build.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 19 Jun 2020 08:40:23 +0000 (09:40 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 19 Jun 2020 09:17:38 +0000 (10:17 +0100)
bin/mdw-build
bin/mdw-sbuild
bin/mdw-sbuild-server

index e31561d..eff2c00 100755 (executable)
@@ -84,6 +84,7 @@ default_depends () {
 : ${vpath=yes}
 : ${native=yes}
 : ${make=make}
+: ${test=yes}
 default_depends sbuild sbuildsrv
 default_depends sign signkey
 default_depends upload uploadpath
@@ -112,6 +113,7 @@ Build options:
   [no]vpath
   [no]sbuild[=SERVER]
   [no]sign[=KEYID]
+  [no]test
   [no]native
   make=MAKE
 EOF
@@ -155,11 +157,11 @@ for opt; do
     dput=*)    dput=yes dputtarget=${opt#*=} ;;
     make=*)    make=${opt#*=} ;;
 
-    distcheck | debian | clean | vpath | native)
+    distcheck | debian | clean | vpath | native | test)
       eval "$opt=yes"
       ;;
     nocheckout | nosetup | nodistcheck | nodebian | \
-      noupload | nodput | noclean | novpath | nonative | \
+      noupload | nodput | noclean | novpath | nonative | notest | \
       nosbuild | nosign )
       eval "${opt#no}=no"
       ;;
@@ -176,6 +178,7 @@ set -- $DEB_BUILD_OPTIONS
 for opt; do
   case "$opt" in
     parallel=*) jobs=${opt#*=} ;;
+    nocheck) test=no ;;
   esac
 done
 
@@ -242,6 +245,17 @@ yesno () {
 ###--------------------------------------------------------------------------
 ### Do the building.
 
+## Some preflight checks.
+case $test,$build in
+  no,release) fail "refusing to make release build without testing" ;;
+esac
+case $test,$distcheck in
+  no,yes)
+    info "forcing \`distcheck' off because tsting disabled"
+    distcheck=no
+    ;;
+esac
+
 ## Find the top-level package directory.
 while [ ! -f configure.ac -a ! -f configure.in -a \
        ! -f .links -a ! -d .git ]; do
@@ -444,6 +458,13 @@ EOF
        fi
        ;;
     esac
+    case "$sbuild,$test, $DEB_BUILD_OPTIONS " in
+      yes,no,*) sbuildargs="-T $sbuildargs" ;;
+      *" nocheck "*) ;;
+      no,no,*)
+       DEB_BUILD_OPTIONS=${DEB_BUILD_OPTIONS+"$DEB_BUILD_OPTIONS nocheck"}
+       ;;
+    esac
     case $sbuild,$build,$sign in
       yes,*) run mdw-sbuild $sbuildargs ;;
       no,release,yes) run dpkg-buildpackage -k$signkey ;;
index c32c555..9a9a9d0 100755 (executable)
@@ -27,7 +27,7 @@
 prog=${0##*/}
 
 fail () { echo >&2 "$prog: $*"; exit 1; }
-usage () { echo "usage: $prog [-ain] [-k KEYID] [-p DIR] [-t TARGET] [-A DBPARGS] HOST"; }
+usage () { echo "usage: $prog [-ainT] [-k KEYID] [-p DIR] [-t TARGET] [-A DBPARGS] HOST"; }
 fail_usage () { usage >&2; exit 1; }
 
 ###--------------------------------------------------------------------------
@@ -35,7 +35,7 @@ fail_usage () { usage >&2; exit 1; }
 
 bogusp=nil noactp=nil signp=nil
 unset buildopts pkgs dbpargs
-while getopts "haik:np:t:A:" opt; do
+while getopts "haik:np:t:A:T" opt; do
   case $opt in
     h)
       usage
@@ -50,6 +50,7 @@ Options:
        -p DIR          Upload additional packages from DIR.
        -t TARGET       Build in TARGET build environment.
        -A ARGS         Pass ARGS to \`dpkg-buildpackage'.
+       -T              Don't run the tests.
 EOF
       exit 0
       ;;
@@ -63,6 +64,7 @@ EOF
       buildopts="${buildopts+$buildopts }-A$OPTARG"
       dbpargs="${dbpargs+$dbpargs }$OPTARG"
       ;;
+    T) buildopts="${buildopts+$buildopts }-T" ;;
     *) bogusp=t ;;
   esac
 done
index ca76705..b9872bd 100755 (executable)
@@ -41,7 +41,7 @@ done
 prog=${0##*/}
 
 fail () { echo >&2 "$prog: $*"; exit 1; }
-usage () { echo "usage: $prog [-aikn] [-t TARGET] [-A DBPARGS] COMMAND [ARGUMENTS ...]"; }
+usage () { echo "usage: $prog [-aiknT] [-t TARGET] [-A DBPARGS] COMMAND [ARGUMENTS ...]"; }
 fail_usage () { usage >&2; exit 1; }
 
 want_1 () {
@@ -76,7 +76,7 @@ decor () {
 bogusp=nil archp=nil indepp=nil keepon=nil notreally=nil
 unset targets dbpargs
 
-while getopts "haint:A:" opt; do
+while getopts "haint:A:T" opt; do
   case $opt in
     h)
       usage
@@ -90,6 +90,7 @@ Options:
        -n              Don't actually do the build.
        -t TARGET       Build in TARGET build environment.
        -A ARGS         Pass ARGS to \`dpkg-buildpackage'.
+       -T              Don't run the tests.
 
 Commands available:
 
@@ -110,6 +111,12 @@ EOF
     n) notreally=t ;;
     t) targets="${targets+$targets }$OPTARG" ;;
     A) dbpargs="${dbpargs+$dbpargs }$OPTARG" ;;
+    T)
+      case " $DEB_BUILD_OPTIONS " in
+       *" nocheck "*) ;;
+       *) DEB_BUILD_OPTIONS=${DEB_BUILD_OPTIONS+"$DEB_BUILD_OPTIONS "} nocheck ;;
+      esac
+      ;;
     *) bogusp=nil ;;
   esac
 done