Gentoo Archives: gentoo-dev

From: Aron Griffis <agriffis@×××××××.com>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] Thoughts on try()
Date: Wed, 08 Aug 2001 15:05:59
Message-Id: 20010808170511.B324443@zk3.dec.com
In Reply to: [gentoo-dev] Thoughts on try() by Aron Griffis
1 Aron Griffis wrote: [Wed Aug 8 2001, 9:41:33AM EDT]
2 > diefunc() {
3 > local funcname="$1" lineno="$2" exitcode="$3"
4 > shift 3
5 > echo &>2
6 > echo "!!! ERROR: The ebuild did not complete successfully." &>2
7 > echo "!!! Function $funcname, Line $lineno, Exitcode $exitcode" &>2
8 > echo "!!! ${*:-(no error message)}" &>2
9 > echo &>2
10 > exit 1
11 > }
12 > alias die='diefunc "$FUNCNAME" "$LINENO" "$?"'
13 > alias assert_true_or_die='_retval=$?; [ $_retval = 0 ] || \
14 > diefunc "$FUNCNAME" "$LINENO" "$_retval"'
15
16 Sorry, let me rewrite this. All the &> should be >&, also the \ should
17 be omitted from assert_true_or_die since it's in single quotes.
18
19 diefunc() {
20 local funcname="$1" lineno="$2" exitcode="$3"
21 shift 3
22 echo >&2
23 echo "!!! ERROR: The ebuild did not complete successfully." >&2
24 echo "!!! Function $funcname, Line $lineno, Exitcode $exitcode" >&2
25 echo "!!! ${*:-(no error message)}" >&2
26 echo >&2
27 exit 1
28 }
29 alias die='diefunc "$FUNCNAME" "$LINENO" "$?"'
30 alias assert_true_or_die='_retval=$?; [ $_retval = 0 ] ||
31 diefunc "$FUNCNAME" "$LINENO" "$_retval"'
32
33 That's what I get for not actually *testing* final modifications... :-|
34
35 Aron