|
|
|
@ -169,7 +169,7 @@ class cl_assemble(color_print):
|
|
|
|
|
if not self.clVars.Get('cl_assemble_image'):
|
|
|
|
|
self.printWARNING("No path for image creating.")
|
|
|
|
|
|
|
|
|
|
def printBreakInfo(self):
|
|
|
|
|
def printConfInfo(self):
|
|
|
|
|
self.printSUCCESS(_("Breaking assembling of") + " Calculate Linux")
|
|
|
|
|
self.defaultPrint("%s\n"%_("System information"))
|
|
|
|
|
subname = self.clVars.Get('os_assemble_linux_subname')
|
|
|
|
@ -343,6 +343,7 @@ class cl_assemble(color_print):
|
|
|
|
|
if path.exists(pathAppMisc) and \
|
|
|
|
|
filter(lambda x:metaPackage in x, os.listdir(pathAppMisc)):
|
|
|
|
|
self._prepareMount()
|
|
|
|
|
self.clVars.Write('cl_assemble_step_system','2',True,'default')
|
|
|
|
|
return True
|
|
|
|
|
if not isinstance(self.sourceDistr,IsoDistributive):
|
|
|
|
|
self._unpackPortage()
|
|
|
|
@ -392,6 +393,11 @@ class cl_assemble(color_print):
|
|
|
|
|
home="/home/p2p",groups=["100","wheel"],
|
|
|
|
|
comment="added by Calculate for p2p",
|
|
|
|
|
shell="/bin/bash",prefix=self.assemblePath)
|
|
|
|
|
|
|
|
|
|
if isinstance(self.sourceDistr,IsoDistributive):
|
|
|
|
|
self.clVars.Write('cl_assemble_step_system','2',True,'default')
|
|
|
|
|
else:
|
|
|
|
|
self.clVars.Write('cl_assemble_step_system','0',True,'default')
|
|
|
|
|
return True
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -448,12 +454,17 @@ class cl_assemble(color_print):
|
|
|
|
|
def _getCommand(self,commandlist):
|
|
|
|
|
return " ".join(map(lambda x:'"%s"'%x if " " in x else x,commandlist))
|
|
|
|
|
|
|
|
|
|
def runChroot(self,command,raiseError=True):
|
|
|
|
|
def runChroot(self,command,raiseError=True,showProcess=False):
|
|
|
|
|
"""Run command in chroot specified by cl_assemble_path"""
|
|
|
|
|
try:
|
|
|
|
|
if showProcess:
|
|
|
|
|
IOval = None
|
|
|
|
|
else:
|
|
|
|
|
IOval = PIPE
|
|
|
|
|
chrootCommand = process("chroot",
|
|
|
|
|
self.clVars.Get('cl_assemble_path'),
|
|
|
|
|
"/bin/bash","-c",command)
|
|
|
|
|
"/bin/bash","-c",command,stderr=IOval,
|
|
|
|
|
stdout=IOval)
|
|
|
|
|
DEBUG(self._getCommand(chrootCommand.command))
|
|
|
|
|
if raiseError and chrootCommand.failed():
|
|
|
|
|
raise AssembleError(
|
|
|
|
@ -484,19 +495,11 @@ class cl_assemble(color_print):
|
|
|
|
|
self.printERROR(_('Execute with parameter')+' "--configure".')
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
self.printBreakInfo()
|
|
|
|
|
if not force:
|
|
|
|
|
dialogMessage = \
|
|
|
|
|
_("Continue breaking assembling of the system") + \
|
|
|
|
|
" (yes/no)"
|
|
|
|
|
try:
|
|
|
|
|
dialogRes = dialogYesNo(dialogMessage)
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
raise KeyboardInterrupt
|
|
|
|
|
if dialogRes in (None,False):
|
|
|
|
|
self.printERROR(_("Interrupting the breaking"))
|
|
|
|
|
return False
|
|
|
|
|
self.printConfInfo()
|
|
|
|
|
if not self._askUser(force, _("Continue breaking assembling"
|
|
|
|
|
" of the system")):
|
|
|
|
|
self.printERROR(_("Interrupting the breaking"))
|
|
|
|
|
return False
|
|
|
|
|
mps = filter(lambda x:x!=mp,map(lambda x:x[1],childMounts(mp)))
|
|
|
|
|
for target in sorted(mps, reverse=True):
|
|
|
|
|
self.printMessageForTest(_("Unmounting %s")%(target[len(mp):]))
|
|
|
|
@ -516,6 +519,110 @@ class cl_assemble(color_print):
|
|
|
|
|
_("Breaking of system assembling failed")
|
|
|
|
|
return self.make(self.breakFunc,force)
|
|
|
|
|
|
|
|
|
|
def makeSystem(self,force):
|
|
|
|
|
self.msgOperationComplete = \
|
|
|
|
|
_("System assembled is successfully")
|
|
|
|
|
self.msgOperationFailed = \
|
|
|
|
|
_("System compiling failed")
|
|
|
|
|
return self.make(self.makeFunc,force)
|
|
|
|
|
|
|
|
|
|
def makeFunc(self,force):
|
|
|
|
|
rootPartdev = self.clVars.Get('os_assemble_root_dev')
|
|
|
|
|
mp = isMount(rootPartdev)
|
|
|
|
|
if not mp:
|
|
|
|
|
self.printERROR(_("For performance of operation it is "
|
|
|
|
|
"necessary to configure system")+".")
|
|
|
|
|
self.printERROR(_('Execute with parameter')+' "--configure".')
|
|
|
|
|
return False
|
|
|
|
|
self.printConfInfo()
|
|
|
|
|
self.defaultPrint("%s\n"%_("Perform pre-compile checkups"))
|
|
|
|
|
|
|
|
|
|
if self.clVars.Get('cl_assemble_step_system') == '':
|
|
|
|
|
self.printWARNING(_("WARNING") +": " +
|
|
|
|
|
_("assemble configuration was not completed"))
|
|
|
|
|
force = False
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
|
|
|
|
|
if not self._askUser(force, _("Continue package compilation"
|
|
|
|
|
" of the system")):
|
|
|
|
|
self.printERROR(_("Interrupting the compilation"))
|
|
|
|
|
return False
|
|
|
|
|
makeComplete = False
|
|
|
|
|
while not makeComplete:
|
|
|
|
|
if self.GetIntVar('cl_assemble_step_system') < 2:
|
|
|
|
|
self._resumeCompile() or self._compileSystem()
|
|
|
|
|
val = self.IncVar('cl_assemble_step_system')
|
|
|
|
|
if val == 2:
|
|
|
|
|
self.clVars.Write('cl_assemble_make','world',
|
|
|
|
|
True,"default")
|
|
|
|
|
else:
|
|
|
|
|
self.clVars.Write('cl_assemble_make','',
|
|
|
|
|
True,"default")
|
|
|
|
|
elif self.clVars.Get('cl_assemble_make') in ("newuse","") \
|
|
|
|
|
and self.GetIntVar('cl_assemble_step_newuse') < 1:
|
|
|
|
|
self._resumeCompile() or self._compileNewUse()
|
|
|
|
|
val = self.IncVar('cl_assemble_step_newuse')
|
|
|
|
|
self.clVars.Write('cl_assemble_make','update',True,"default")
|
|
|
|
|
elif self.clVars.Get('cl_assemble_make') in ("update","") \
|
|
|
|
|
and self.GetIntVar('cl_assemble_step_update') < 1:
|
|
|
|
|
self._resumeCompile() or self._compileUpdate()
|
|
|
|
|
val = self.IncVar('cl_assemble_step_update')
|
|
|
|
|
self.clVars.Write('cl_assemble_make','',True,"default")
|
|
|
|
|
makeComplete = True
|
|
|
|
|
elif self.clVars.Get('cl_assemble_make') in ("world","") \
|
|
|
|
|
and self.GetIntVar('cl_assemble_step_world') < 1:
|
|
|
|
|
self._resumeCompile()
|
|
|
|
|
self._compileWorld()
|
|
|
|
|
self.clVars.Write('cl_assemble_make','',True,"default")
|
|
|
|
|
makeComplete = True
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _compileWorld(self):
|
|
|
|
|
self.clVars.Write('cl_assemble_make','world',True,'default')
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%
|
|
|
|
|
"emerge --noreplace world" + " ...")
|
|
|
|
|
self.runChroot("emerge --noreplace world", showProcess=True)
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%"emerge -D --newuse world"+
|
|
|
|
|
" ...")
|
|
|
|
|
self.runChroot("emerge --newuse -D world", showProcess=True)
|
|
|
|
|
|
|
|
|
|
def _compileNewuse(self):
|
|
|
|
|
self.clVars.Write('cl_assemble_make','newuse',True,'default')
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%"emerge -D --newuse world"+
|
|
|
|
|
" ...")
|
|
|
|
|
self.runChroot("emerge --newuse -D world", showProcess=True)
|
|
|
|
|
|
|
|
|
|
def _compileUpdate(self):
|
|
|
|
|
self.clVars.Write('cl_assemble_make','update',True,'default')
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%"emerge -uD world"+" ...")
|
|
|
|
|
self.runChroot("emerge -uD world", showProcess=True)
|
|
|
|
|
|
|
|
|
|
def _compileSystem(self):
|
|
|
|
|
self.clVars.Write('cl_assemble_make','system',True,'default')
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%"emerge -e system"+" ...")
|
|
|
|
|
self.runChroot("emerge -e system", showProcess=True)
|
|
|
|
|
|
|
|
|
|
def _resumeCompile(self):
|
|
|
|
|
if self.clVars.Get('cl_assemble_make'):
|
|
|
|
|
self.printSUCCESS(_("Executing %s")%"emerge --resume"+" ...")
|
|
|
|
|
self.runChroot("emerge --resume", showProcess=True)
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def GetIntVar(self,varname):
|
|
|
|
|
"""Get value of variable as number"""
|
|
|
|
|
val = self.clVars.Get(varname)
|
|
|
|
|
if val.isdigit():
|
|
|
|
|
return int(val)
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
def IncVar(self,varname):
|
|
|
|
|
"""Increase variable value and save"""
|
|
|
|
|
return self.clVars.Write(varname,str(self.GetIntVar(varname) + 1),
|
|
|
|
|
True,'default')
|
|
|
|
|
|
|
|
|
|
def make(self,logicFunc,*argv):
|
|
|
|
|
"""Make iso image by variables"""
|
|
|
|
|
self.sourceDistr = None
|
|
|
|
@ -579,12 +686,15 @@ class cl_assemble(color_print):
|
|
|
|
|
def setAction(self,action):
|
|
|
|
|
if action == "break":
|
|
|
|
|
self.clVars.Set("cl_action","break",True)
|
|
|
|
|
if action == "make":
|
|
|
|
|
self.clVars.Set("cl_action","make",True)
|
|
|
|
|
else:
|
|
|
|
|
self.clVars.Set("cl_action","configure",True)
|
|
|
|
|
if action in ("break","make"):
|
|
|
|
|
rootPartdev = self.clVars.Get('os_assemble_root_dev')
|
|
|
|
|
mp = isMount(rootPartdev)
|
|
|
|
|
if mp:
|
|
|
|
|
envData = map(lambda x:map(lambda x:pathJoin(mp,x),x),
|
|
|
|
|
envData = map(lambda x:(x[0],pathJoin(mp,x[1])),
|
|
|
|
|
self.clVars.Get('cl_env_data'))
|
|
|
|
|
self.clVars.Set('cl_env_data', envData,True)
|
|
|
|
|
self.clVars.flIniFile()
|
|
|
|
|
else:
|
|
|
|
|
self.clVars.Set("cl_action","configure",True)
|
|
|
|
|