|
|
|
@ -146,9 +146,9 @@ def getPkgSlot(pkg, prefix='/'):
|
|
|
|
|
for x in pkgs]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getPkgActiveUses(fullpkg):
|
|
|
|
|
def getPkgActiveUses(fullpkg, prefix="/"):
|
|
|
|
|
"""Get active uses from package"""
|
|
|
|
|
res = getPkgUses(fullpkg)
|
|
|
|
|
res = getPkgUses(fullpkg, prefix=prefix)
|
|
|
|
|
if not res:
|
|
|
|
|
return None
|
|
|
|
|
return list(set(res[0]) & set(res[1]))
|
|
|
|
@ -196,6 +196,16 @@ def getInstalledAtom(str_atom, prefix='/'):
|
|
|
|
|
continue
|
|
|
|
|
yield find_atom
|
|
|
|
|
|
|
|
|
|
def getPortagePython(prefix='/'):
|
|
|
|
|
"""
|
|
|
|
|
Получить python с которым может рабоать portage
|
|
|
|
|
"""
|
|
|
|
|
for use in getPkgActiveUses("sys-apps/portage", prefix=prefix):
|
|
|
|
|
if use.startswith("python_targets_python3"):
|
|
|
|
|
return "/usr/bin/%s" % use[15:].replace("_",".")
|
|
|
|
|
return "/usr/bin/python3"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getSquashList():
|
|
|
|
|
"""Get supprted squashfs compressions method"""
|
|
|
|
@ -1640,13 +1650,14 @@ class tbz2(object):
|
|
|
|
|
Python3 portage.xpak.tbz2 simple wrapper
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self, tbzfile):
|
|
|
|
|
self.python3 = getPortagePython()
|
|
|
|
|
self.tbzfile = tbzfile
|
|
|
|
|
|
|
|
|
|
def _escape(self, s):
|
|
|
|
|
return s.replace("'","\\'")
|
|
|
|
|
|
|
|
|
|
def decompose(self, workdir):
|
|
|
|
|
p = process('/usr/bin/python3')
|
|
|
|
|
p = process(self.python3)
|
|
|
|
|
p.write("from portage.xpak import tbz2\n"
|
|
|
|
|
"tbz2('%s').decompose('%s')" % (
|
|
|
|
|
self._escape(self.tbzfile),
|
|
|
|
@ -1656,7 +1667,7 @@ class tbz2(object):
|
|
|
|
|
raise PackageError(_("Failed to decompose %s") % self.tbzfile)
|
|
|
|
|
|
|
|
|
|
def compose(self, workdir):
|
|
|
|
|
p = process('/usr/bin/python3')
|
|
|
|
|
p = process(self.python3)
|
|
|
|
|
p.write("from portage.xpak import tbz2\n"
|
|
|
|
|
"tbz2('%s').compose('%s')" % (
|
|
|
|
|
self._escape(self.tbzfile),
|
|
|
|
|