From 6a1c1ecd6b3b4149043b2b1254db900768c51a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Tue, 28 May 2013 17:54:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=20-F?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D0=BE=D0=B1?= =?UTF-8?q?=20emerge=20world=20=D0=B8=20emerge=20-c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/cl_assemble.py | 38 ++++++++++++++++++++++++-------------- pym/cl_assemble_cmd.py | 5 +++-- pym/cl_make_cmd.py | 15 +++++++++------ pym/cl_vars_assemble.py | 3 +++ scripts/cl-make | 10 +++++----- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/pym/cl_assemble.py b/pym/cl_assemble.py index 6456d80..da7327e 100644 --- a/pym/cl_assemble.py +++ b/pym/cl_assemble.py @@ -715,7 +715,7 @@ class cl_assemble(color_print): self.printMessageForTest(_("Re-create world")) self.runChroot("cl-core --method update --rebuild-world") - def configureFunc(self,force=False,nounmount=False): + def configureFunc(self,soft_force,force=False,nounmount=False): """Function of configure partition for assembling by make""" # print info self.printInfo() @@ -726,7 +726,7 @@ class cl_assemble(color_print): if distName and self.targetDistr: distRep = DistributiveRepository() self.sourceDistr = distRep.getDistributiveByFile(distName) - if not self._askUser(force, _("Continue system assemble")): + if not self._askUser(force or soft_force, _("Continue system assemble")): self.printERROR(_("Assemble interrupted")) self.removeDistroInfo() return False @@ -930,6 +930,11 @@ class cl_assemble(color_print): envdict = {'CHROOT':"on"} envdict.update(os.environ) needAsk = self.clVars.Get('cl_assemble_ask_set') == "on" + if (not needAsk and + self.clVars.Get('cl_assemble_ask_important_set') == "on" and + "emerge " in command and + ("--depclean" in command or "world" in command)): + needAsk = True if "emerge " in command: command = "env-update &>/dev/null;" \ "source /etc/profile &>/dev/null;%s"%command @@ -1000,14 +1005,14 @@ class cl_assemble(color_print): ":\n %s"%self._getCommand(chrootCommand.command)) return chrootCommand - def configureSystem(self,force,nounmount): + def configureSystem(self,soft_force,force,nounmount): """Unpack stage or cls|css and prepare for assemble""" self.msgOperationComplete = "" self.msgOperationFailed = \ _("Failed to prepare the system for assemble") if not self._pidCheck(): return False - res = self.make(self.configureFunc,force,nounmount) + res = self.make(self.configureFunc,soft_force,force,nounmount) if res: self.printSUCCESS( _("System prepared for assemble in %s")% @@ -1015,14 +1020,15 @@ class cl_assemble(color_print): self.printSUCCESS(_("For furhter build, use the 'cl-make' command")) return res - def breakFunc(self,force): + def breakFunc(self,soft_force,force): mp = self.clVars.Get('cl_assemble_path') rootPartdev = self.clVars.Get('os_assemble_root_dev') if not self._checkAlreadyAssembling(): return False self.printSUCCESS(_("Assemble interrupted") + " Calculate Linux") self.printConfInfo() - if not self._askUser(force, _("Interrupt system assemble")): + if not self._askUser(force or soft_force, + _("Interrupt system assemble")): self.printERROR(_("Assemble resumed")) return False if mp: @@ -1064,14 +1070,14 @@ class cl_assemble(color_print): self.clVars.Get('os_assemble_system_profile'))}) return False - def breakAssembling(self,force): + def breakAssembling(self,soft_force,force): self.msgOperationComplete = \ _("System assemble resumed")+"!" self.msgOperationFailed = \ _("Failed to interrupt assemble correctly") if not self._pidCheck(): return False - return self.make(self.breakFunc,force) + return self.make(self.breakFunc,soft_force,force) def _pidCheck(self): """Check pid for run""" @@ -1086,16 +1092,16 @@ class cl_assemble(color_print): self.saveVars('cl_assemble_pid') return True - def makeSystem(self,force): + def makeSystem(self,soft_force,force): self.msgOperationComplete = \ _("System successfully assembled")+"!" self.msgOperationFailed = \ _("System assemble failed") if not self._pidCheck(): return False - return self.make(self.makeFunc,force,True,False) + return self.make(self.makeFunc,soft_force,force,True,False) - def updateSystem(self,force,withsync=True): + def updateSystem(self,soft_force,force,withsync=True): if self.clVars.Get('cl_action') == "applytemplates": self.msgOperationComplete = \ _("Templates successfully applied")+"!" @@ -1117,7 +1123,7 @@ class cl_assemble(color_print): _("Unable to update the distribution: assemble not completed")) self.printERROR(_("Use '%s' for assemble")%'cl-make -m') return False - return self.make(self.makeFunc,force,False,withsync) + return self.make(self.makeFunc,soft_force,force,False,withsync) def _getNameByAction(self): act = self.clVars.Get('cl_assemble_make') @@ -1132,7 +1138,7 @@ class cl_assemble(color_print): else: return "" - def makeFunc(self,force,forcesystem=False,makeSync=True): + def makeFunc(self,soft_force,force,forcesystem=False,makeSync=True): rootPartdev = self.clVars.Get('os_assemble_root_dev') mp = isMount(rootPartdev) if not self._checkAlreadyAssembling(): @@ -1170,13 +1176,17 @@ class cl_assemble(color_print): self.clVars.Get('cl_assemble_step_world')) self.defaultPrint("\n") - if not self._askUser(force, _("Continue compiling system packages")): + if not self._askUser(force or soft_force, + _("Continue compiling system packages")): self.printERROR(_("Compilation interrupted")) return False self.mainAction = self.clVars.Get('cl_action') if self.mainAction in ('make','update','syncupdate'): if not force: self.clVars.Set('cl_assemble_ask_set', 'on', True) + if soft_force: + self.clVars.Set('cl_assemble_ask_set', 'off', True) + self.clVars.Set('cl_assemble_ask_important_set', 'on', True) self.assemblePath = self.clVars.Get('cl_assemble_path') if "finish" in self.clVars.Get('cl_assemble_step_world'): self.writeVar('cl_assemble_step_world','stagecomplete',True) diff --git a/pym/cl_assemble_cmd.py b/pym/cl_assemble_cmd.py index 5733c0e..506a8f4 100644 --- a/pym/cl_assemble_cmd.py +++ b/pym/cl_assemble_cmd.py @@ -81,7 +81,8 @@ CMD_OPTIONS = [{'shortOption':"d", {'shortOption':"f", 'longOption':"force", 'help':_("no questions during install") - }] + }, + ] USAGE = _("%prog [options]") class assemble_cmd(share_cmd): @@ -173,7 +174,7 @@ class assemble_cmd(share_cmd): def configureSystem(self,force,nounmount): """Unpack stage and prepare for assemble""" - if not self.logicObj.configureSystem(force,nounmount): + if not self.logicObj.configureSystem(False,force,nounmount): return False return True diff --git a/pym/cl_make_cmd.py b/pym/cl_make_cmd.py index 2728edd..e23b0a1 100644 --- a/pym/cl_make_cmd.py +++ b/pym/cl_make_cmd.py @@ -70,6 +70,9 @@ CMD_OPTIONS = [{'shortOption':"D", {'shortOption':"f", 'longOption':"force", 'help':_("no questions during install") + }, + {'shortOption':"F", + 'help':_("ask only important questions") }] USAGE = _("%prog [options] --dependence|--update|" "--update-without-sync|--make|--break") @@ -153,21 +156,21 @@ class make_cmd(assemble_cmd): self.logicObj.clVars.Set('cl_assemble_skipfirst_set', "on",True) - def compileSystem(self,force): + def compileSystem(self,soft_force,force): """Compile all packages for system""" - if not self.logicObj.makeSystem(force): + if not self.logicObj.makeSystem(soft_force,force): return False return True - def updateSystem(self,force,withsync=True): + def updateSystem(self,soft_force,force,withsync=True): """Compile all packages for system""" - if not self.logicObj.updateSystem(force,withsync): + if not self.logicObj.updateSystem(soft_force,force,withsync): return False return True - def breakAssembling(self,force): + def breakAssembling(self,soft_force,force): """Perform break assembling: unmount all resourse for assembling""" - if not self.logicObj.breakAssembling(force): + if not self.logicObj.breakAssembling(soft_force,force): return False return True diff --git a/pym/cl_vars_assemble.py b/pym/cl_vars_assemble.py index 3664c16..3aa8384 100644 --- a/pym/cl_vars_assemble.py +++ b/pym/cl_vars_assemble.py @@ -69,6 +69,9 @@ class Data: # add -a option for all emerge cl_assemble_ask_set = {'value':'off'} + # add -a option emerge world and emerge -c + cl_assemble_ask_important_set = {'value':'off'} + # pid of assembling process cl_assemble_pid = {} diff --git a/scripts/cl-make b/scripts/cl-make index 320b2bd..9c1f03a 100644 --- a/scripts/cl-make +++ b/scripts/cl-make @@ -55,18 +55,18 @@ if __name__ == "__main__": if not assemble.checkDependence(): sys.exit(1) if options.u: - if not assemble.updateSystem(options.f): + if not assemble.updateSystem(options.F,options.f): sys.exit(1) if options.T: - if not assemble.updateSystem(options.f,False): + if not assemble.updateSystem(options.F,options.f,False): sys.exit(1) if options.U: - if not assemble.updateSystem(options.f,False): + if not assemble.updateSystem(options.F,options.f,False): sys.exit(1) if options.m: - if not assemble.compileSystem(options.f): + if not assemble.compileSystem(options.F,options.f): sys.exit(1) if getattr(options,"break"): - if not assemble.breakAssembling(options.f): + if not assemble.breakAssembling(options.F,options.f): sys.exit(1) sys.exit(0)