Merged from trunk 6338:6344
authorFabian Groffen <grobian@gentoo.org>
Fri, 6 Apr 2007 17:45:10 +0000 (17:45 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 6 Apr 2007 17:45:10 +0000 (17:45 -0000)
   (Do the changes I did yesterday again, but then the right way)

   +------------------------------------------------------------------------+
   | 6339    | Punt the sorted_versions() function in favor of              |
   | zmedico | list.sort(vercmp).                                           |
   |---------+--------------------------------------------------------------|
   | 6341    | Don't set os.environ["USERLAND"] inside portage.data and     |
   | zmedico | rely on USERLAND from the profile instead (bail out if       |
   |         | necessary when USERLAND is unset).                           |
   |---------+--------------------------------------------------------------|
   | 6342    | Don't force OS detection in the portage.data module.         |
   | zmedico |                                                              |
   |---------+--------------------------------------------------------------|
   | 6343    | Make sure XARGS has a default value.                         |
   | zmedico |                                                              |
   |---------+--------------------------------------------------------------|
   | 6344    | Provide a default value to the getattr call.                 |
   | zmedico |                                                              |
   +------------------------------------------------------------------------+

svn path=/main/branches/prefix/; revision=6345

bin/etc-update
pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/data.py

index 1bd35a15118593bf7530e8360d51fd14ae9b6e66..d1193bd43e285ffb19fc9f7d41f84213d5f58e3a 100755 (executable)
@@ -386,7 +386,7 @@ Please select from the menu above (-1 to exit, losing this merge): "
                        my_input=$(read_int)
                        case ${my_input} in
                                1) echo "Replacing ${ofile} with ${mfile}"
-                                  if [[ ${USERLAND} == GNU ]] || [[ ${EPREFIX%/} != "" ]]; then
+                                  if [[ ${USERLAND:-GNU} == GNU ]]; then
                                       chmod --reference="${ofile}" "${mfile}"
                                   else
                                       chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}"
index 8065a5a76617bf7789c2d2a64455ba9a4c63c01c..39ad037780d43e24dee8eb1d4ff93a1a2c377e11 100644 (file)
@@ -152,32 +152,6 @@ def userquery(prompt, responses=None, colours=None):
                print "Interrupted."
                sys.exit(1)
 
-def sorted_versions(verlist):
-       ret = []
-       for ver in verlist:
-               verparts = ver.split("-")
-               if len(verparts) == 2:
-                       verrev = verparts[1][1:]
-               else:
-                       verrev = 0
-               x = 0
-               while x < len(ret):
-                       retparts = ret[x].split("-")
-                       verdiff = portage.vercmp(retparts[0], verparts[0])
-                       if verdiff > 0:
-                               break
-                       elif verdiff == 0:
-                               if len(retparts) == 2:
-                                       retrev = int(retparts[1][1:])
-                               else:
-                                       retrev = 0
-                               if retrev >= verrev:
-                                       break
-                       x += 1
-               ret.insert(x, ver)
-       return ret
-
-
 actions=[
 "clean", "config", "depclean",
 "info", "metadata",
@@ -4580,15 +4554,16 @@ def action_info(settings, trees, myopts, myfiles):
        for x in myvars:
                if portage.isvalidatom(x):
                        pkg_matches = trees["/"]["vartree"].dbapi.match(x)
+                       pkg_matches = [portage.catpkgsplit(cpv)[1:] for cpv in pkg_matches]
+                       pkg_matches.sort(portage.pkgcmp)
                        pkgs = []
-                       for y in pkg_matches:
-                               mycpv   = portage.catpkgsplit(y)
-                               if(mycpv[3] != "r0"):
-                                       pkgs += [mycpv[2] + "-" + mycpv[3]]
+                       for pn, ver, rev in pkg_matches:
+                               if rev != "r0":
+                                       pkgs.append(ver + "-" + rev)
                                else:
-                                       pkgs += [mycpv[2]]
+                                       pkgs.append(ver)
                        if pkgs:
-                               pkgs = ", ".join(sorted_versions(pkgs))
+                               pkgs = ", ".join(pkgs)
                                print "%-20s %s" % (x+":", pkgs)
                else:
                        print "%-20s %s" % (x+":", "[NOT VALID]")
@@ -5218,8 +5193,10 @@ def parse_opts(tmpcmdline, silent=False):
 def validate_ebuild_environment(trees):
        for myroot in trees:
                mysettings = trees[myroot]["vartree"].settings
-               if not mysettings.get("ARCH", None):
-                       print >> sys.stderr, bad("\a!!! ARCH is not set... " + \
+               for var in "ARCH", "USERLAND":
+                       if mysettings.get(var):
+                               continue
+                       print >> sys.stderr, bad(("\a!!! %s is not set... " % var) + \
                                "Are you missing the '%setc/make.profile' symlink?" % \
                                mysettings["PORTAGE_CONFIGROOT"])
                        print >> sys.stderr, bad("\a!!! Is the symlink correct? " + \
index 609b94a2ed927ad2bd26fd85158c0ea4f22a4f03..01c677eb868e000145b07f98e488321a9e1f4bf4 100644 (file)
@@ -915,10 +915,6 @@ class config:
 
                        # backupenv is for calculated incremental variables.
                        self.backupenv = os.environ.copy()
-                       if not local_config:
-                               # Clean up pollution from portage.data so that it doesn't
-                               # interfere with repoman.
-                               self.backupenv.pop("USERLAND", None)
 
                        def check_var_directory(varname, var):
                                if not os.path.isdir(var):
@@ -1161,10 +1157,6 @@ class config:
 
                        self.configlist.append(os.environ.copy())
                        self.configdict["env"]=self.configlist[-1]
-                       if not local_config:
-                               # Clean up pollution from portage.data so that it doesn't
-                               # interfere with repoman.
-                               self.configdict["env"].pop("USERLAND", None)
 
                        # make lookuplist for loading package.*
                        self.lookuplist=self.configlist[:]
index 8e014c145862170569e91c8e9633d8567e6f9fb3..eb33e6684727911c984a9582db9654bbf9ee7275 100644 (file)
@@ -1,22 +1,23 @@
 # data.py -- Calculated/Discovered Data Values
 # Copyright 1998-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id: portage_data.py 4530 2006-09-25 21:16:32Z zmedico $
+# $Id:$
 
 if not hasattr(__builtins__, "set"):
        from sets import Set as set
 
 import os, sys, pwd, grp
-from portage.const import wheelgid, rootuid, portageuser, portagegroup, EPREFIX
+from portage.const import wheelgid, rootuid, portageuser, portagegroup
 from portage.util import writemsg
 from portage.output import green,red
 from portage.output import create_color_func
 bad = create_color_func("BAD")
 
 ostype=os.uname()[0]
-userland="don't_use_this_thing"        # included by portage, not used
 
-lchown = None
+userland = None
+lchown = getattr(os, "lchown", None)
+os.environ.setdefault("XARGS", "xargs")
 os.environ["XARGS"]="xargs -r"
 
 # "fix" for lchown on Darwin