def get_v(cpv): "cpv can be anything" if portage.isjustname(cpv): raise Exception('Input (%s) has no version!' % cpv) pv = portage.pkgsplit(cpv)[-2:] if pv[1] == 'r0': return pv[0] else: return '%s-%s' % (pv[0], pv[1])
def get_p(pkg): "pkg must contain at least the package name" if not portage.isjustname(pkg): return portage.catpkgsplit(pkg)[1] return portage.catsplit(pkg)[-1]