diff options
author | Nirbheek Chauhan <nirbheek@gentoo.org> | 2011-03-28 21:44:39 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@gentoo.org> | 2011-03-28 21:44:41 +0530 |
commit | c35f4ec82c12d0f13c78b97ce9ba53907a520a0a (patch) | |
tree | f8de44549f88efabab3fb05ef2c47f3715fe51ad /scripts | |
parent | portage-configs: add xdg utils to package.keywords (diff) | |
download | gnome-c35f4ec82c12d0f13c78b97ce9ba53907a520a0a.tar.gz gnome-c35f4ec82c12d0f13c78b97ce9ba53907a520a0a.tar.bz2 gnome-c35f4ec82c12d0f13c78b97ce9ba53907a520a0a.zip |
slot_rindex.py: take care of =cat/pkg-ver* deps
Earlier, categorization was done purely on the basis of the :slot dep.
Now, =cat/pkg-ver* deps are also taken into account while generating the
slot-rdep mapping
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/slot_rindex.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py index 3ca50dca..f66b599b 100755 --- a/scripts/slot_rindex.py +++ b/scripts/slot_rindex.py @@ -122,6 +122,27 @@ def get_deps_both(cpv, depvars=DEPVARS): dep_cps.add(portage.dep.dep_getkey(dep)) return (dep_cps, dep_strs) +def get_dep_slot(dep): + """ + If the dep atom contains a slot, return that + If the dep atom doesn't contain a slot, but is of the =cat/pkg-ver* type, + check which slots each satisfied cpv has, and return that if they're all the + same; return None if they're different + """ + # FIXME: Use our own portdb so that we match atoms outside of PORTDIR too + slot = portage.dep.dep_getslot(dep) + if slot or not dep.startswith('='): + return slot + cp = portage.dep.dep_getkey(dep) + cpvrs = portage.dep.match_from_list(dep, portdb.xmatch('match-all', cp)) + for cpvr in cpvrs: + my_slot = portdb.aux_get(cpvr, ['SLOT'])[0] + if slot and my_slot != slot: + # omg, one of the slots is different + return None + slot = my_slot + return slot + def get_revdeps_rindex(key): """ Given a key, returns a reverse-dependency list of that key using the tinderbox rindex @@ -172,10 +193,10 @@ for rdep in revdeps: (cps, deps) = get_deps_both(rdep) if KEY not in cps: continue - for cpv in deps: - if cpv.find(KEY) == -1: + for dep in deps: + if dep.find(KEY) == -1: continue - slot = portage.dep.dep_getslot(cpv) + slot = get_dep_slot(dep) if not slot_rdeps.has_key(slot): slot_rdeps[slot] = [] slot_rdeps[slot].append(rdep) |