Entropy:
- if tarfile module is not available, unse old tar.bz2 uncompress function - do not use os.system() to spawn fixpackages but use portage library directly git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1924 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -486,10 +486,13 @@ class etpDatabase:
|
||||
header = darkred(" * ")
|
||||
)
|
||||
if self.clientDatabase:
|
||||
myroot = etpConst['systemroot']+"/"
|
||||
os.system("fixpackages &> /dev/null")
|
||||
try:
|
||||
Spm = self.ServiceInterface.Spm()
|
||||
Spm.run_fixpackages()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
os.system("fixpackages")
|
||||
self.ServiceInterface.SpmService.run_fixpackages()
|
||||
|
||||
quickpkg_atoms = set()
|
||||
for action in actions:
|
||||
|
||||
@@ -9468,6 +9468,17 @@ class PortageInterface:
|
||||
import portage.const as portage_const
|
||||
self.portage_const = portage_const
|
||||
|
||||
def run_fixpackages(self, myroot = None):
|
||||
if myroot == None:
|
||||
myroot = etpConst['systemroot']+"/"
|
||||
mydb = {}
|
||||
mydb[myroot] = {}
|
||||
mydb[myroot]['vartree'] = self._get_portage_vartree(myroot)
|
||||
mydb[myroot]['porttree'] = self._get_portage_portagetree(myroot)
|
||||
mydb[myroot]['bintree'] = self._get_portage_binarytree(myroot)
|
||||
mydb[myroot]['virtuals'] = self.portage.settings.getvirtuals(myroot)
|
||||
self.portage._global_updates(mydb, {}) # always force
|
||||
|
||||
def get_third_party_mirrors(self, mirrorname):
|
||||
x = []
|
||||
if self.portage.thirdpartymirrors.has_key(mirrorname):
|
||||
@@ -9556,6 +9567,37 @@ class PortageInterface:
|
||||
etpConst['spm']['cache']['portage']['vartree'][root] = mytree
|
||||
return mytree
|
||||
|
||||
def _get_portage_portagetree(self, root):
|
||||
|
||||
if not etpConst['spm']['cache'].has_key('portage'):
|
||||
etpConst['spm']['cache']['portage'] = {}
|
||||
if not etpConst['spm']['cache']['portage'].has_key('portagetree'):
|
||||
etpConst['spm']['cache']['portage']['portagetree'] = {}
|
||||
|
||||
cached = etpConst['spm']['cache']['portage']['portagetree'].get(root)
|
||||
if cached != None:
|
||||
return cached
|
||||
|
||||
mytree = self.portage.portagetree(root=root)
|
||||
etpConst['spm']['cache']['portage']['portagetree'][root] = mytree
|
||||
return mytree
|
||||
|
||||
def _get_portage_binarytree(self, root):
|
||||
|
||||
if not etpConst['spm']['cache'].has_key('portage'):
|
||||
etpConst['spm']['cache']['portage'] = {}
|
||||
if not etpConst['spm']['cache']['portage'].has_key('binarytree'):
|
||||
etpConst['spm']['cache']['portage']['binarytree'] = {}
|
||||
|
||||
cached = etpConst['spm']['cache']['portage']['binarytree'].get(root)
|
||||
if cached != None:
|
||||
return cached
|
||||
|
||||
pkgdir = root+self.portage.settings['PKGDIR']
|
||||
mytree = self.portage.binarytree(root,pkgdir)
|
||||
etpConst['spm']['cache']['portage']['binarytree'][root] = mytree
|
||||
return mytree
|
||||
|
||||
def _get_portage_config(self, config_root, root):
|
||||
|
||||
if not etpConst['spm']['cache'].has_key('portage'):
|
||||
|
||||
@@ -1309,15 +1309,19 @@ def spawnFunction(f, *args, **kwds):
|
||||
# tar* uncompress function...
|
||||
def uncompressTarBz2(filepath, extractPath = None, catchEmpty = False):
|
||||
|
||||
import tarfile
|
||||
|
||||
if extractPath is None:
|
||||
extractPath = os.path.dirname(filepath)
|
||||
if not os.path.isfile(filepath):
|
||||
raise exceptionTools.FileNotFound('archive does not exist')
|
||||
|
||||
_tarfile = True
|
||||
try:
|
||||
import tarfile
|
||||
except ImportError:
|
||||
_tarfile = False
|
||||
|
||||
### XXX dirty bastard workaround for buggy python2.4's tarfile
|
||||
if sys.version[:3] == "2.4":
|
||||
if sys.version[:3] == "2.4" or not _tarfile:
|
||||
rc = compat_uncompressTarBz2(filepath, extractPath)
|
||||
return rc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user