summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-06-29 09:09:49 +0000
committerMarius Mauch <genone@gentoo.org>2007-06-29 09:09:49 +0000
commitb892f7da1fa1943c20beed6b30de718f07dc22ff (patch)
tree970851ef476ca65ca09dc28aed94917f2fc9772f
parent97bcd87be54576841bf6c1406410eb008866f957 (diff)
downloadportage-b892f7da1fa1943c20beed6b30de718f07dc22ff.tar.gz
portage-b892f7da1fa1943c20beed6b30de718f07dc22ff.tar.bz2
portage-b892f7da1fa1943c20beed6b30de718f07dc22ff.zip
display source repository for installed package and target package (bug #67072)
svn path=/main/trunk/; revision=7089
-rw-r--r--pym/emerge/__init__.py40
-rw-r--r--pym/portage/dbapi/vartree.py2
2 files changed, 34 insertions, 8 deletions
diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py
index fefa443c4..0686ea585 100644
--- a/pym/emerge/__init__.py
+++ b/pym/emerge/__init__.py
@@ -702,7 +702,7 @@ class FakeVartree(portage.vartree):
if os.access(vdb_path, os.W_OK):
vdb_lock = portage.locks.lockdir(vdb_path)
mykeys = ["SLOT", "COUNTER", "PROVIDE", "USE", "IUSE",
- "DEPEND", "RDEPEND", "PDEPEND"]
+ "DEPEND", "RDEPEND", "PDEPEND", "repository"]
real_dbapi = real_vartree.dbapi
slot_counters = {}
for cpv in real_dbapi.cpv_all():
@@ -936,7 +936,7 @@ class depgraph(object):
self._slot_node_map = {}
self.mydbapi = {}
self._mydbapi_keys = ["SLOT", "DEPEND", "RDEPEND", "PDEPEND",
- "USE", "IUSE", "PROVIDE"]
+ "USE", "IUSE", "PROVIDE", "repository"]
self.useFlags = {}
self.trees = {}
for myroot in trees:
@@ -2801,11 +2801,35 @@ class depgraph(object):
# x = ['binary', '/', 'sys-apps/pcmcia-cs-3.2.7.2.6', 'merge']
file_name = portdb.findname(pkg_key)
if file_name: # It might not exist in the tree
+ newrepo = pkgsettings["PORTDIR"]
+ newrepoindex = "0"
+ if self.trees[x[1]]["vartree"].dbapi.cpv_exists(pkg):
+ oldrepo = self.trees[x[1]]["vartree"].dbapi.aux_get(pkg, ["repository"])[0]
+ else:
+ oldrepo = ""
+ if oldrepo != "":
+ oldrepo = portdb.getRepositoryPath(oldrepo)
dir_name=os.path.abspath(os.path.dirname(file_name)+"/../..")
- if (overlays_real.count(dir_name)>0):
- verboseadd+=teal("["+str(overlays_real.index(
- os.path.normpath(dir_name))+1)+"]")+" "
- display_overlays=True
+ if (overlays_real.count(dir_name) > 0):
+ newrepoindex = overlays_real.index(os.path.normpath(dir_name))
+ newrepo = overlays_real[newrepoindex]
+ newrepoindex += 1
+
+ # assing lookup indexes
+ if oldrepo == "":
+ oldrepoindex = "?"
+ elif oldrepo == pkgsettings["PORTDIR"]:
+ oldrepoindex = "0"
+ else:
+ oldrepoindex = str(overlays_real.index(os.path.normpath(oldrepo)) + 1)
+ if oldrepoindex == newrepoindex \
+ or not self.trees[x[1]]["vartree"].dbapi.cpv_exists(pkg):
+ repoadd = newrepoindex
+ else:
+ repoadd = "%s=>%s" % (oldrepoindex, newrepoindex)
+
+ verboseadd+=teal("[%s]" % repoadd)+" "
+ display_overlays=True
else:
verboseadd += "[No ebuild?]"
@@ -2948,11 +2972,13 @@ class depgraph(object):
print
print counters
if overlays and display_overlays:
- print "Portage overlays:"
+ print "Portage tree and overlays:"
y=0
+ print " "+teal("[0]"), self.settings["PORTDIR"]
for x in overlays:
y=y+1
print " "+teal("["+str(y)+"]"),x
+ print " "+teal("[?]"), "indicates that the source repository could not be determined"
if "--changelog" in self.myopts:
print
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index ac4edbddb..7bc2c686e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -185,7 +185,7 @@ class vardbapi(dbapi):
vartree = db[root]["vartree"]
self.vartree = vartree
self._aux_cache_keys = set(["SLOT", "COUNTER", "PROVIDE", "USE",
- "IUSE", "DEPEND", "RDEPEND", "PDEPEND", "NEEDED"])
+ "IUSE", "DEPEND", "RDEPEND", "PDEPEND", "NEEDED", "repository"])
self._aux_cache = None
self._aux_cache_version = "1"
self._aux_cache_filename = os.path.join(self.root,