From 3122fec4c7a2d86937ba93cbe16bbbec422458c9 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 6 Apr 2007 17:45:10 +0000 Subject: [PATCH] Merged from trunk 6338:6344 (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 | 2 +- pym/emerge/__init__.py | 45 ++++++++++------------------------------- pym/portage/__init__.py | 8 -------- pym/portage/data.py | 9 +++++---- 4 files changed, 17 insertions(+), 47 deletions(-) diff --git a/bin/etc-update b/bin/etc-update index 1bd35a151..d1193bd43 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -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}" diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 8065a5a76..39ad03778 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -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? " + \ diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 609b94a2e..01c677eb8 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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[:] diff --git a/pym/portage/data.py b/pym/portage/data.py index 8e014c145..eb33e6684 100644 --- a/pym/portage/data.py +++ b/pym/portage/data.py @@ -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 -- 2.26.2