1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

package: report 'failed' if build failed

bin/package, src/cmd/INIT/package.sh:
- Make the EXIT (0) trap report failure based on $error_status
  (see d18469d6), replacing 'done' with 'failed' if it is nonzero.
- Remove extra space before 'at' in that report line.
- If we get a signal, we have to set error_status to nonzero
  manually so that the correct exit message is printed.
This commit is contained in:
Martijn Dekker 2021-12-31 08:12:55 +00:00
parent aeda350298
commit ecce82c3ca
2 changed files with 16 additions and 12 deletions

View file

@ -109,7 +109,7 @@ command=${0##*/}
case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
0123) USAGE=$'
[-?
@(#)$Id: '$command$' (ksh 93u+m) 2021-12-22 $
@(#)$Id: '$command$' (ksh 93u+m) 2021-12-31 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Contributors to https://github.com/ksh93/ksh]
@ -529,7 +529,7 @@ SEE ALSO
mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3)
IMPLEMENTATION
version package (ksh 93u+m) 2021-12-22
version package (ksh 93u+m) 2021-12-31
author Glenn Fowler <gsf@research.att.com>
author Contributors to https://github.com/ksh93/ksh
copyright (c) 1994-2012 AT&T Intellectual Property
@ -2683,13 +2683,15 @@ capture() # file command ...
: > $o
note "$action output captured in $o"
s="$command: $action start at $(date) in $INSTALLROOT"
cmd='case $error_status in 0) r=done;; *) r=failed;; esac;'
cmd=$cmd' echo "$command: $action $r at $(date) in $INSTALLROOT"'
case $quiet in
0) cmd="echo \"$command: $action done at \$(date)\" in $INSTALLROOT 2>&1 | \$TEE -a $o" ;;
*) cmd="echo \"$command: $action done at \$(date)\" in $INSTALLROOT >> $o" ;;
0) cmd="$cmd 2>&1 | \$TEE -a $o" ;;
*) cmd="$cmd >> $o" ;;
esac
trap "$cmd" 0
trap "$cmd; trap 1 0; kill -1 $$" 1
trap "$cmd; trap 2 0; kill -2 $$" 2
trap "error_status=1; $cmd; trap 1 0; kill -1 $$" 1
trap "error_status=1; $cmd; trap 2 0; kill -2 $$" 2
;;
esac
case $quiet in

View file

@ -109,7 +109,7 @@ command=${0##*/}
case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
0123) USAGE=$'
[-?
@(#)$Id: '$command$' (ksh 93u+m) 2021-12-22 $
@(#)$Id: '$command$' (ksh 93u+m) 2021-12-31 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Contributors to https://github.com/ksh93/ksh]
@ -529,7 +529,7 @@ SEE ALSO
mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3)
IMPLEMENTATION
version package (ksh 93u+m) 2021-12-22
version package (ksh 93u+m) 2021-12-31
author Glenn Fowler <gsf@research.att.com>
author Contributors to https://github.com/ksh93/ksh
copyright (c) 1994-2012 AT&T Intellectual Property
@ -2683,13 +2683,15 @@ capture() # file command ...
: > $o
note "$action output captured in $o"
s="$command: $action start at $(date) in $INSTALLROOT"
cmd='case $error_status in 0) r=done;; *) r=failed;; esac;'
cmd=$cmd' echo "$command: $action $r at $(date) in $INSTALLROOT"'
case $quiet in
0) cmd="echo \"$command: $action done at \$(date)\" in $INSTALLROOT 2>&1 | \$TEE -a $o" ;;
*) cmd="echo \"$command: $action done at \$(date)\" in $INSTALLROOT >> $o" ;;
0) cmd="$cmd 2>&1 | \$TEE -a $o" ;;
*) cmd="$cmd >> $o" ;;
esac
trap "$cmd" 0
trap "$cmd; trap 1 0; kill -1 $$" 1
trap "$cmd; trap 2 0; kill -2 $$" 2
trap "error_status=1; $cmd; trap 1 0; kill -1 $$" 1
trap "error_status=1; $cmd; trap 2 0; kill -2 $$" 2
;;
esac
case $quiet in