Add NOCOLOR support to ebuild.sh and make emerge automatically add NOCOLOR to portage...
authorZac Medico <zmedico@gentoo.org>
Sun, 19 Mar 2006 06:14:31 +0000 (06:14 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 19 Mar 2006 06:14:31 +0000 (06:14 -0000)
svn path=/main/trunk/; revision=2952

bin/ebuild.sh
bin/emerge

index 40c788a8835725948464e456a4ceb4d4d4016db6..791625c6d8d12d49e81999588434404e36c68afa 100755 (executable)
@@ -51,8 +51,16 @@ export PATH="/sbin:/usr/sbin:/usr/lib/portage/bin:/bin:/usr/bin:${ROOTPATH}"
 [ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH"
 
 source /usr/lib/portage/bin/isolated-functions.sh  &>/dev/null
-# TODO: make this conditional on config settings, fix any remaining stuff
-set_colors
+
+case "${NOCOLOR:-false}" in
+       yes|true)
+               unset_colors
+               ;;
+       no|false)
+               set_colors
+               ;;
+esac
+
 
 # the sandbox is disabled by default except when overridden in the relevant stages
 export SANDBOX_ON="0"
index b1e103c62a548370452ceb03632fb8262762fb65..a3c256ca625ea85291c2ba1d52d74ee1d31f3c85 100755 (executable)
@@ -408,8 +408,14 @@ if ("--resume" in myopts):
                myopts.remove("--tree")
 
 # Set color output
-if ("--nocolor" in myopts) and (sys.stdout.isatty()):
+if "--nocolor" in myopts or \
+portage.settings["NOCOLOR"] in ("yes","true"):
        nocolor()
+       if "NOCOLOR" not in portage.settings:
+               portage.settings.unlock()
+               portage.settings["NOCOLOR"] = "true"
+               portage.settings.backup_changes("NOCOLOR")
+               portage.settings.lock()
 
 if not ("--quiet" in myopts):
        if not sys.stdout.isatty() or ("--nospinner" in myopts):