Simplify the userland detection code in portage.data and add
authorZac Medico <zmedico@gentoo.org>
Sat, 29 Dec 2007 12:07:56 +0000 (12:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 29 Dec 2007 12:07:56 +0000 (12:07 -0000)
a bash version of it to isolated-functions.sh.

svn path=/main/trunk/; revision=9100

bin/isolated-functions.sh
pym/portage/data.py

index 3290654a6723125e6a488d2e041377d7aedf3878..6feb48dd741a8bb0bb2d5bc29f9d5333ec96f38c 100755 (executable)
@@ -375,6 +375,17 @@ case "${NOCOLOR:-false}" in
                ;;
 esac
 
+if [[ -z ${USERLAND} ]] ; then
+       case $(uname -s) in
+       *BSD|DragonFly)
+               export USERLAND="BSD"
+               ;;
+       *)
+               export USERLAND="GNU"
+               ;;
+       esac
+fi
+
 if [[ -z ${XARGS} ]] ; then
        case ${USERLAND} in
        BSD|Darwin)
index 8b89f2e4fb24dda53ab52f99e30ba98368946bed..a3dbfb8853283c5b9e6cc9402fb957ff342f97a6 100644 (file)
@@ -10,18 +10,13 @@ from portage.output import create_color_func
 bad = create_color_func("BAD")
 
 ostype=os.uname()[0]
-
 userland = None
+if ostype == "DragonFly" or ostype.endswith("BSD"):
+       userland = "BSD"
+else:
+       userland = "GNU"
+
 lchown = getattr(os, "lchown", None)
-os.environ.setdefault("XARGS", "xargs")
-if ostype == "Linux" or \
-       ostype.lower().startswith("gnu") or \
-       ostype.lower().endswith("gnu"):
-       userland="GNU"
-elif ostype == "Darwin":
-       userland="Darwin"
-elif ostype.endswith("BSD") or ostype =="DragonFly":
-       userland="BSD"
 
 if not lchown:
                try: