|
|
@ -24,7 +24,7 @@ import traceback
|
|
|
|
from os import path
|
|
|
|
from os import path
|
|
|
|
from cl_utils import process,pathJoin,getRunCommands,getTupleVersion,\
|
|
|
|
from cl_utils import process,pathJoin,getRunCommands,getTupleVersion,\
|
|
|
|
childMounts,_toUNICODE,isMount,typeFile, \
|
|
|
|
childMounts,_toUNICODE,isMount,typeFile, \
|
|
|
|
removeDir, pathJoin
|
|
|
|
removeDir, pathJoin,listDirectory
|
|
|
|
from subprocess import STDOUT,PIPE
|
|
|
|
from subprocess import STDOUT,PIPE
|
|
|
|
from cl_print import color_print
|
|
|
|
from cl_print import color_print
|
|
|
|
from cl_datavars import DataVars
|
|
|
|
from cl_datavars import DataVars
|
|
|
@ -87,7 +87,6 @@ class cl_builder(color_print):
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
self.clVars = None
|
|
|
|
self.clVars = None
|
|
|
|
self.startMessage = ""
|
|
|
|
self.startMessage = ""
|
|
|
|
self.startMessage = ""
|
|
|
|
|
|
|
|
self.clTempl = None
|
|
|
|
self.clTempl = None
|
|
|
|
self.force = False
|
|
|
|
self.force = False
|
|
|
|
self.assembleIso = False
|
|
|
|
self.assembleIso = False
|
|
|
@ -213,6 +212,38 @@ class cl_builder(color_print):
|
|
|
|
removeKernelSources)
|
|
|
|
removeKernelSources)
|
|
|
|
self.printByResult(True)
|
|
|
|
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):
|
|
|
|
def prepareSourceDistributive(self,distr):
|
|
|
|
"""Unmount all bind,proc mount points from source distribute"""
|
|
|
|
"""Unmount all bind,proc mount points from source distribute"""
|
|
|
|
mp = self.clVars.Get('cl_builder_path')
|
|
|
|
mp = self.clVars.Get('cl_builder_path')
|
|
|
@ -231,6 +262,11 @@ class cl_builder(color_print):
|
|
|
|
updateLayman = self.runChroot(distrPath,"layman -s calculate")
|
|
|
|
updateLayman = self.runChroot(distrPath,"layman -s calculate")
|
|
|
|
self.printByResult(updateLayman.success())
|
|
|
|
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)
|
|
|
|
self.applyTemplatesForSquash(distrPath)
|
|
|
|
# change make.profile
|
|
|
|
# change make.profile
|
|
|
|
builderPath = self.clVars.Get('cl_builder_path')
|
|
|
|
builderPath = self.clVars.Get('cl_builder_path')
|
|
|
@ -569,6 +605,10 @@ class cl_builder(color_print):
|
|
|
|
if self.clTempl:
|
|
|
|
if self.clTempl:
|
|
|
|
self.clTempl.closeFiles()
|
|
|
|
self.clTempl.closeFiles()
|
|
|
|
if self.sourceDistr:
|
|
|
|
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.printMessageForTest(_("Releasing source data"))
|
|
|
|
self.sourceDistr.close()
|
|
|
|
self.sourceDistr.close()
|
|
|
|
self.printByResult(True)
|
|
|
|
self.printByResult(True)
|
|
|
|