From a9fc3539622164f1470fe4eb853aef0d6cc1a1c3 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 5 Feb 2007 19:05:36 +0000 Subject: [PATCH] Merged from trunk 5885:5891 Fix "UnboundLocalError: local variable 'portage' referenced before assignment" caused by a local import hiding a global import (undid changeset 5884:5885 for this) For bug #165349, use the portage_versions regex (via pkgsplit) instead of the incompatible ones that repoman currently uses. Document --config-root for bug #165334. For bug #165382, don't raise a ValueError in cpv_expand() if there are only two matches and one of them is a virtual. Prefer the non-virtual instead. Ensure that the code for bug #165342 only affects name collisions with virtuals. svn path=/main/branches/prefix/; revision=5892 --- bin/emerge | 5 +++-- man/emerge.1 | 9 +++++++-- pym/portage/__init__.py | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/bin/emerge b/bin/emerge index cb9b89b20..24a624a34 100755 --- a/bin/emerge +++ b/bin/emerge @@ -45,7 +45,6 @@ import portage.dep import portage.util import portage.locks import portage.exception -import portage.cache.util from portage.const import EPREFIX from portage.data import secpass from portage.util import normalize_path as normpath @@ -4129,7 +4128,9 @@ def action_metadata(settings, portdb, myopts): cm = settings.load_best_module("portdbapi.metadbmodule")( myportdir, "metadata/cache", portage.auxdbkeys[:]) - class percentage_noise_maker(portage.cache.util.quiet_mirroring): + from portage.cache import util + + class percentage_noise_maker(util.quiet_mirroring): def __init__(self, dbapi): self.dbapi = dbapi self.cp_all = dbapi.cp_all() diff --git a/man/emerge.1 b/man/emerge.1 index 671ca4d24..71dc1e49c 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -232,6 +232,9 @@ is not a tty (by default, color is disabled unless stdout is a tty). Used alongside \fB\-\-pretend\fR to cause the package name, new version, and old version to be displayed in an aligned format for easy cut\-n\-paste. .TP +.BR \-\-config\-root=DIR +Set the \fBPORTAGE_CONFIGROOT\fR environment variable. +.TP .BR "\-\-debug " (\fB\-d\fR) Tells emerge to run the emerge command in \fB\-\-debug\fR mode. In this mode the bash build environment will run with the \-x option, causing @@ -397,14 +400,16 @@ command line. .TP \fBROOT\fR = \fI[path]\fR Use \fBROOT\fR to specify the target root filesystem to be used for -merging packages or ebuilds. +merging packages or ebuilds. This variable can be set in \fBmake.conf\fR(5) +when \fBPORTAGE_CONFIGROOT\fR has a value other than /. .br Defaults to /. .TP \fBPORTAGE_CONFIGROOT\fR = \fI[path]\fR Use \fBPORTAGE_CONFIGROOT\fR to specify the location for various portage configuration files -(see \fBFILES\fR for a detailed list of configuration files). +(see \fBFILES\fR for a detailed list of configuration files). This variable +can be set via the \fB\-\-config\-root\fR option. .br Defaults to /. .SH "OUTPUT" diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a91fccff0..f8e65cb84 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4454,8 +4454,20 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None): for x in settings.categories: if mydb.cp_list(x+"/"+myp,use_cache=use_cache): matches.append(x+"/"+myp) - if (len(matches)>1): - raise ValueError, matches + if len(matches) > 1: + virtual_name_collision = False + if len(matches) == 2: + for x in matches: + if not x.startswith("virtual/"): + # Assume that the non-virtual is desired. This helps + # avoid the ValueError for invalid deps that come from + # installed packages (during reverse blocker detection, + # for example). + mykey = x + else: + virtual_name_collision = True + if not virtual_name_collision: + raise ValueError, matches elif matches: mykey=matches[0] -- 2.26.2