source: trunk/debathena/scripts/da @ 22748

Revision 22748, 1.7 KB checked in by ghudson, 16 years ago (diff)
Fixes for r22739. * debathena/scripts/da, debathena/scripts/daequivsupload, debathena/scripts/daupload-release, debathena/scripts/all-schroots: Use "." instead of "source". The latter is a csh-ism and will not work in /bin/sh on (at least) Gutsy. debathena/scripts/sbuildhack, debathena/scripts/SbuildHack.pm: Pass the NMU tag in as an environment variable, since the useful value of $0 is long gone by the time we execute a shell command inside the sbuild perl script, making it hard to find debian-versions.sh.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Usage: da [-A] PROGRAM ARGUMENTS
4
5# Runs PROGRAM over each of the build schroot names, like so:
6#
7#   PROGRAM SCHROOTNAME ARGUMENTS
8#
9# On one architecture of each Debian/Ubuntu version, passes the -A
10# option before ARGUMENTS.  If -A is passed to this script, the
11# program only gets run over one schroot per Debian/Ubuntu version.
12# At the end of the run, the script will display which schroots the
13# command succeeded and failed for.
14
15# Typically this script is used to build Debathena packages, in which
16# case PROGRAM is sbuildhack and ARGUMENTS is a path to a .dsc file.
17
18. $(dirname "$0")/debian-versions.sh
19
20A=0
21if [ "$1" = -A ]; then A=1; shift; fi
22prog="$1"; shift
23succ=
24fail=
25
26# Display a horizontal rule on stderr.
27hr () {
28    for i in $(seq 60); do echo -n '═' >&2; done; echo >&2
29}
30
31# Run $prog with the provided arguments, with display annotations and
32# success/failure tracking.
33t () {
34    while true; do
35        tput bold >&2
36        hr
37        echo "Running: $prog $@" >&2
38        tput sgr0 >&2
39        if $prog "$@"; then
40            succ=$succ\ $1
41            break
42        else
43            tput bold >&2
44            tput setf 4; echo -n "Failed: " >&2
45            tput sgr0 >&2
46            echo -n "$prog $@ [a/R/f] " >&2
47            read -r x || exit $?
48            if [ "$x" = "a" ]; then exit 1; fi
49            if [ "$x" = "f" ]; then fail=$fail\ $1 break; fi
50        fi
51    done
52    echo >&2
53}
54
55for code in $DEBIAN_CODES; do
56    if [ "$code" = "sarge" ]; then
57        t sarge-i386 -A "$@"
58        continue
59    fi
60    t "$code"-amd64 -A "$@"
61    [ $A -eq 1 ] || t "$code"-i386 "$@"
62done
63
64tput bold >&2
65hr
66echo "Done: $prog \$dist $@" >&2
67tput setf 2 >&2; echo -n "Succeeded:" >&2
68tput sgr0 >&2; echo "$succ" >&2
69if [ -n "$fail" ]; then
70    tput bold >&2; tput setf 4 >&2; echo -n "Failed:" >&2
71    tput sgr0 >&2; echo "$fail" >&2
72    exit 1
73fi
74exit 0
Note: See TracBrowser for help on using the repository browser.