Change distributive UID from short:arch to profile.

Mike Hiretsky 14 years ago
parent bdc6331e27
commit 2f8ac38f27

Binary file not shown.

@ -477,35 +477,31 @@ class cl_builder(color_print):
{'from':source,'to':target}) {'from':source,'to':target})
self.printByResult(True) self.printByResult(True)
def setAssembleData(self,shortname,march): def setAssembleData(self,newprofile):
"""Get assemble data from assemble.env""" """Get assemble data from assemble.env"""
envData = iniParser(self.envFile) envData = iniParser(self.envFile)
if shortname == None and march == None: if newprofile == None:
distros = self.clVars.Get('cl_builder_distro') distros = self.clVars.Get('cl_builder_distro')
if len(distros) == 1: if len(distros) == 1:
section = distros[0].split(',') newprofile = distros[0]
var = 'os_assemble_linux_shortname' if not newprofile in self.clVars.Get('cl_builder_distro'):
shortname = \ if newprofile:
_toUNICODE(envData.getVar(section,var)).encode('utf-8') self.printERROR(_("wrong value for '--profile'"))
var = 'os_assemble_arch_machine' self.defaultPrint(_("Available assembled distro")+":\n")
march = \ for profile in self.clVars.Get('cl_builder_distro'):
_toUNICODE(envData.getVar(section,var)).encode('utf-8') self.printSUCCESS(profile)
shortname = shortname.upper() return False
if shortname: self.clVars.Set('os_builder_profile', newprofile, True)
self.clVars.Set('os_builder_linux_shortname',shortname,True)
if march:
self.clVars.Set('os_builder_arch_machine',march,True)
self.assembleIso = True self.assembleIso = True
section = (self.clVars.Get('os_builder_linux_shortname'), self.clVars.Set('cl_builder_path', _toUNICODE(envData.getVar(newprofile,
self.clVars.Get('os_builder_arch_machine'))
self.clVars.Set('cl_builder_path', _toUNICODE(envData.getVar(section,
'cl_assemble_path')).encode('utf-8'),True) 'cl_assemble_path')).encode('utf-8'),True)
linuxver = _toUNICODE(envData.getVar(section, linuxver = _toUNICODE(envData.getVar(newprofile,
'os_assemble_linux_ver')).encode('utf-8') 'os_assemble_linux_ver')).encode('utf-8')
if not linuxver: if not linuxver:
curdate = datetime.now() curdate = datetime.now()
linuxver = "%04d%02d%02d"%(curdate.year,curdate.month,curdate.day) linuxver = "%04d%02d%02d"%(curdate.year,curdate.month,curdate.day)
self.clVars.Set('os_builder_linux_ver',linuxver ,True) self.clVars.Set('os_builder_linux_ver',linuxver ,True)
return True
def createPackageList(self,chrootdir,filename): def createPackageList(self,chrootdir,filename):
"""Create package list by chrootdir""" """Create package list by chrootdir"""

@ -209,7 +209,7 @@ class fillVars(object, varsShare):
kernelconfig = "config-%s-%s-%s"%(res.groups()[:3]) kernelconfig = "config-%s-%s-%s"%(res.groups()[:3])
if path.exists(path.join(bootPath,kernelconfig)): if path.exists(path.join(bootPath,kernelconfig)):
return kernelconfig return kernelconfig
else: elif path.exists(bootPath):
configs = filter(lambda x:x.startswith('config'), configs = filter(lambda x:x.startswith('config'),
os.listdir(bootPath)) os.listdir(bootPath))
if configs: if configs:
@ -226,7 +226,7 @@ class fillVars(object, varsShare):
systemmap = "System.map-%s-%s-%s"%(res.groups()[:3]) systemmap = "System.map-%s-%s-%s"%(res.groups()[:3])
if path.exists(path.join(bootPath,systemmap)): if path.exists(path.join(bootPath,systemmap)):
return systemmap return systemmap
else: elif path.exists(bootPath):
systemmaps = filter(lambda x:x.startswith('System.map'), systemmaps = filter(lambda x:x.startswith('System.map'),
os.listdir(bootPath)) os.listdir(bootPath))
if systemmaps: if systemmaps:
@ -347,7 +347,7 @@ class fillVars(object, varsShare):
"""Current assembling systems""" """Current assembling systems"""
envFile = '/etc/calculate/assemble.env' envFile = '/etc/calculate/assemble.env'
envData = iniParser(envFile) envData = iniParser(envFile)
return filter(lambda x:envData.getVar(x.split(','), return filter(lambda x:envData.getVar(x,
'os_assemble_root_dev'), 'os_assemble_root_dev'),
map(lambda x:_toUNICODE(x).encode('utf-8'), map(lambda x:_toUNICODE(x).encode('utf-8'),
envData.getAllSectionNames())) envData.getAllSectionNames()))
@ -356,3 +356,13 @@ class fillVars(object, varsShare):
"""Get files num in assembled distro""" """Get files num in assembled distro"""
#getFilesCount(self.Get('cl_builder_path')) #getFilesCount(self.Get('cl_builder_path'))
return "0" 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

@ -33,24 +33,14 @@ lang().setLanguage(sys.modules[__name__])
OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys()) OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys())
DESCRIPTION = _("The Calculate Linux image builder") 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", 'longOption':"force",
'help':_("no questions during the creating process") '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") USAGE = _("%prog [options] iso|squash")
@ -91,7 +81,7 @@ class image_cmd(share_cmd):
def isAssemble(self,showError=True): def isAssemble(self,showError=True):
"""Detect system assembling""" """Detect system assembling"""
if path.exists(self.envFile) \ if self.logicObj.clVars.Get('cl_builder_distro') \
and self.logicObj.clVars.Get('cl_builder_path'): and self.logicObj.clVars.Get('cl_builder_path'):
inidata = iniParser(self.envFile) inidata = iniParser(self.envFile)
res = inidata.getVar(self.__sectionName(),"cl_assemble_step_world", res = inidata.getVar(self.__sectionName(),"cl_assemble_step_world",
@ -119,16 +109,14 @@ class image_cmd(share_cmd):
if args: if args:
self.logicObj.clVars.Set('cl_action',args[0],True) self.logicObj.clVars.Set('cl_action',args[0],True)
if values.s: if values.p:
if self.isScratch(False):
self.optobj.error(_("'-s' not used in scratch mode"))
if values.march:
if self.isScratch(False): 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) \ if not self.isScratch(False) \
and self.logicObj.clVars.Get('cl_builder_distro'): 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": if args and args[0] == "squash":
self.logicObj.clVars.Set('cl_builder_iso_path','/mnt/flash',True) self.logicObj.clVars.Set('cl_builder_iso_path','/mnt/flash',True)

@ -130,14 +130,14 @@ class Data:
# distro created by assemble # distro created by assemble
cl_builder_distro = {} cl_builder_distro = {}
os_builder_profile = {}
# count of files and directories in distributive # count of files and directories in distributive
cl_builder_filesnum = {} cl_builder_filesnum = {}
# path which contains images # path which contains images
cl_builder_image_path = {'mode':'w', cl_builder_image_path = {}
'value':['/var/calculate/linux',
'/var/calculate/remote/linux',
'/usr/calculate/share/linux']}
# lib vars # lib vars
cl_action = {} cl_action = {}
cl_chroot_path = {} cl_chroot_path = {}

Loading…
Cancel
Save