source: trunk/debathena/scripts/da @ 25712

Revision 25712, 1.9 KB checked in by jdreed, 12 years ago (diff)
No, really, don't pass -A for Arch: any packages
  • 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
26if [ $A -eq 1 ] && \
27    [ "${DA_SHOOT_SELF_IN_FOOT:-x}" != "yesplease" ]; then
28    for i in "$@"; do
29        if echo "$i" | grep -q '\.dsc$' && \
30            grep -Fqx 'Architecture: any' "$i"; then
31            echo "ERROR: Won't build an 'Architecture: any' package with -A" >&2
32            exit 1
33        fi
34    done
35fi
36exit 0
37
38# Display a horizontal rule on stderr.
39hr () {
40    for i in $(seq 60); do echo -n '═' >&2; done; echo >&2
41}
42
43# Run $prog with the provided arguments, with display annotations and
44# success/failure tracking.
45t () {
46    while true; do
47        tput bold >&2
48        hr
49        echo "Running: $prog $@" >&2
50        tput sgr0 >&2
51        if $prog "$@"; then
52            succ=$succ\ $1
53            break
54        else
55            tput bold >&2
56            tput setf 4; echo -n "Failed: " >&2
57            tput sgr0 >&2
58            echo -n "$prog $@ [a/R/f] " >&2
59            read -r x || exit $?
60            if [ "$x" = "a" ]; then exit 1; fi
61            if [ "$x" = "f" ]; then fail=$fail\ $1 break; fi
62        fi
63    done
64    echo >&2
65}
66
67for code in $DEBIAN_CODES; do
68    t "$code"-amd64 -A "$@"
69    [ $A -eq 1 ] || t "$code"-i386 "$@"
70done
71
72tput bold >&2
73hr
74echo "Done: $prog \$dist $@" >&2
75tput setf 2 >&2; echo -n "Succeeded:" >&2
76tput sgr0 >&2; echo "$succ" >&2
77if [ -n "$fail" ]; then
78    tput bold >&2; tput setf 4 >&2; echo -n "Failed:" >&2
79    tput sgr0 >&2; echo "$fail" >&2
80    exit 1
81fi
82exit 0
Note: See TracBrowser for help on using the repository browser.