aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-02-17 04:17:14 +0000
committerMarius Mauch <genone@gentoo.org>2007-02-17 04:17:14 +0000
commit38884a4da2d28e748af588bf5134f7691eecdba1 (patch)
treeb45d5ba15b33cb1e18d4f3ab2b73f6a40eb7a505
parentAdd support for RSYNC_EXTRA_OPTS to webrsync (diff)
downloadportage-38884a4da2d28e748af588bf5134f7691eecdba1.tar.gz
portage-38884a4da2d28e748af588bf5134f7691eecdba1.tar.bz2
portage-38884a4da2d28e748af588bf5134f7691eecdba1.zip
Print filename when displaying package.mask comments
svn path=/main/trunk/; revision=5974
-rwxr-xr-xbin/emerge5
-rw-r--r--pym/portage/__init__.py43
2 files changed, 25 insertions, 23 deletions
diff --git a/bin/emerge b/bin/emerge
index 59652958e..389c47222 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1673,9 +1673,10 @@ class depgraph:
mreasons = portage.getmaskingstatus(p,
settings=pkgsettings, portdb=portdb)
print "- "+p+" (masked by: "+", ".join(mreasons)+")"
- comment = portage.getmaskingreason(p,
- settings=pkgsettings, portdb=portdb)
+ comment, filename = portage.getmaskingreason(p,
+ settings=pkgsettings, portdb=portdb, return_location=True)
if comment and comment != oldcomment:
+ print filename+":"
print comment
oldcomment = comment
print
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 1461ce7f2..774192044 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4400,7 +4400,7 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
else:
return mykey
-def getmaskingreason(mycpv, settings=None, portdb=None):
+def getmaskingreason(mycpv, settings=None, portdb=None, return_location=False):
from portage.util import grablines
if settings is None:
settings = globals()["settings"]
@@ -4423,11 +4423,7 @@ def getmaskingreason(mycpv, settings=None, portdb=None):
locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
USER_CONFIG_PATH.lstrip(os.path.sep)))
locations.reverse()
- pmasklists = [grablines(os.path.join(x, "package.mask"), recursive=1) for x in locations]
- pmasklines = []
- while pmasklists: # stack_lists doesn't preserve order so it can't be used
- pmasklines.extend(pmasklists.pop(0))
- del pmasklists
+ pmasklists = [(x, grablines(os.path.join(x, "package.mask"), recursive=1)) for x in locations]
if settings.pmaskdict.has_key(mycp):
for x in settings.pmaskdict[mycp]:
@@ -4435,22 +4431,27 @@ def getmaskingreason(mycpv, settings=None, portdb=None):
comment = ""
l = "\n"
comment_valid = -1
- for i in xrange(len(pmasklines)):
- l = pmasklines[i].strip()
- if l == "":
- comment = ""
- comment_valid = -1
- elif l[0] == "#":
- comment += (l+"\n")
- comment_valid = i + 1
- elif l == x:
- if comment_valid != i:
+ for pmask in pmasklists:
+ pmask_filename = os.path.join(pmask[0], "package.mask")
+ for i in xrange(len(pmask[1])):
+ l = pmask[1][i].strip()
+ if l == "":
comment = ""
- return comment
- elif comment_valid != -1:
- # Apparently this comment applies to muliple masks, so
- # it remains valid until a blank line is encountered.
- comment_valid += 1
+ comment_valid = -1
+ elif l[0] == "#":
+ comment += (l+"\n")
+ comment_valid = i + 1
+ elif l == x:
+ if comment_valid != i:
+ comment = ""
+ if return_location:
+ return (comment, pmask_filename)
+ else:
+ return comment
+ elif comment_valid != -1:
+ # Apparently this comment applies to muliple masks, so
+ # it remains valid until a blank line is encountered.
+ comment_valid += 1
return None
def getmaskingstatus(mycpv, settings=None, portdb=None):