summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-31 09:17:07 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-31 09:17:07 +0000
commit85c6b18a55fef178328dd7f8fbd1f271bf5e24c3 (patch)
tree817e7c0a96c89e33762da6eed3f5f55cbc9d465a /pym
parentfecc6af2264ea2d62121bc545fe7817c26956058 (diff)
downloadportage-85c6b18a55fef178328dd7f8fbd1f271bf5e24c3.tar.gz
portage-85c6b18a55fef178328dd7f8fbd1f271bf5e24c3.tar.bz2
portage-85c6b18a55fef178328dd7f8fbd1f271bf5e24c3.zip
* Tweak isvalidatom() to treat "null" category as valid, but missing category
as invalid (previously both where treated as invalid). * Fix a spot inside emerge's unmerge() function that sometimes generates invalid atoms by adding an unnecessary "=" to the front. Even when in cases that resulted in a valid atom here, adding the "=" was redundant because dep_expand() does that automatically now (for backward compat). (trunk r10516) svn path=/main/branches/2.1.2/; revision=10517
Diffstat (limited to 'pym')
-rw-r--r--pym/portage_dep.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index 44878e913..1e65b7e24 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -433,19 +433,30 @@ def isvalidatom(atom, allow_blockers=False):
if allow_blockers and atom.startswith("!"):
atom = atom[1:]
cpv = dep_getcpv(atom)
+ cpv_catsplit = catsplit(cpv)
+ mycpv_cps = None
if cpv:
- if _valid_category.match(catsplit(cpv)[0]) is None:
- return 0
- mycpv_cps = catpkgsplit(cpv)
- else:
- mycpv_cps = None
+ if len(cpv_catsplit) == 2:
+ if _valid_category.match(cpv_catsplit[0]) is None:
+ return 0
+ if cpv_catsplit[0] == "null":
+ # "null" category is valid, missing category is not.
+ mycpv_cps = catpkgsplit(cpv.replace("null/", "cat/", 1))
+ if mycpv_cps:
+ mycpv_cps[0] = "null"
+ if not mycpv_cps:
+ mycpv_cps = catpkgsplit(cpv)
+
operator = get_operator(atom)
if operator:
if operator[0] in "<>" and remove_slot(atom).endswith("*"):
return 0
- if mycpv_cps and mycpv_cps[0] != "null":
- # >=cat/pkg-1.0
- return 1
+ if mycpv_cps:
+ if len(cpv_catsplit) == 2:
+ # >=cat/pkg-1.0
+ return 1
+ else:
+ return 0
else:
# >=cat/pkg or >=pkg-1.0 (no category)
return 0
@@ -453,7 +464,7 @@ def isvalidatom(atom, allow_blockers=False):
# cat/pkg-1.0
return 0
- if (len(atom.split('/')) == 2):
+ if len(cpv_catsplit) == 2:
# cat/pkg
return 1
else: