Implement nonfatal().
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Thu, 6 Aug 2009 20:48:05 +0000 (20:48 -0000)
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Thu, 6 Aug 2009 20:48:05 +0000 (20:48 -0000)
svn path=/main/trunk/; revision=13936

bin/isolated-functions.sh

index a05cffed00a83f2a73e05016fd2b65017fc24591..2bd704d7288f73616986422ac9334e19e8017c2f 100755 (executable)
@@ -53,7 +53,23 @@ dump_trace() {
        done
 }
 
+nonfatal() {
+       if has "${EAPI:-0}" 0 1 2; then
+               die "$FUNCNAME() not supported in this EAPI"
+       fi
+       if [[ $# -lt 1 ]]; then
+               die "$FUNCNAME(): Missing argument"
+       fi
+
+       PORTAGE_NONFATAL=1 "$@"
+}
+
 die() {
+       if [[ $PORTAGE_NONFATAL -eq 1 ]]; then
+               echo -e " $WARN*$NORMAL ${FUNCNAME[1]}: WARNING: $@" >&2
+               return 1
+       fi
+
        set +e
        if [ -n "${QA_INTERCEPTORS}" ] ; then
                # die was called from inside inherit. We need to clean up