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 | A=0 |
---|
19 | if [ "$1" = -A ]; then A=1; shift; fi |
---|
20 | prog="$1"; shift |
---|
21 | succ= |
---|
22 | fail= |
---|
23 | |
---|
24 | # Display a horizontal rule on stderr. |
---|
25 | hr () { |
---|
26 | for i in $(seq 60); do echo -n '═' >&2; done; echo >&2 |
---|
27 | } |
---|
28 | |
---|
29 | # Run $prog with the provided arguments, with display annotations and |
---|
30 | # success/failure tracking. |
---|
31 | t () { |
---|
32 | while true; do |
---|
33 | tput bold >&2 |
---|
34 | hr |
---|
35 | echo "Running: $prog $@" >&2 |
---|
36 | tput sgr0 >&2 |
---|
37 | if $prog "$@"; then |
---|
38 | succ=$succ\ $1 |
---|
39 | break |
---|
40 | else |
---|
41 | tput bold >&2 |
---|
42 | tput setf 4; echo -n "Failed: " >&2 |
---|
43 | tput sgr0 >&2 |
---|
44 | echo -n "$prog $@ [a/R/f] " >&2 |
---|
45 | read -r x || exit $? |
---|
46 | if [ "$x" = "a" ]; then exit 1; fi |
---|
47 | if [ "$x" = "f" ]; then fail=$fail\ $1 break; fi |
---|
48 | fi |
---|
49 | done |
---|
50 | echo >&2 |
---|
51 | } |
---|
52 | |
---|
53 | t sarge-i386 -A "$@" |
---|
54 | t dapper-amd64 -A "$@" |
---|
55 | [ $A -eq 1 ] || t dapper-i386 "$@" |
---|
56 | t edgy-amd64 -A "$@" |
---|
57 | [ $A -eq 1 ] || t edgy-i386 "$@" |
---|
58 | t etch-amd64 -A "$@" |
---|
59 | [ $A -eq 1 ] || t etch-i386 "$@" |
---|
60 | t feisty-amd64 -A "$@" |
---|
61 | [ $A -eq 1 ] || t feisty-i386 "$@" |
---|
62 | t gutsy-amd64 -A "$@" |
---|
63 | [ $A -eq 1 ] || t gutsy-i386 "$@" |
---|
64 | t lenny-amd64 -A "$@" |
---|
65 | [ $A -eq 1 ] || t lenny-i386 "$@" |
---|
66 | |
---|
67 | tput bold >&2 |
---|
68 | hr |
---|
69 | echo "Done: $prog \$dist $@" >&2 |
---|
70 | tput setf 2 >&2; echo -n "Succeeded:" >&2 |
---|
71 | tput sgr0 >&2; echo "$succ" >&2 |
---|
72 | if [ -n "$fail" ]; then |
---|
73 | tput bold >&2; tput setf 4 >&2; echo -n "Failed:" >&2 |
---|
74 | tput sgr0 >&2; echo "$fail" >&2 |
---|
75 | exit 1 |
---|
76 | fi |
---|
77 | exit 0 |
---|