From 2f8ac38f27672188156867fed453caa9d40710f7 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 3 Nov 2010 15:09:08 +0300 Subject: [PATCH] Change distributive UID from short:arch to profile. --- i18n/cl_builder_ru.mo | Bin 12134 -> 12548 bytes pym/cl_builder.py | 32 ++++++++++++++------------------ pym/cl_fill_builder.py | 16 +++++++++++++--- pym/cl_image_cmd.py | 34 +++++++++++----------------------- pym/cl_vars_builder.py | 8 ++++---- 5 files changed, 42 insertions(+), 48 deletions(-) diff --git a/i18n/cl_builder_ru.mo b/i18n/cl_builder_ru.mo index 87944a94cd6ee2f0a9cf5406ed5d3dc8b5d60403..9516a5ad9bdb756cb7003efc457c5ab4a161244c 100644 GIT binary patch delta 2586 zcmYk+drXye9LMqB$s2IIpmI?_&x4|50-}Um%n&btVT6)*(m+7T(ii8waN7+n~h%7Ky@X-opH#6`FTQ?LOS;92+nRb0jSH#iGTlrife z8q=@>=V3d>;yJX8X)_;%E5^np+<1t3Fy3p74>NH#mZOE$n1v^B84kMsfNIz~J^Xw! z>isO7gB7Uzb+{6b;bQtXz3u}yQ8T@Znwgnl%zRjgdNCK1u?%&;5tXsisDXTd%FHd) zbAP(`lV*mW%X8g<7WaebqknT&73@b1;9FFOW4I8fkWVIOQc%xjVlI}W2JjkcpzmQK zeum26D5{-DI2XOq;rD&0ffis}9F-a>no%n%Rp*et&4;L&Tt}___o$Aw9x;%IX;_Bp zxD}bSc^!Gwyo=Lt0H44cxE$|eHpb2&|0}4J(yKaZMWymBd>n^S1Nj}*;XkOgk6}9L zSb~~BGx9U1IOw^Hs162D8G3-37|Bg#G#{0r-7(}}9R;|s6wjkl^SS%r&uDQzl|05{ zDyrcE)KVNp4X_94!@PqQ4k15tn*)O=Byu9@pV{T!W)ng!34MKF_xORCM7ID)slV z1m}{sa;!uRFO97Ao!Qd-eK51>A`Q>ctwz%BR- zwqOoBd=p;5Ec^qDa5*oxZKM*Q!k1+Rk+#hU9>RxMiF^2X_5BWVp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hpni!-;Du0jhex4s2M&$ zUH1>FgA7h8Lv=U{x1uuo6)HpLQT<%QY4|*c{3|sDw4w`Z(U0vo9wVrRPoYvdgxqU? zqaQuwn~#<7#T;xtDz%O7`A+=8WA-KLDSE}|YcZR~tFR?PWet^H)b6~82QZ1@cHt46 zjnA96UUa+}mDxUAfxqJ_oWQz;@FSdqkpU`B$EcAfk-vJJ zjK$c6%1|#h;{{xZx>z05;A-53Rd@*(;0x4%XOdQ(--7G$Tle@GF4OZLAg^or;ZtnF z7;2N{`r{phT)R*MIf*mzGB)62)C4LRt?p~ZYCMD_#eP8z^bb^K64}|jc&rJ7dj9uP z(FlJ)ZHhlpDNmqPrD!f{#$E1lKWb)okV#r5qk0DeND^%ws=dAL`2pO(@d(ni1?l|* zY{54Aw*e|FyQR{*M(RgBPK~IHwBbtp3HRX(T!tUhYXx4!<@gBeFvu3?fv|4mQagg3 zcn&w>cskMJ*^Lp6{Cg^Tysly^zC_KSnX3+C57uBN4|7Q8aVZ`{bvTSm&`182nKsm3 z>BYHt8;@f)osa}OgIdB^fc)>L@`@9*Vcne7j85Y^96_yRDQ^uAs_0mas_33A#3EuG zkwK_zC1}z~^ERv{RJ5!r%AQJz*1w2K1Hp!L(w>5^7Y#(|8bc^s+lgjkv{X`QBzUx) z4ac@{-VxvwFW<_ZCiZ42*ZQkygCrB$2ct!6m_?)$x$a4}iX{-*kna&%*U_?r3JG)G zfTQPHsA#Fuh>uZkV=NXE z9Yl!G?pDc*V>?kBY)v%at&4u`EgT&3#?qoc<{cbdnt$ID{m@r6c*9qnKUf;v>4^@_ Gn)g5bF3^zx diff --git a/pym/cl_builder.py b/pym/cl_builder.py index 75bd391..ea4e24f 100644 --- a/pym/cl_builder.py +++ b/pym/cl_builder.py @@ -477,35 +477,31 @@ class cl_builder(color_print): {'from':source,'to':target}) self.printByResult(True) - def setAssembleData(self,shortname,march): + def setAssembleData(self,newprofile): """Get assemble data from assemble.env""" envData = iniParser(self.envFile) - if shortname == None and march == None: + if newprofile == None: distros = self.clVars.Get('cl_builder_distro') if len(distros) == 1: - section = distros[0].split(',') - var = 'os_assemble_linux_shortname' - shortname = \ - _toUNICODE(envData.getVar(section,var)).encode('utf-8') - var = 'os_assemble_arch_machine' - march = \ - _toUNICODE(envData.getVar(section,var)).encode('utf-8') - shortname = shortname.upper() - if shortname: - self.clVars.Set('os_builder_linux_shortname',shortname,True) - if march: - self.clVars.Set('os_builder_arch_machine',march,True) + newprofile = distros[0] + if not newprofile in self.clVars.Get('cl_builder_distro'): + if newprofile: + self.printERROR(_("wrong value for '--profile'")) + self.defaultPrint(_("Available assembled distro")+":\n") + for profile in self.clVars.Get('cl_builder_distro'): + self.printSUCCESS(profile) + return False + self.clVars.Set('os_builder_profile', newprofile, True) self.assembleIso = True - section = (self.clVars.Get('os_builder_linux_shortname'), - self.clVars.Get('os_builder_arch_machine')) - self.clVars.Set('cl_builder_path', _toUNICODE(envData.getVar(section, + self.clVars.Set('cl_builder_path', _toUNICODE(envData.getVar(newprofile, 'cl_assemble_path')).encode('utf-8'),True) - linuxver = _toUNICODE(envData.getVar(section, + linuxver = _toUNICODE(envData.getVar(newprofile, 'os_assemble_linux_ver')).encode('utf-8') if not linuxver: curdate = datetime.now() linuxver = "%04d%02d%02d"%(curdate.year,curdate.month,curdate.day) self.clVars.Set('os_builder_linux_ver',linuxver ,True) + return True def createPackageList(self,chrootdir,filename): """Create package list by chrootdir""" diff --git a/pym/cl_fill_builder.py b/pym/cl_fill_builder.py index 320cd96..ab41218 100644 --- a/pym/cl_fill_builder.py +++ b/pym/cl_fill_builder.py @@ -209,7 +209,7 @@ class fillVars(object, varsShare): kernelconfig = "config-%s-%s-%s"%(res.groups()[:3]) if path.exists(path.join(bootPath,kernelconfig)): return kernelconfig - else: + elif path.exists(bootPath): configs = filter(lambda x:x.startswith('config'), os.listdir(bootPath)) if configs: @@ -226,7 +226,7 @@ class fillVars(object, varsShare): systemmap = "System.map-%s-%s-%s"%(res.groups()[:3]) if path.exists(path.join(bootPath,systemmap)): return systemmap - else: + elif path.exists(bootPath): systemmaps = filter(lambda x:x.startswith('System.map'), os.listdir(bootPath)) if systemmaps: @@ -347,7 +347,7 @@ class fillVars(object, varsShare): """Current assembling systems""" envFile = '/etc/calculate/assemble.env' envData = iniParser(envFile) - return filter(lambda x:envData.getVar(x.split(','), + return filter(lambda x:envData.getVar(x, 'os_assemble_root_dev'), map(lambda x:_toUNICODE(x).encode('utf-8'), envData.getAllSectionNames())) @@ -356,3 +356,13 @@ class fillVars(object, varsShare): """Get files num in assembled distro""" #getFilesCount(self.Get('cl_builder_path')) return "0" + + def get_cl_builder_image_path(self): + imagePath = ['/var/calculate/linux', + '/var/calculate/remote/linux', + '/usr/calculate/share/linux'] + if self.Get('os_builder_profile'): + imagePath.append(path.join("/var/calculate/remote/assemble", + self.Get('os_builder_profile').replace('/','-'), + "linux")) + return imagePath diff --git a/pym/cl_image_cmd.py b/pym/cl_image_cmd.py index a4fc37e..0640ec9 100644 --- a/pym/cl_image_cmd.py +++ b/pym/cl_image_cmd.py @@ -33,24 +33,14 @@ lang().setLanguage(sys.modules[__name__]) OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys()) DESCRIPTION = _("The Calculate Linux image builder") -CMD_OPTIONS = [{'shortOption':"f", +CMD_OPTIONS = [{'shortOption':"p", + 'longOption':"profile", + 'optVal':"PROFILE", + 'help':_("system profile") + }, + {'shortOption':"f", 'longOption':"force", 'help':_("no questions during the creating process") - }, - {'shortOption':"s", - 'longOption':"os", - 'optVal':"SYSTEM", - 'type':'choice', - 'choices_regignore':OSSYSTEM_LIST, - 'help':_("select operation system")+ - " (%s)"%",".join(OSSYSTEM_LIST) - }, - {'longOption':"march", - 'optVal':"ARCH", - 'type':'choice', - 'choices':['x86_64','i686'], - 'help':_("select arch for operation system") + - " (%s)"%_("i686 or x86_64") }] USAGE = _("%prog [options] iso|squash") @@ -91,7 +81,7 @@ class image_cmd(share_cmd): def isAssemble(self,showError=True): """Detect system assembling""" - if path.exists(self.envFile) \ + if self.logicObj.clVars.Get('cl_builder_distro') \ and self.logicObj.clVars.Get('cl_builder_path'): inidata = iniParser(self.envFile) res = inidata.getVar(self.__sectionName(),"cl_assemble_step_world", @@ -119,16 +109,14 @@ class image_cmd(share_cmd): if args: self.logicObj.clVars.Set('cl_action',args[0],True) - if values.s: - if self.isScratch(False): - self.optobj.error(_("'-s' not used in scratch mode")) - if values.march: + if values.p: if self.isScratch(False): - self.optobj.error(_("'--march' not used in scratch mode")) + self.optobj.error(_("'--profile' not used in scratch mode")) if not self.isScratch(False) \ and self.logicObj.clVars.Get('cl_builder_distro'): - self.logicObj.setAssembleData(values.s,values.march) + if not self.logicObj.setAssembleData(values.p): + sys.exit(1) if args and args[0] == "squash": self.logicObj.clVars.Set('cl_builder_iso_path','/mnt/flash',True) diff --git a/pym/cl_vars_builder.py b/pym/cl_vars_builder.py index eff1db4..b3b46b0 100644 --- a/pym/cl_vars_builder.py +++ b/pym/cl_vars_builder.py @@ -130,14 +130,14 @@ class Data: # distro created by assemble cl_builder_distro = {} + os_builder_profile = {} + # count of files and directories in distributive cl_builder_filesnum = {} # path which contains images - cl_builder_image_path = {'mode':'w', - 'value':['/var/calculate/linux', - '/var/calculate/remote/linux', - '/usr/calculate/share/linux']} + cl_builder_image_path = {} + # lib vars cl_action = {} cl_chroot_path = {}