diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-10-05 05:24:42 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-10-05 05:24:42 +0000 |
commit | 02bc22df9ab2f5b40547d3aa4362247deeb98d80 (patch) | |
tree | c11408da6f14de44113b2be1342f3555b250ca34 /pym/portage_dep.py | |
parent | 58559fb4ae65e6a8f367a735e533edb03dc16d11 (diff) | |
download | portage-02bc22df9ab2f5b40547d3aa4362247deeb98d80.tar.gz portage-02bc22df9ab2f5b40547d3aa4362247deeb98d80.tar.bz2 portage-02bc22df9ab2f5b40547d3aa4362247deeb98d80.zip |
Add support for slot based dep matching in all dbapi derived classes. The supported syntax is ${CATEGORY}/${PN}:${SLOT} (identical to that used by paludis and pkgcore).
svn path=/main/trunk/; revision=4594
Diffstat (limited to 'pym/portage_dep.py')
-rw-r--r-- | pym/portage_dep.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 1f20b8ac3..af4a72501 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -195,8 +195,17 @@ def dep_getcpv(mydep): mydep = mydep[2:] elif mydep[:1] in "=<>~": mydep = mydep[1:] + colon = mydep.rfind(":") + if colon != -1: + return mydep[:colon] return mydep +def dep_getslot(mydep): + colon = mydep.rfind(":") + if colon != -1: + return mydep[colon+1:] + return None + def isvalidatom(atom): mycpv_cps = catpkgsplit(dep_getcpv(atom)) operator = get_operator(atom) @@ -283,11 +292,13 @@ def match_from_list(mydep, candidate_list): mycpv = dep_getcpv(mydep) mycpv_cps = catpkgsplit(mycpv) # Can be None if not specific + slot = None if not mycpv_cps: cat, pkg = catsplit(mycpv) ver = None rev = None + slot = dep_getslot(mydep) else: cat, pkg, ver, rev = mycpv_cps if mydep == mycpv: @@ -308,7 +319,15 @@ def match_from_list(mydep, candidate_list): for x in candidate_list: xs = pkgsplit(x) if xs is None: - if x != mycpv: + xcpv = dep_getcpv(x) + if slot is not None: + xslot = dep_getslot(x) + if xslot is not None and xslot != slot: + """ This function isn't given enough information to + reject atoms based on slot unless *both* compared atoms + specify slots.""" + continue + if xcpv != mycpv: continue elif xs[0] != mycpv: continue |