Change exclude portage algorithm.

master
Mike Hiretsky 13 years ago
parent 7e617a9ab7
commit 260e96f398

@ -212,38 +212,6 @@ class cl_builder(color_print):
removeKernelSources)
self.printByResult(True)
def restorePortageTree(self,distrPath):
"""Move {distrPath}/usr/portage/EXCLUDE/* to /usr/portage/"""
try:
portagePath = pathJoin(distrPath,'usr/portage')
excludeDir = pathJoin(portagePath,"EXCLUDE")
if path.exists(excludeDir):
mvList = listDirectory(excludeDir)
for obj in mvList:
os.rename(pathJoin(excludeDir,obj),
pathJoin(portagePath,obj))
os.rmdir(excludeDir)
except OSError,e:
return False
return True
def movePortageTree(self,distrPath):
"""Move {distrPath}/usr/portage/* to /usr/portage/EXCLUDE"""
try:
portagePath = pathJoin(distrPath,'usr/portage')
excludeDir = pathJoin(portagePath,"EXCLUDE")
if not path.exists(excludeDir):
os.makedirs(excludeDir)
mvList = filter(lambda x: not x in
('eclass','licenses','profiles','EXCLUDE'),
listDirectory(portagePath))
for obj in mvList:
os.rename(pathJoin(portagePath,obj),
pathJoin(excludeDir,obj))
except OSError,e:
raise BuilderError(_("Can not remove portage tree: %s\n")%e)
def prepareSourceDistributive(self,distr):
"""Unmount all bind,proc mount points from source distribute"""
mp = self.clVars.Get('cl_builder_path')
@ -263,11 +231,6 @@ class cl_builder(color_print):
updateLayman = self.runChroot(distrPath,"layman -s calculate")
self.printByResult(updateLayman.success())
# move portage to EXCLUDE directory
if self.clVars.Get('cl_builder_tree') == 'off':
self.printMessageForTest(_("Removing portage tree"))
self.movePortageTree(distrPath)
self.applyTemplatesForSquash(distrPath)
# change make.profile
builderPath = self.clVars.Get('cl_builder_path')
@ -459,6 +422,16 @@ class cl_builder(color_print):
return False
return True
def _excludeList(self,sourceDirectory):
"""Get list for portage exclude by 'cl_builder_tree'"""
if self.clVars.Get('cl_builder_tree') == 'off':
portagePath = pathJoin(sourceDirectory,"usr/portage")
return map(lambda x: path.join("usr/portage",x),
filter(lambda x: not x in ( "eclass", "licenses", "profiles"),
listDirectory(portagePath)))
else:
return []
def _isoLogic(self,force):
isoFile = self.clVars.Get('cl_builder_image')
buildDirectory = self.clVars.Get('cl_builder_iso_path')
@ -468,7 +441,9 @@ class cl_builder(color_print):
self.printInfo()
if not self.checkVariables():
return False
self.targetDistr = IsoDistributive(isoFile,bdirectory=buildDirectory)
excludeList = self._excludeList(sourceDirectory)
self.targetDistr = IsoDistributive(isoFile,bdirectory=buildDirectory,
exclude=excludeList)
self.sourceDistr = DirectoryDistributive(sourceDirectory,
mdirectory=bindDirectory)
if not force:
@ -542,8 +517,10 @@ class cl_builder(color_print):
self.printRescratchInfo()
if not self.checkVariables(rescratch=True):
return False
excludeList = self._excludeList(sourceDirectory)
self.targetDistr = IsoDistributive(buildDirectory,
bdirectory=buildDirectory)
bdirectory=buildDirectory,
exclude=excludeList)
self.sourceDistr = DirectoryDistributive(sourceDirectory,
mdirectory=bindDirectory)
if not force:
@ -606,10 +583,6 @@ class cl_builder(color_print):
if self.clTempl:
self.clTempl.closeFiles()
if self.sourceDistr:
if self.clVars.Get('cl_builder_tree') == 'off':
self.printMessageForTest(_("Restoring portage tree"))
distrPath = self.sourceDistr.convertToDirectory().getDirectory()
self.printByResult(self.restorePortageTree(distrPath))
self.printMessageForTest(_("Releasing source data"))
self.sourceDistr.close()
self.printByResult(True)

Loading…
Cancel
Save