Lines 337-342
Link Here
|
337 |
return mydep[colon+1:] |
337 |
return mydep[colon+1:] |
338 |
return None |
338 |
return None |
339 |
|
339 |
|
|
|
340 |
def remove_slot(mydep): |
341 |
colon = mydep.rfind(":") |
342 |
if colon != -1: |
343 |
mydep = mydep[:colon] |
344 |
return mydep |
345 |
|
340 |
_invalid_atom_chars_regexp = re.compile("[()|?]") |
346 |
_invalid_atom_chars_regexp = re.compile("[()|?]") |
341 |
|
347 |
|
342 |
def isvalidatom(atom, allow_blockers=False): |
348 |
def isvalidatom(atom, allow_blockers=False): |
Lines 568-591
Link Here
|
568 |
|
574 |
|
569 |
if operator is None: |
575 |
if operator is None: |
570 |
for x in candidate_list: |
576 |
for x in candidate_list: |
571 |
xs = pkgsplit(x) |
577 |
if dep_getkey(x) != mycpv: |
572 |
if xs is None: |
|
|
573 |
xcpv = dep_getcpv(x) |
574 |
if slot is not None: |
575 |
xslot = dep_getslot(x) |
576 |
if xslot is not None and xslot != slot: |
577 |
""" This function isn't given enough information to |
578 |
reject atoms based on slot unless *both* compared atoms |
579 |
specify slots.""" |
580 |
continue |
581 |
if xcpv != mycpv: |
582 |
continue |
583 |
elif xs[0] != mycpv: |
584 |
continue |
578 |
continue |
585 |
mylist.append(x) |
579 |
mylist.append(x) |
586 |
|
580 |
|
587 |
elif operator == "=": # Exact match |
581 |
elif operator == "=": # Exact match |
588 |
mylist = [cpv for cpv in candidate_list if cpvequal(cpv, mycpv)] |
582 |
mylist = [cpv for cpv in candidate_list if \ |
|
|
583 |
cpvequal(remove_slot(cpv), mycpv)] |
589 |
|
584 |
|
590 |
elif operator == "=*": # glob match |
585 |
elif operator == "=*": # glob match |
591 |
# XXX: Nasty special casing for leading zeros |
586 |
# XXX: Nasty special casing for leading zeros |
Lines 597-603
Link Here
|
597 |
myver = "0"+myver |
592 |
myver = "0"+myver |
598 |
mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver |
593 |
mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver |
599 |
for x in candidate_list: |
594 |
for x in candidate_list: |
600 |
xs = catpkgsplit(x) |
595 |
xs = catpkgsplit(remove_slot(x)) |
601 |
myver = xs[2].lstrip("0") |
596 |
myver = xs[2].lstrip("0") |
602 |
if not myver or not myver[0].isdigit(): |
597 |
if not myver or not myver[0].isdigit(): |
603 |
myver = "0"+myver |
598 |
myver = "0"+myver |
Lines 607-613
Link Here
|
607 |
|
602 |
|
608 |
elif operator == "~": # version, any revision, match |
603 |
elif operator == "~": # version, any revision, match |
609 |
for x in candidate_list: |
604 |
for x in candidate_list: |
610 |
xs = catpkgsplit(x) |
605 |
xs = catpkgsplit(remove_slot(x)) |
611 |
if xs is None: |
606 |
if xs is None: |
612 |
raise InvalidData(x) |
607 |
raise InvalidData(x) |
613 |
if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]): |
608 |
if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]): |
Lines 620-626
Link Here
|
620 |
mysplit = ["%s/%s" % (cat, pkg), ver, rev] |
615 |
mysplit = ["%s/%s" % (cat, pkg), ver, rev] |
621 |
for x in candidate_list: |
616 |
for x in candidate_list: |
622 |
try: |
617 |
try: |
623 |
result = pkgcmp(pkgsplit(x), mysplit) |
618 |
result = pkgcmp(pkgsplit(remove_slot(x)), mysplit) |
624 |
except ValueError: # pkgcmp may return ValueError during int() conversion |
619 |
except ValueError: # pkgcmp may return ValueError during int() conversion |
625 |
writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1) |
620 |
writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1) |
626 |
raise |
621 |
raise |
Lines 643-647
Link Here
|
643 |
else: |
638 |
else: |
644 |
raise KeyError("Unknown operator: %s" % mydep) |
639 |
raise KeyError("Unknown operator: %s" % mydep) |
645 |
|
640 |
|
|
|
641 |
if slot is not None: |
642 |
candidate_list = mylist |
643 |
mylist = [] |
644 |
for x in candidate_list: |
645 |
xslot = dep_getslot(x) |
646 |
if xslot is not None and xslot != slot: |
647 |
continue |
648 |
mylist.append(x) |
649 |
|
646 |
_match_from_list_cache[cache_key] = mylist |
650 |
_match_from_list_cache[cache_key] = mylist |
647 |
return mylist |
651 |
return mylist |