"""Calls pkgsplit on a cpv and returns only the cp."""
return pkgsplit(mycpv)[0]
-def dep_opconvert(mysplit,myuse,mysettings):
- "Does dependency operator conversion"
-
- mypos=0
- newsplit=[]
- while mypos<len(mysplit):
- if isinstance(mysplit[mypos], list):
- newsplit.append(dep_opconvert(mysplit[mypos],myuse,mysettings))
- mypos += 1
- elif mysplit[mypos]==")":
- #mismatched paren, error
- return None
- elif mysplit[mypos]=="||":
- if mypos + 1 >= len(mysplit) or not isinstance(mysplit[mypos+1], list):
- # || must be followed by paren'd list
- return None
- try:
- mynew=dep_opconvert(mysplit[mypos+1],myuse,mysettings)
- except SystemExit, e:
- raise
- except Exception, e:
- print "!!! Unable to satisfy OR dependency:",string.join(mysplit," || ")
- raise e
- mynew[0:0]=["||"]
- newsplit.append(mynew)
- mypos += 2
- elif mysplit[mypos][-1]=="?":
- #uses clause, i.e "gnome? ( foo bar )"
- #this is a quick and dirty hack so that repoman can enable all USE vars:
- if (len(myuse)==1) and (myuse[0]=="*") and mysettings:
- # enable it even if it's ! (for repoman) but kill it if it's
- # an arch variable that isn't for this arch. XXX Sparc64?
- k=mysplit[mypos][:-1]
- if k[0]=="!":
- k=k[1:]
- if k not in archlist and k not in mysettings.usemask:
- enabled=1
- elif k in archlist:
- if k==mysettings["ARCH"]:
- if mysplit[mypos][0]=="!":
- enabled=0
- else:
- enabled=1
- elif mysplit[mypos][0]=="!":
- enabled=1
- else:
- enabled=0
- else:
- enabled=0
- else:
- if mysplit[mypos][0]=="!":
- myusevar=mysplit[mypos][1:-1]
- if myusevar in myuse:
- enabled=0
- else:
- enabled=1
- else:
- myusevar=mysplit[mypos][:-1]
- if myusevar in myuse:
- enabled=1
- else:
- enabled=0
- if (mypos+2<len(mysplit)) and (mysplit[mypos+2]==":"):
- #colon mode
- if enabled:
- #choose the first option
- if isinstance(mysplit[mypos + 1], list):
- newsplit.append(dep_opconvert(mysplit[mypos+1],myuse,mysettings))
- else:
- newsplit.append(mysplit[mypos+1])
- else:
- #choose the alternate option
- if isinstance(mysplit[mypos + 1], list):
- newsplit.append(dep_opconvert(mysplit[mypos+3],myuse,mysettings))
- else:
- newsplit.append(mysplit[mypos+3])
- mypos += 4
- else:
- #normal use mode
- if enabled:
- if isinstance(mysplit[mypos + 1], list):
- newsplit.append(dep_opconvert(mysplit[mypos+1],myuse,mysettings))
- else:
- newsplit.append(mysplit[mypos+1])
- #otherwise, continue.
- mypos += 2
- else:
- #normal item
- newsplit.append(mysplit[mypos])
- mypos += 1
- return newsplit
def dep_virtual(mysplit, mysettings):
"Does virtual dependency conversion"