return mylist
-
-def match_from_list_original(mydep,mylist):
- """(dep,list)
- Reduces the list down to those that fit the dep
- """
- mycpv=dep_getcpv(mydep)
- if isspecific(mycpv):
- cp_key=catpkgsplit(mycpv)
- if cp_key is None:
- return []
- else:
- cp_key=None
- #Otherwise, this is a special call; we can only select out of the ebuilds specified in the specified mylist
- if (mydep[0]=="="):
- if cp_key is None:
- return []
- if mydep[-1]=="*":
- #example: "=sys-apps/foo-1.0*"
- try:
- #now, we grab the version of our dependency...
- mynewsplit=string.split(cp_key[2],'.')
- #split it...
- mynewsplit[-1]=`int(mynewsplit[-1])+1`
- #and increment the last digit of the version by one.
- #We don't need to worry about _pre and friends because they're not supported with '*' deps.
- new_v=string.join(mynewsplit,".")+"_alpha0"
- #new_v will be used later in the code when we do our comparisons using pkgcmp()
- except SystemExit, e:
- raise
- except:
- #erp, error.
- return []
- mynodes=[]
- cmp1=cp_key[1:]
- cmp1[1]=cmp1[1]+"_alpha0"
- cmp2=[cp_key[1],new_v,"r0"]
- for x in mylist:
- cp_x=catpkgsplit(x)
- if cp_x is None:
- #hrm, invalid entry. Continue.
- continue
- #skip entries in our list that do not have matching categories
- if cp_key[0]!=cp_x[0]:
- continue
- # ok, categories match. Continue to next step.
- if ((pkgcmp(cp_x[1:],cmp1)>=0) and (pkgcmp(cp_x[1:],cmp2)<0)):
- # entry is >= the version in specified in our dependency, and <= the version in our dep + 1; add it:
- mynodes.append(x)
- return mynodes
- else:
- # Does our stripped key appear literally in our list? If so, we have a match; if not, we don't.
- if mycpv in mylist:
- return [mycpv]
- else:
- return []
- elif (mydep[0]==">") or (mydep[0]=="<"):
- if cp_key is None:
- return []
- if (len(mydep)>1) and (mydep[1]=="="):
- cmpstr=mydep[0:2]
- else:
- cmpstr=mydep[0]
- mynodes=[]
- for x in mylist:
- cp_x=catpkgsplit(x)
- if cp_x is None:
- #invalid entry; continue.
- continue
- if cp_key[0]!=cp_x[0]:
- continue
- if eval("pkgcmp(cp_x[1:],cp_key[1:])"+cmpstr+"0"):
- mynodes.append(x)
- return mynodes
- elif mydep[0]=="~":
- if cp_key is None:
- return []
- myrev=-1
- for x in mylist:
- cp_x=catpkgsplit(x)
- if cp_x is None:
- #invalid entry; continue
- continue
- if cp_key[0]!=cp_x[0]:
- continue
- if cp_key[2]!=cp_x[2]:
- #if version doesn't match, skip it
- continue
- myint = int(cp_x[3][1:])
- if myint > myrev:
- myrev = myint
- mymatch = x
- if myrev == -1:
- return []
- else:
- return [mymatch]
- elif cp_key is None:
- if mydep[0]=="!":
- return []
- #we check ! deps in emerge itself, so always returning [] is correct.
- mynodes=[]
- cp_key=mycpv.split("/")
- for x in mylist:
- cp_x=catpkgsplit(x)
- if cp_x is None:
- #invalid entry; continue
- continue
- if cp_key[0]!=cp_x[0]:
- continue
- if cp_key[1]!=cp_x[1]:
- continue
- mynodes.append(x)
- return mynodes
- else:
- return []
-
-
class portagetree:
def __init__(self, root="/", virtual=None, clone=None, settings=None):