diff --git a/i18n/cl_builder_ru.mo b/i18n/cl_builder_ru.mo index 87944a9..9516a5a 100644 Binary files a/i18n/cl_builder_ru.mo and b/i18n/cl_builder_ru.mo differ 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 = {}