Refactoring

Mike Khiretskiy 9 years ago
parent 332b0ecfe6
commit 14d238c3f4

@ -22,7 +22,7 @@ import sys
from os import path
from calculate.lib.datavars import SimpleDataVars, Variable
from calculate.install.distr import Distributive
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate, _)
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
import time
from calculate.lib.configparser import ConfigParser
from calculate.lib.utils.files import (readFile, listDirectory, isMount,
@ -32,15 +32,18 @@ from .datavars import BuilderError
from calculate.lib.utils.tools import Locker, LockError
from .datavars import builder_data
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
UTF8 = 'utf-8'
class Build(object):
"""
Сборка
"""
class Status(object):
Worked, Registered, Removed, Broken, Unregistered = range(5)
@ -59,7 +62,7 @@ class Build(object):
attrs = {'pkgdir': PkgDir,
'references': References}
class Branches:
class Branches(object):
Stable = Git.Reference.Master
Unstable = Git.Reference.Update

@ -1,4 +1,4 @@
#-*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2015 Calculate Ltd. http://www.calculate-linux.org
#
@ -13,8 +13,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from itertools import chain
import random
import re
import sys
import time
@ -45,18 +45,20 @@ import os
from os import path
from .datavars import BuilderError
from .emerge_fetch import EmergeFetcher, EmergeFetcherError
from calculate.install.distr import SquashDistributive
from calculate.builder.variables.action import Actions
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate, _)
_ = lambda x: x
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class Builder(Update):
"""Основной объект для выполнения действий связанных со сборкой системы
"""
class Method:
class Method(object):
Prepare = "builder_prepare"
Break = "builder_break"
Update = "builder_update"
@ -95,17 +97,20 @@ class Builder(Update):
@type build:Build
"""
if build:
if isMount(self.clVars.Get('cl_builder_path')):
build.close_distributive()
builder_path = self.clVars.Get('cl_builder_path')
if builder_path:
if isMount(builder_path):
build.close_distributive()
build.remove()
if clear:
build.distributive.post_clear()
pkgdir = self.clVars.Get('cl_builder_pkgdir')
if clear_pkg:
if '/remote/' in pkgdir:
if path.exists(pkgdir):
removeDir(pkgdir)
Distributive.clear_empty_directories(pkgdir)
if builder_path:
if clear:
build.distributive.post_clear()
pkgdir = self.clVars.Get('cl_builder_pkgdir')
if clear_pkg:
if '/remote/' in pkgdir:
if path.exists(pkgdir):
removeDir(pkgdir)
Distributive.clear_empty_directories(pkgdir)
return True
def restore_build(self, build):
@ -160,7 +165,7 @@ class Builder(Update):
eq=profile_shortname, limit=1)
if not profile:
raise BuilderError(_("Failed to determine profile %s") %
profile_shortname)
profile_shortname)
chroot_join = lambda x: path.join(chroot_path, x)
profile_path = path.relpath(profile, chroot_join('etc/portage'))
try:
@ -169,13 +174,13 @@ class Builder(Update):
chroot_join('etc/portage/make.profile'))):
os.unlink(rm_fn)
os.symlink(profile_path, chroot_join('etc/portage/make.profile'))
except (OSError,IOError) as e:
print str(e)
raise BuilderError(_("Failed to set the profile: %s")%str(e))
except (OSError, IOError) as e:
raise BuilderError(_("Failed to set the profile: %s") % str(e))
return True
def apply_templates(self,target=None,useClt=None,cltFilter=False,root=None,
useDispatch=True, action="merge", distro_dv=None):
def apply_templates(self, target=None, useClt=None, cltFilter=False,
root=None,
useDispatch=True, action="merge", distro_dv=None):
"""
Применить шаблоны.
@ -188,6 +193,7 @@ class Builder(Update):
from calculate.lib.cl_template import (TemplatesError,
ProgressTemplate,
templateFunction)
templateFunction.installProg = {}
templateFunction.installCategory = []
if target is None:
@ -218,7 +224,8 @@ class Builder(Update):
[pathJoin(chroot, x) for x in clVars.Get('cl_env_path')],
force=True)
clVars.Set('cl_make_profile', path.join(chroot,
'etc/portage/make.profile'), force=True)
'etc/portage/make.profile'),
force=True)
clVars.Set('cl_action', action, force=True)
clVars.Set('cl_chroot_status', 'on', force=True)
for copyvar in ("cl_dispatch_conf", "cl_verbose_set",
@ -227,17 +234,17 @@ class Builder(Update):
clVars.iniCache = {}
clVars.flIniFile()
cltFilter=True if cltFilter in (True,"on") else False
cltFilter = True if cltFilter in (True, "on") else False
clVars.Set("cl_chroot_path", chroot, True)
clVars.Set("cl_root_path", root, True)
# определение каталогов содержащих шаблоны
dirs_list, files_list = ([],[])
dirs_list, files_list = ([], [])
useClt = useClt in ("on", True)
self.addProgress()
nullProgress = lambda *args,**kw:None
nullProgress = lambda *args, **kw: None
dispatch = self.dispatchConf if useDispatch else None
clTempl = ProgressTemplate(nullProgress,clVars,
clTempl = ProgressTemplate(nullProgress, clVars,
cltObj=useClt,
cltFilter=cltFilter,
printSUCCESS=self.printSUCCESS,
@ -303,7 +310,7 @@ class Builder(Update):
def _get_log_file(self):
logname = "build-%s/%s" % (self.clVars.Get('cl_builder_id_path'),
self.clVars.Get('cl_task_name'))
self.clVars.Get('cl_task_name'))
mainlog = self.clVars.Get('core.cl_log_path')
return path.join(mainlog, logname)
@ -354,9 +361,9 @@ class Builder(Update):
return True
else:
self.printSUCCESS(_("Nothing to merge"))
except EmergeError as e:
#self.set_need_update(False)
#self.emerge_cache.drop_cache("Emerge error")
except EmergeError:
# self.set_need_update(False)
# self.emerge_cache.drop_cache("Emerge error")
self._display_install_package(emerge, emergelike=True)
self._display_error(emerge.prepare_error)
raise
@ -407,7 +414,7 @@ class Builder(Update):
with writeFile(self._get_log_file()) as f:
f.write(p.read())
if p.failed():
raise BuilderError(_("Failed to execute %s")%command)
raise BuilderError(_("Failed to execute %s") % command)
return True
def update_task(self, task_name):
@ -503,7 +510,8 @@ class Builder(Update):
logfile=logfile))) as emerge:
emerge.question.default_answer = "n"
emerge.run()
self.pretend_package_list[atom] = list(emerge.install_packages.list)
self.pretend_package_list[atom] = list(
emerge.install_packages.list)
return self.pretend_package_list[atom]
def _display_video_install_package(self, package_list, drv_name):
@ -515,8 +523,8 @@ class Builder(Update):
:param drv_name: имя драйвера (PN)
:return:
"""
#asterisk = self.color_print.bold("*")
#ebuild_wrong = TextState.Colors.RED
# asterisk = self.color_print.bold("*")
# ebuild_wrong = TextState.Colors.RED
ebuild_color = TextState.Colors.GREEN
binary_color = TextState.Colors.PURPLE
output_package_list = ", ".join(
@ -528,10 +536,9 @@ class Builder(Update):
wrong_package = any(not x['binary'] and x['PN'] != drv_name
for x in package_list)
if wrong_package:
self.printERROR(_("Depends %s")%output_package_list)
self.printERROR(_("Depends %s") % output_package_list)
else:
self.printSUCCESS(_("Depends %s")%output_package_list)
self.printSUCCESS(_("Depends %s") % output_package_list)
def fetch_drivers(self, builder_path, builder_distdir, builder_pkgdir):
"""
@ -595,13 +602,12 @@ class Builder(Update):
raise BuilderError(_("Failed to get %s") % drv_name)
except EmergeFetcherError as e:
if e.extension:
self.printPre("\n%s\n"%e.extension)
self.printPre("\n%s\n" % e.extension)
if e.errno == EmergeFetcherError.FetchErrno.NeedManually:
raise BuilderError(
_("Failed to fetch files for %s") % drv_name)
repeat_driver_list.append([drv_name, drv_mask, drv_atom])
if not driver_list and repeat_driver_list:
driver_list = repeat_driver_list
repeat_driver_list = []
@ -720,7 +726,7 @@ class Builder(Update):
mult=mult, package=pkg['CATEGORY/PN']))
return True
def emergelike(self, builder_path, cmd, *params):
def chroot_emergelike(self, builder_path, cmd, *params):
"""
Запуск команды, которая подразумевает выполнение emerge
"""
@ -734,7 +740,7 @@ class Builder(Update):
self._startEmerging(emerge)
return True
def revdep_rebuild(self, builder_path, cmd, *params):
def chroot_revdep_rebuild(self, builder_path, cmd, *params):
"""
Запуск revdep-rebulid
"""
@ -793,7 +799,7 @@ class Builder(Update):
:return:
"""
chroot_path = self.clVars.Get('cl_builder_path')
os.system('/usr/bin/chroot %s /usr/sbin/emaint binhost -f &>/dev/null'%
os.system('/usr/bin/chroot %s /usr/sbin/emaint binhost -f &>/dev/null' %
chroot_path)
def cleanpkg(self):
@ -833,7 +839,7 @@ class Builder(Update):
"%s\nKEYWORDS: amd64 x86" % re_keywords.sub('', x)
for x in data_blocks[1:] if x.strip()]
with writeFile(pathPackages) as f:
f.write("\n\n".join(data_blocks[:1]+modified_blocks))
f.write("\n\n".join(data_blocks[:1] + modified_blocks))
def binaryCleaning(self):
"""Clean binary repository"""
@ -855,18 +861,20 @@ class Builder(Update):
if path.exists(dbPkg) and path.exists(pkgDir):
# get pkg list from distro
pkgList = \
reduce(lambda x,y:x+y,
map(lambda x:map(lambda z:path.join(x,"%s.tbz2"%z),
os.listdir(path.join(dbPkg,x))),
os.listdir(dbPkg)),[])
reduce(lambda x, y: x + y,
map(lambda x: map(
lambda z: path.join(x, "%s.tbz2" % z),
os.listdir(path.join(dbPkg, x))),
os.listdir(dbPkg)), [])
# get binary packages
binList = \
reduce(lambda x,y:x+y,
map(lambda x:map(lambda z:path.join(x,z)[len(pkgDir)+1:],
os.listdir(path.join(x))),
filter(lambda x:path.isdir(x),
map(lambda x:path.join(pkgDir,x),
os.listdir(pkgDir)))),[])
reduce(lambda x, y: x + y,
map(lambda x: map(
lambda z: path.join(x, z)[len(pkgDir) + 1:],
os.listdir(path.join(x))),
filter(lambda x: path.isdir(x),
map(lambda x: path.join(pkgDir, x),
os.listdir(pkgDir)))), [])
# remove files which in binary and not in db/pkg
removeList = list(set(binList) - set(pkgList))
@ -879,12 +887,12 @@ class Builder(Update):
removeList))
# remove empty directories
map(lambda x:os.rmdir(x),
filter(lambda x:path.isdir(x) and not os.listdir(x),
map(lambda x:path.join(pkgDir,x),
os.listdir(pkgDir))))
map(lambda x: os.rmdir(x),
filter(lambda x: path.isdir(x) and not os.listdir(x),
map(lambda x: path.join(pkgDir, x),
os.listdir(pkgDir))))
self.regenPackages(chrootPath,pkgDir[len(chrootPath):])
self.regenPackages(chrootPath, pkgDir[len(chrootPath):])
except OSError as e:
raise BuilderError(str(e))
return True
@ -1032,7 +1040,7 @@ class Builder(Update):
force=True)
return True
def create_dev_nodes(self,directory):
def create_dev_nodes(self, directory):
"""Create nodes for dev http://dev.gentoo.org/~a3li/openrc.txt"""
devPath = path.join(directory, "dev")
# clean dev
@ -1063,7 +1071,7 @@ class Builder(Update):
dv = self.clVars
if any(search_worked_process2(dv, filter_func=filter_func)):
raise BuilderError(_("Builder action for %s is already running. "
"Try to run later.")%build_id)
"Try to run later.") % build_id)
return True
def check_chroot_run(self):
@ -1076,12 +1084,11 @@ class Builder(Update):
if programs:
raise BuilderError(
_("Chrooted {cmd} has already run into {id}").format(
cmd=programs[0].split('\x00')[0],
id=self.clVars.Get('cl_builder_id')
))
cmd=programs[0].split('\x00')[0],
id=self.clVars.Get('cl_builder_id')
))
return True
def update_menu(self, dn):
with IsoDistributive(dn) as iso:
d = iso.getDirectory()
@ -1092,6 +1099,7 @@ class Builder(Update):
self.clVars.getInfo('cl_builder_videodrv_set').autodetect = True
self.clVars.Invalidate('cl_builder_videodrv_set', force=True)
from calculate.lib.cl_template import templateFunction
templateFunction.installProg = {}
templateFunction.installCategory = []
self.applyTemplates(d, False, False, root_path)
@ -1108,7 +1116,7 @@ class Builder(Update):
if path.exists(flashTmp) and not listDirectory(flashTmp):
try:
os.rmdir(flashTmp)
except (OSError,IOError) as e:
except (OSError, IOError) as e:
self.printWARNING(str(e))
return True
@ -1175,8 +1183,8 @@ class Builder(Update):
if listDirectory(old_path):
if path.exists(new_path):
for fn in listDirectory(old_path):
old_fn = path.join(old_path,fn)
new_fn = path.join(new_path,fn)
old_fn = path.join(old_path, fn)
new_fn = path.join(new_path, fn)
if path.exists(new_fn):
os.unlink(new_fn)
os.rename(old_fn, new_fn)

@ -1,4 +1,4 @@
#-*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2015 Calculate Ltd. http://www.calculate-linux.org
#
@ -13,13 +13,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from calculate.lib.datavars import DataVars
from calculate.lib.utils.tools import AddonError
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_builder3',sys.modules[__name__])
setLocalTranslate('cl_builder3', sys.modules[__name__])
builder_data = "/var/lib/calculate/calculate-builder"

@ -18,11 +18,10 @@ import sys
from os import path
from calculate.lib.utils.files import isMount
from calculate.lib.utils.tools import Locker, LockError
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate, _)
from .datavars import builder_data
import hashlib
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
import random
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -33,9 +32,9 @@ class DriveSpool(object):
"""
spool_data = path.join('/run/calculate/drives_lock')
def __init__(self, devices, shuf=True):
def __init__(self, devices, shuffle=True):
self.devices = devices
if shuf:
if shuffle:
random.shuffle(self.devices)
self.devices = iter(self.devices)
self.lockers = []
@ -52,13 +51,13 @@ class DriveSpool(object):
def lock_device(self, device):
if self.check_device(device) and not isMount(device):
device_hashfn = path.join(self.spool_data, self.device_id(device))
locker = Locker(fn=device_hashfn, timeout=0)
device_hash_fn = path.join(self.spool_data, self.device_id(device))
locker = Locker(fn=device_hash_fn, timeout=0)
try:
locker.acquire()
self.lockers.append(locker)
return True
except LockError as e:
except LockError:
return False
def get(self):

@ -19,16 +19,19 @@ import sys
from calculate.update.emerge_parser import EmergeInformationBlock
from calculate.lib.utils.portage import EmergePackage
_ = lambda x: x
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate, _)
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class EmergePackageFetch(EmergePackage):
files = []
class EmergeFetcherError(Exception):
class FetchErrno:
class FetchErrno(object):
Generic = 0
Lock = 1
NeedManually = 2
@ -38,12 +41,13 @@ class EmergeFetcherError(Exception):
self.errno = errno
self.extension = extension
class EmergeFetcher(object):
_color_block = EmergeInformationBlock._color_block
_new_line = EmergeInformationBlock._new_line
re_fetching = re.compile(
">>> Fetching \({c}\d+{c} of {c}\d+{c}\) {c}(.*?){c}{nl}(.*?)"
"(?=>>> Fetching|$)".format(c=_color_block, nl=_new_line), re.S)
"(?=>>> Fetching|$)".format(c=_color_block, nl=_new_line), re.S)
re_filename = re.compile("^{c} [*] {c}(\S+).*;-\)".format(c=_color_block),
re.M)
@ -53,7 +57,7 @@ class EmergeFetcher(object):
def __init__(self, emerge_command):
"""
:param package_list: список пакетов типа (EmergeUpdateInfo)
:param emerge_command: команда emerge
:return:
"""
self.emerge_command = emerge_command
@ -65,10 +69,9 @@ class EmergeFetcher(object):
errno=EmergeFetcherError.FetchErrno.Lock)
if self.manually_token in data:
extension = re.search(
"{nl}( {c}\*{c} The driver.*to be downloaded.*?){nl}{nl}".format(
c=self._color_block,
nl=self._new_line,
), data, re.S)
"{nl}( {c}\*{c} The driver.*to be downloaded.*?)"
"{nl}{nl}".format(c=self._color_block,
nl=self._new_line), data, re.S)
if extension:
extension = extension.group(1)
else:
@ -92,4 +95,3 @@ class EmergeFetcher(object):
def failed(self):
return self.emerge_command.failed()

@ -20,9 +20,10 @@ from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)

@ -22,10 +22,11 @@ from calculate.lib.utils.files import FilesError
from calculate.update.emerge_parser import EmergeError
from calculate.update.update import UpdateError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError, IsoDistributive
from calculate.builder.variables.action import Actions
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -115,7 +116,8 @@ class ClBuilderImageAction(Action):
IsoDistributive)
},
{'name': 'squash_action',
'method': 'Builder.set_builder_action("%s")'%Actions.ImageSquash,
'method': ('Builder.set_builder_action("%s")'
% Actions.ImageSquash),
},
{'name': 'count_files',
'method': 'Builder.recount_files(cl_builder_path,'
@ -130,13 +132,13 @@ class ClBuilderImageAction(Action):
'False,False,None)',
},
{'name': 'squash_action',
'method': 'Builder.set_builder_action("%s")'%Actions.ImageIso,
'method': 'Builder.set_builder_action("%s")' % Actions.ImageIso,
},
{'name': 'protect_off',
'method': 'Builder.setVariable("cl_protect_use_set","off",True)'
},
# сборка iso
{'name':'remove_list_digest',
{'name': 'remove_list_digest',
'method': "Builder.remove_list_digest(cl_builder_image_filename)"
},
{'name': 'unpack',

@ -15,17 +15,18 @@
# limitations under the License.
import sys
from calculate.core.server.func import Action, Tasks
from calculate.core.server.func import Action
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError
from calculate.update.emerge_parser import EmergeError
from calculate.update.update import UpdateError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError
from calculate.install.distr import DistributiveError, IsoDistributive
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError
from calculate.builder.variables.action import Actions
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -39,7 +40,7 @@ class ClBuilderMenuAction(Action):
TemplatesError,
BuilderError, GitError, EmergeError)
successMessage =__("Boot menu updated successfully")
successMessage = __("Boot menu updated successfully")
failedMessage = __("Failed to update boot menu")
interruptMessage = __("Boot menu updating manually interrupted")
@ -47,7 +48,7 @@ class ClBuilderMenuAction(Action):
tasks = [
{'name': 'mount_flash',
'method': 'Builder.remount_rw(cl_builder_flash_path)',
},
},
{'name': 'iso_linux_migrate',
'method': 'Builder.iso_migrate(cl_builder_flash_path)'
},

@ -20,9 +20,10 @@ from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -47,13 +48,13 @@ class ClBuilderPrepareAction(Action):
'message': __("Formatting the partitions"),
'method': 'Install.format(cl_builder_target)',
'condition': lambda Get: Get('cl_builder_target').needFormat
},
},
# распаковка дистрибутива
{'name': 'unpack',
'message': __("Unpacking the system image to the target"),
'method': 'Install.unpack(cl_builder_source,cl_builder_target,'
'os_builder_linux_files)',
},
},
# подмонтировать необходимые данные
{'name': 'mount',
'message': __("Mounting resources"),
@ -68,14 +69,14 @@ class ClBuilderPrepareAction(Action):
{'name': 'save',
'method': 'Builder.save_build(cl_builder_build,'
'cl_builder_linux_datavars)',
},
},
# закрепить подключенные данные
{'name': 'detach',
'method': 'Builder.detach_target(cl_builder_target)',
},
{'name':'close_build',
},
{'name': 'close_build',
'warning': _("Umount distributives"),
'method': 'Builder.close_build(cl_builder_build)',
'depend': Tasks.failed(),
'condition': lambda Get: Get('cl_builder_build')
}]
}]

@ -18,12 +18,13 @@ import sys
from calculate.core.server.func import Action, Tasks
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError, isMount
from calculate.lib.utils.files import FilesError
from calculate.update.update import UpdateError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError, isPkgInstalled
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -56,7 +57,7 @@ class ClBuilderProfileAction(Action):
Get('cl_builder_profile_storage').is_local(
Get('cl_builder_profile_url'),
Get('cl_builder_profile_branch')))
},
},
{'name': 'reconfigure_vars1',
'method': 'Builder.invalidateVariables("cl_builder_profile_storage")',
'depend': Tasks.has('migrate_repository')
@ -80,16 +81,16 @@ class ClBuilderProfileAction(Action):
'foreach': 'cl_builder_profile_sync_rep',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncRepositories(eachvar)',
},
},
{'name': 'regen_cache',
'foreach': 'cl_builder_sync_overlay_rep',
'essential': False,
'method': 'Builder.regenCache(eachvar)',
},
},
{'name': 'eix_update',
'message': __("Updating the eix cache"),
'method': 'Builder.eixUpdate(cl_builder_repository_name)',
},
},
# save
{'name': 'save',
'method': 'Builder.save_build(cl_builder_build,'
@ -102,7 +103,7 @@ class ClBuilderProfileAction(Action):
"sync_other_reps",
"emerge_metadata",
"eix_update")),
}
}
]
},
{'name': 'reps_synchronization',
@ -114,9 +115,10 @@ class ClBuilderProfileAction(Action):
'method': 'Builder.set_profile('
'cl_builder_profile_system_shortname,cl_builder_path)'
},
#{'name': 'merge_utils',
# {'name': 'merge_utils',
# 'message': __("Calculating dependencies"),
# 'method': 'Builder.emerge("-console -pxe","-1","sys-apps/calculate-utils")',
# 'method': 'Builder.emerge("-console -pxe","-1",'
# '"sys-apps/calculate-utils")',
# # TODO: возможно добавить параметр необходимости установки
# 'condition': lambda Get: not isPkgInstalled(
# 'sys-apps/calculate-utils', Get('cl_builder_path'))
@ -130,19 +132,19 @@ class ClBuilderProfileAction(Action):
Get('update.cl_update_skip_setup_set') == 'off')
},
{'name': 'fix_settings',
'message': __("Fixing the settings"),
'method': 'Builder.apply_templates(cl_builder_path,'
'cl_template_clt_set,True,None,False,"sync",'
'cl_builder_profile_datavars)',
'condition': lambda Get: Get('cl_templates_locate')
'message': __("Fixing the settings"),
'method': 'Builder.apply_templates(cl_builder_path,'
'cl_template_clt_set,True,None,False,"sync",'
'cl_builder_profile_datavars)',
'condition': lambda Get: Get('cl_templates_locate')
},
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method':'Builder.dispatchConf(None,cl_builder_path)',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method': 'Builder.dispatchConf(None,cl_builder_path)',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
},
]
},
},
{'name': 'failed',
'error': __("Failed to update the profile"),
'depend': (Tasks.failed() & Tasks.hasnot("interrupt") &

@ -20,9 +20,10 @@ from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError, isMount
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError
from calculate.lib.utils.git import GitError
from calculate.install.distr import DistributiveError
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)

@ -18,33 +18,23 @@ import sys
from calculate.core.server.func import Action, Tasks
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError, isMount
from calculate.lib.utils.files import FilesError
from calculate.update.emerge_parser import EmergeError
from calculate.update.update import UpdateError
from ..datavars import BuilderError
from calculate.lib.utils.portage import GitError, isPkgInstalled, \
EmergeLogNamedTask, PackageList, EmergeLog
from calculate.lib.utils.git import GitError
from calculate.lib.utils.portage import (EmergeLogNamedTask,
PackageList, EmergeLog)
from calculate.install.distr import DistributiveError
from os import path
from calculate.update.update_tasks import EmergeMark
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class ClBuilderUpdateAction(Action):
"""
Действие обновление конфигурационных файлов
"""
# ошибки, которые отображаются без подробностей
native_error = (DistributiveError, FilesError, UpdateError,
TemplatesError,
BuilderError, GitError, EmergeError)
successMessage = None
failedMessage = None
interruptMessage = __("System update manually interrupted")
class BuilderConditions(object):
@staticmethod
def was_installed(pkg, task_name):
def func(Get):
task = EmergeLog(EmergeLogNamedTask(task_name),
@ -53,6 +43,7 @@ class ClBuilderUpdateAction(Action):
return func
@staticmethod
def need_depclean(pkg, task_name):
def func(Get):
task = EmergeLog(EmergeLogNamedTask(task_name),
@ -61,259 +52,289 @@ class ClBuilderUpdateAction(Action):
return func
class ClBuilderUpdateAction(Action):
"""
Действие обновление конфигурационных файлов
"""
# ошибки, которые отображаются без подробностей
native_error = (DistributiveError, FilesError, UpdateError,
TemplatesError,
BuilderError, GitError, EmergeError)
successMessage = None
failedMessage = None
interruptMessage = __("System update manually interrupted")
# список задач для действия
tasks = [
{'name': 'check_build_run',
'method': 'Builder.check_build_run()'},
{'name': 'check_chroot_run',
'method': 'Builder.check_chroot_run()'},
{'name': 'clear_log',
'method': 'Builder.clear_log(cl_builder_id_path)',
},
{'name': 'apply_template',
'message': __("Configuring build"),
'method': 'Builder.applyTemplates(cl_builder_target,False,False,None)',
},
{'name': 'invalidate_vars',
'method': 'Builder.invalidateVariables("cl_builder_linux_datavars")'
},
{'name': 'reconfigure_vars',
'method': 'Builder.reconfigureProfileVars(cl_builder_linux_datavars,'
'cl_builder_path)'
},
{'name': 'apply_branch_vars',
'method': 'Builder.apply_branch_variables()'
},
{'name': 'reps_synchronization',
'group': __("Repositories synchronization"),
'tasks': [
# запасная синхронизация, в ходе которой ветки обновляются до
# master
{'name': 'sync_reps_fallback',
'foreach': 'cl_builder_sync_rep',
'message':
__("Fallback syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncRepositories(eachvar)',
'condition': lambda Get: (
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
# обновление переменных информации из binhost
{'name': 'invalidate_vars',
'method':
'Builder.invalidateVariables("cl_builder_linux_datavars")',
'condition': lambda Get: (
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
{'name': 'binhost_unavailable',
'error': __("Update server is unavailable"),
'condition': lambda Get:(
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
{'name': 'sync_reps',
'foreach': 'cl_builder_sync_rep',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncRepositories(eachvar)',
'condition': lambda Get: Get('cl_builder_sync_rep')
},
{'name': 'check_binhost',
'method': 'Builder.check_binhost(True)',
'condition': lambda Get: Get('cl_builder_binary_set') == "on"
},
{'name': 'sync_other_reps',
'foreach': 'builder.cl_builder_other_rep_name',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncLaymanRepository(eachvar)',
'condition': lambda Get: Get('update.cl_update_other_set') == 'on'
},
{'name': 'regen_cache',
'foreach': 'cl_builder_sync_overlay_rep',
'essential': False,
'method': 'Builder.regenCache(eachvar)',
'condition': (lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_egencache_force') != 'skip' or
Get('update.cl_update_egencache_force') == 'force'))
},
{'name': 'eix_update',
'message': __("Updating the eix cache"),
'method': 'Builder.eixUpdate(cl_builder_repository_name)',
'condition': (lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_eixupdate_force') != 'skip' or
Get('update.cl_update_eixupdate_force') == 'force'))
},
{'name': 'sync_reps:cleanpkg',
'message': __("Removing obsolete distfiles and binary packages"),
'method': 'Builder.cleanpkg()',
'condition': lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_cleanpkg_set') == 'on'),
'essential': False
},
# сообщение удачного завершения при обновлении репозиториев
{'name': 'success_syncrep',
'message': __("Synchronization finished"),
'depend': (Tasks.success() & Tasks.has_any("sync_reps",
"sync_other_reps",
"emerge_metadata",
"eix_update")),
}
]
},
{'name': 'reps_synchronization',
'group': __("System configuration"),
'tasks': [
{'name': 'revision',
'message': __("Fixing the settings"),
'method': 'Builder.apply_templates(cl_builder_path,'
'cl_template_clt_set,True,None,False,"sync",'
'cl_builder_linux_datavars)',
'condition': lambda Get: Get('cl_templates_locate')
},
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method': 'Builder.dispatchConf(None,cl_builder_path)',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
},
]
},
{'name': 'emerge_update_world',
'group': __("Updating packages"),
'tasks': [
{'name': 'update_world',
'message': __("Calculating dependencies"),
'method': 'Builder.emerge_ask(update.cl_update_pretend_set,'
'"-uDN","--changed-deps",'
'"--with-bdeps=y","@world")'
}
],
'condition': lambda Get: (
Get('update.cl_update_sync_only_set') == 'off')
},
{'name': 'update_other',
'condition': lambda Get: (
Get('update.cl_update_pretend_set') == 'off' and
Get('update.cl_update_sync_only_set') == 'off')
},
{'name': 'update_other:group_changed_packages',
'group': __("Rebuild modified packages"),
'tasks': [
{'name': 'changed_packages',
'message': __("Calculating dependencies"),
'method': 'Builder.rebuild_changed_packages(cl_builder_path,'
'cl_builder_repository_data)',
'condition': lambda Get:
Get('cl_builder_rebuild_changed_set') == 'on'
}
]
},
{'name': 'update_other:update_python',
'group': __("Updating Python"),
'tasks': [
{'name': 'python_updater',
'message': __('Find & rebuild packages broken due '
'to a Python upgrade'),
'method': 'Builder.emergelike(cl_builder_path,"python-updater")',
'condition': was_installed('dev-lang/python$',
EmergeMark.PythonUpdater),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.PythonUpdater
},
]
},
{'name': 'update_other:update_perl',
'group': __("Updating Perl"),
'tasks': [
{'name': 'perl_cleaner',
'message': __('Find & rebuild packages and Perl header files '
'broken due to a perl upgrade'),
'method': 'Builder.emergelike(cl_builder_path,"perl-cleaner",'
'"all")',
'condition': was_installed('dev-lang/perl$',
EmergeMark.PerlCleaner),
'decoration': 'Builder.update_task("%s")' % EmergeMark.PerlCleaner
},
]
},
{'name': 'update_other:depclean',
'group': __("Cleaning the system from needless packages"),
'tasks': [
{'name': 'update_depclean',
'message': __("Calculating dependencies"),
'method': 'Builder.depclean()',
},
]
},
{'name': 'update_world:update_modules',
'group': __("Rebuilding dependent modules"),
'tasks': [
{'name': 'update_world:module_rebuild',
'message': __('Updating Kernel modules'),
'method': 'Builder.emerge(cl_builder_path,"","@module-rebuild")',
'condition': was_installed('sys-kernel/.*source',
EmergeMark.KernelModules),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.KernelModules
},
{'name': 'update_world:x11_module_rebuild',
'message': __('Updating X.Org server modules'),
'method': 'Builder.emerge(cl_builder_path,"",'
'"@x11-module-rebuild")',
'condition': was_installed('x11-base/xorg-server',
EmergeMark.XorgModules),
'decoration': 'Builder.update_task("%s")' % EmergeMark.XorgModules
},
{'name': 'update_world:preserved_rebuild',
'message': __('Updating preserved libraries'),
'method': 'Builder.emerge(cl_builder_path,"",'
'"@preserved-rebuild")',
'condition': was_installed('.*', EmergeMark.PreservedLibs),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.PreservedLibs
},
{'name': 'update_world:revdev_rebuild',
'message': __('Checking reverse dependencies'),
'method': 'Builder.revdep_rebuild(cl_builder_path,'
'"revdep-rebuild")',
'condition': lambda Get: (
Get('update.cl_update_skip_rb_set') == 'off' and
ClBuilderUpdateAction.was_installed(
'.*', EmergeMark.RevdepRebuild)(Get)),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.RevdepRebuild
},
{'name': 'update_world:dispatch_conf_end',
'message': __("Updating configuration files"),
'method': 'Builder.dispatchConf()',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
},
{'name': 'update_world:binary_cleaning',
'message': __("Cleaning the binary repository"),
'method': 'Builder.binaryCleaning()',
'condition': lambda Get: Get('cl_builder_binary_set') == "off"
},
],
'depend': Tasks.has("update_other")
},
{'name': 'update_other:reading_news',
'method': 'Builder.reading_news(cl_builder_path)',
'essential': False
},
{'name': 'update_other:check_obsolete',
'method': 'Builder.check_obsolete(cl_builder_path)'
}
] + [
{'name': 'failed',
'error': __("Failed to update the system"),
'depend': (Tasks.failed() & Tasks.hasnot("interrupt") &
Tasks.success_all("check_build_run"))
},
# сообщение удачного завершения при обновлении ревизии
{'name': 'update_other:success_rev',
'message': __("The system was successfully updated"),
}
]
was_installed = staticmethod(was_installed)
{'name': 'check_build_run',
'method': 'Builder.check_build_run()'},
{'name': 'check_chroot_run',
'method': 'Builder.check_chroot_run()'},
{'name': 'clear_log',
'method': 'Builder.clear_log(cl_builder_id_path)',
},
{'name': 'apply_template',
'message': __("Configuring build"),
'method': 'Builder.applyTemplates(cl_builder_target,False,'
'False,None)',
},
{'name': 'invalidate_vars',
'method': 'Builder.invalidateVariables('
'"cl_builder_linux_datavars")'
},
{'name': 'reconfigure_vars',
'method': 'Builder.reconfigureProfileVars('
'cl_builder_linux_datavars,cl_builder_path)'
},
{'name': 'apply_branch_vars',
'method': 'Builder.apply_branch_variables()'
},
{'name': 'reps_synchronization',
'group': __("Repositories synchronization"),
'tasks': [
# запасная синхронизация, в ходе которой ветки
# обновляются до master
{'name': 'sync_reps_fallback',
'foreach': 'cl_builder_sync_rep',
'message':
__("Fallback syncing the {eachvar:capitalize} "
"repository"),
'method': 'Builder.syncRepositories(eachvar)',
'condition': lambda Get: (
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
# обновление переменных информации из binhost
{'name': 'invalidate_vars',
'method':
'Builder.invalidateVariables('
'"cl_builder_linux_datavars")',
'condition': lambda Get: (
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
{'name': 'binhost_unavailable',
'error': __("Update server is unavailable"),
'condition': lambda Get: (
Get('cl_builder_binary_set') == "on" and
not Get('update.cl_update_binhost_data')[0])
},
{'name': 'sync_reps',
'foreach': 'cl_builder_sync_rep',
'message': __(
"Syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncRepositories(eachvar)',
'condition': lambda Get: Get('cl_builder_sync_rep')
},
{'name': 'check_binhost',
'method': 'Builder.check_binhost(True)',
'condition': lambda Get: Get(
'cl_builder_binary_set') == "on"
},
{'name': 'sync_other_reps',
'foreach': 'builder.cl_builder_other_rep_name',
'message': __(
"Syncing the {eachvar:capitalize} repository"),
'method': 'Builder.syncLaymanRepository(eachvar)',
'condition': lambda Get: Get(
'update.cl_update_other_set') == 'on'
},
{'name': 'regen_cache',
'foreach': 'cl_builder_sync_overlay_rep',
'essential': False,
'method': 'Builder.regenCache(eachvar)',
'condition': (lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_egencache_force') != 'skip' or
Get('update.cl_update_egencache_force') == 'force'))
},
{'name': 'eix_update',
'message': __("Updating the eix cache"),
'method': 'Builder.eixUpdate(cl_builder_repository_name)',
'condition': (lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_eixupdate_force') != 'skip' or
Get('update.cl_update_eixupdate_force') == 'force'))
},
{'name': 'sync_reps:cleanpkg',
'message': __(
"Removing obsolete distfiles and binary packages"),
'method': 'Builder.cleanpkg()',
'condition': lambda Get: (
Get('builder.cl_builder_outdate_set') == 'on' and
Get('update.cl_update_cleanpkg_set') == 'on'),
'essential': False
},
# сообщение удачного завершения при обновлении репозиториев
{'name': 'success_syncrep',
'message': __("Synchronization finished"),
'depend': (Tasks.success() & Tasks.has_any(
"sync_reps", "sync_other_reps", "emerge_metadata",
"eix_update")),
}
]
},
{'name': 'reps_synchronization',
'group': __("System configuration"),
'tasks': [
{'name': 'revision',
'message': __("Fixing the settings"),
'method': 'Builder.apply_templates(cl_builder_path,'
'cl_template_clt_set,True,None,False,"sync",'
'cl_builder_linux_datavars)',
'condition': lambda Get: Get('cl_templates_locate')
},
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method': 'Builder.dispatchConf(None,cl_builder_path)',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
},
]
},
{'name': 'emerge_update_world',
'group': __("Updating packages"),
'tasks': [
{'name': 'update_world',
'message': __("Calculating dependencies"),
'method': 'Builder.emerge_ask('
'update.cl_update_pretend_set,'
'"-uDN","--changed-deps",'
'"--with-bdeps=y","@world")'
}
],
'condition': lambda Get: (
Get('update.cl_update_sync_only_set') == 'off')
},
{'name': 'update_other',
'condition': lambda Get: (
Get('update.cl_update_pretend_set') == 'off' and
Get('update.cl_update_sync_only_set') == 'off')
},
{'name': 'update_other:group_changed_packages',
'group': __("Rebuild modified packages"),
'tasks': [
{'name': 'changed_packages',
'message': __("Calculating dependencies"),
'method': 'Builder.rebuild_changed_packages('
'cl_builder_path,'
'cl_builder_repository_data)',
'condition': lambda Get:
Get('cl_builder_rebuild_changed_set') == 'on'
}
]
},
{'name': 'update_other:update_python',
'group': __("Updating Python"),
'tasks': [
{'name': 'python_updater',
'message': __('Find & rebuild packages broken due '
'to a Python upgrade'),
'method': 'Builder.chroot_emergelike(cl_builder_path,'
'"python-updater")',
'condition': BuilderConditions.was_installed(
'dev-lang/python$', EmergeMark.PythonUpdater),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.PythonUpdater
},
]
},
{'name': 'update_other:update_perl',
'group': __("Updating Perl"),
'tasks': [
{'name': 'perl_cleaner',
'message': __(
'Find & rebuild packages and Perl header files '
'broken due to a perl upgrade'),
'method': 'Builder.chroot_emergelike(cl_builder_path,'
'"perl-cleaner","all")',
'condition': BuilderConditions.was_installed(
'dev-lang/perl$', EmergeMark.PerlCleaner),
'decoration': 'Builder.update_task("%s")'
% EmergeMark.PerlCleaner
},
]
},
{'name': 'update_other:depclean',
'group': __("Cleaning the system from needless packages"),
'tasks': [
{'name': 'update_depclean',
'message': __("Calculating dependencies"),
'method': 'Builder.depclean()',
},
]
},
{'name': 'update_world:update_modules',
'group': __("Rebuilding dependent modules"),
'tasks': [
{'name': 'update_world:module_rebuild',
'message': __('Updating Kernel modules'),
'method': 'Builder.emerge(cl_builder_path,"",'
'"@module-rebuild")',
'condition': BuilderConditions.was_installed(
'sys-kernel/.*source', EmergeMark.KernelModules),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.KernelModules
},
{'name': 'update_world:x11_module_rebuild',
'message': __('Updating X.Org server modules'),
'method': 'Builder.emerge(cl_builder_path,"",'
'"@x11-module-rebuild")',
'condition': BuilderConditions.was_installed(
'x11-base/xorg-server', EmergeMark.XorgModules),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.XorgModules
},
{'name': 'update_world:preserved_rebuild',
'message': __('Updating preserved libraries'),
'method': 'Builder.emerge(cl_builder_path,"",'
'"@preserved-rebuild")',
'condition': BuilderConditions.was_installed(
'.*', EmergeMark.PreservedLibs),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.PreservedLibs
},
{'name': 'update_world:revdev_rebuild',
'message': __('Checking reverse dependencies'),
'method': 'Builder.chroot_revdep_rebuild(cl_builder_path,'
'"revdep-rebuild")',
'condition': lambda Get: (
Get('update.cl_update_skip_rb_set') == 'off' and
BuilderConditions.was_installed(
'.*', EmergeMark.RevdepRebuild)(Get)),
'decoration': 'Builder.update_task("%s")' %
EmergeMark.RevdepRebuild
},
{'name': 'update_world:dispatch_conf_end',
'message': __("Updating configuration files"),
'method': 'Builder.dispatchConf()',
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
},
{'name': 'update_world:binary_cleaning',
'message': __("Cleaning the binary repository"),
'method': 'Builder.binaryCleaning()',
'condition': lambda Get: Get(
'cl_builder_binary_set') == "off"
},
],
'depend': Tasks.has("update_other")
},
{'name': 'update_other:reading_news',
'method': 'Builder.reading_news(cl_builder_path)',
'essential': False
},
{'name': 'update_other:check_obsolete',
'method': 'Builder.check_obsolete(cl_builder_path)'
}
] + [
{'name': 'failed',
'error': __("Failed to update the system"),
'depend': (Tasks.failed() & Tasks.hasnot("interrupt") &
Tasks.success_all("check_build_run"))
},
# сообщение удачного завершения при обновлении ревизии
{'name': 'update_other:success_rev',
'message': __("The system was successfully updated"),
}
]

@ -15,13 +15,14 @@
# limitations under the License.
import sys
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.datavars import ActionVariable
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_builder3', sys.modules[__name__])
class Actions:
class Actions(object):
Prepare = "prepare"
Image = "image"
Break = "break"
@ -39,57 +40,58 @@ class Actions:
ImageMenu = "menu"
PrepareAssemble = "prepare"
class VariableAcBuilderSquash(ReadonlyVariable):
class VariableAcBuilderSquash(ActionVariable):
"""
Action variable which has value "on" for prepare squash
"""
def get(self):
action = self.Get("cl_action")
def action(self, cl_action):
image_action = self.Get('cl_builder_action')
if action == Actions.Image and image_action == Actions.ImageSquash:
if cl_action == Actions.Image and image_action == Actions.ImageSquash:
return "on"
return "off"
class VariableAcBuilderIso(ReadonlyVariable):
class VariableAcBuilderIso(ActionVariable):
"""
Action variable which has value "on" for prepare iso
"""
def get(self):
action = self.Get("cl_action")
def action(self, cl_action):
image_action = self.Get('cl_builder_action')
if action == Actions.Image and image_action in (Actions.ImageIso,
Actions.ImageMenu):
if cl_action == Actions.Image and image_action in (Actions.ImageIso,
Actions.ImageMenu):
return "on"
return "off"
class VariableAcBuilderSetup(ReadonlyVariable):
class VariableAcBuilderSetup(ActionVariable):
"""
Action variable which has value "on" for setup build directory
"""
def get(self):
action = self.Get('cl_action')
if (action in (Actions.Prepare, Actions.Update) and
def action(self, cl_action):
if (cl_action in (Actions.Prepare, Actions.Update) and
not self.GetBool('cl_builder_stage_set')):
return "on"
image_action = self.Get('cl_builder_action')
if (action in (Actions.Image,) and
if (cl_action in (Actions.Image,) and
image_action == Actions.PrepareAssemble):
return "on"
return "off"
class VariableAcBuilderPrepare(ReadonlyVariable):
class VariableAcBuilderPrepare(ActionVariable):
"""
Action variable which has value "on" for setup build directory
"""
def get(self):
action = self.Get('cl_action')
if action in (Actions.Prepare, Actions.Update):
def action(self, cl_action):
if cl_action in (Actions.Prepare, Actions.Update):
return "on"
image_action = self.Get('cl_builder_action')
if (action in (Actions.Image,) and
if (cl_action in (Actions.Image,) and
image_action == Actions.PrepareAssemble):
return "on"
return "off"

@ -23,7 +23,7 @@ from calculate.install.distr import DistributiveError, IsoDistributive
from calculate.install.variables.kernel import KernelConfig
from calculate.lib.utils.dracut import Dracut
from calculate.lib.utils.portage import getSquashList
from calculate.lib.variables.system import VariableOsRootType, RootType
from calculate.lib.variables.system import RootType
from .action import Actions
from calculate.install import distr
from calculate.lib.utils.device import getUdevDeviceInfo, humanreadableSize
@ -45,16 +45,6 @@ from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_builder3', sys.modules[__name__])
def debug(func):
@wraps(func)
def _wrapped_func(*args, **kw):
ret = func(*args, **kw)
print "MYDEBUG", ret
return ret
return _wrapped_func
def is_action(*available_action, **action_kwargs):
def decorator(func):
@wraps(func)
@ -69,14 +59,6 @@ def is_action(*available_action, **action_kwargs):
return decorator
def as_list(func):
@wraps(func)
def _wrapped_func(self, *args, **kw):
return list(func(self, *args, **kw))
return _wrapped_func
class VariableClBuilderStorage(ReadonlyVariable):
type = "object"
@ -162,6 +144,7 @@ class VariableClBuilderSourceFilename(Variable):
opt = ["--source"]
metavalue = "SOURCE"
untrusted = True
check_after = ["cl_builder_layered_set"]
def init(self):
self.label = _("Source image")
@ -171,6 +154,11 @@ class VariableClBuilderSourceFilename(Variable):
"""Set image file"""
if self.Get('cl_action') in Actions.NewAssemble and not isoimage:
raise VariableError(_("You need to select a source image"))
if self.GetBool('cl_builder_layered_set'):
if not isinstance(self.Get('cl_builder_source'),
IsoDistributive):
raise VariableError(
_("Wrong source distributive for layered build"))
shortname = self.Get('os_builder_linux_shortname')
build = self.Get('os_builder_linux_build')
arch = self.Get('os_builder_arch_machine')
@ -257,7 +245,9 @@ class VariableClBuilderDiskDev(Variable):
dn = base_name
full_dn = path.join(default_path, dn)
if ((not path.exists(full_dn) or not isMount(full_dn)) and
ds is None or ds.lock_device(full_dn)):
ds is None or
isinstance(ds, DriveSpool) and
ds.lock_device(full_dn)):
return full_dn
else:
return ""
@ -420,9 +410,12 @@ class VariableClBuilderPath(ReadonlyVariable):
"""
def get(self):
image = self.Get('cl_builder_target')
if image:
return image.getDirectory()
try:
image = self.Get('cl_builder_target')
if image:
return image.getDirectory()
except DistributiveError:
return ""
return ""
@ -562,7 +555,6 @@ class VariableClBuilderPreparedId(BaseBuildId):
type = "choice"
untrusted = True
@as_list
def available(self):
bs = self.Get('cl_builder_storage')
action = self.Get('cl_action')
@ -573,12 +565,11 @@ class VariableClBuilderPreparedId(BaseBuildId):
yield x
def get(self):
l = self.available()
l = list(self.available())
if l and len(l) == 1:
return l[0]
return ""
@as_list
def choice(self):
bs = self.Get('cl_builder_storage')
for x in bs:
@ -592,7 +583,7 @@ class VariableClBuilderPreparedId(BaseBuildId):
def check(self, value):
if not value:
raise VariableError(_("Please select the build ID"))
l = self.available()
l = list(self.available())
if not l:
raise VariableError(_("Build %s is not found") % value)
if (self.Get('cl_builder_build').status == Build.Status.Broken and
@ -608,7 +599,6 @@ class VariableClBuilderBrokenId(BaseBuildId):
type = "choice"
untrusted = True
@as_list
def available(self):
bs = self.Get('cl_builder_storage')
for x in bs:
@ -618,12 +608,11 @@ class VariableClBuilderBrokenId(BaseBuildId):
@is_action(Actions.Restore)
def get(self):
l = self.available()
l = list(self.available())
if l and len(l) == 1:
return l[0]
return ""
@as_list
@is_action(Actions.Restore, default_value=[])
def choice(self):
bs = self.Get('cl_builder_storage')
@ -635,7 +624,7 @@ class VariableClBuilderBrokenId(BaseBuildId):
def check(self, value):
if not value:
raise VariableError(_("Please select the build ID"))
l = self.available()
l = list(self.available())
if not l:
raise VariableError(_("Build %s is not found") % value)
@ -778,6 +767,7 @@ class VariableClBuilderImageFilename(Variable):
else:
isoname = "%s-%s-%s.iso" % (shortname, buildnumber,
arch)
fullname = ""
for i_dn in filter(None, (dn, addon_dn)):
fullname = path.join(i_dn, isoname)
if not rewrite and path.exists(fullname):

@ -14,28 +14,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import re
from os import path
import sys
from calculate.lib.utils.portage import isPkgInstalled
from calculate.lib.variables.linux import LinuxDataVars
from calculate.install.distr import IsoDistributive, DistributiveError
from calculate.lib.utils.files import listDirectory
from calculate.lib.datavars import ReadonlyVariable, \
from calculate.lib.datavars import ReadonlyVariable, HumanReadable, \
ReadonlyTableVariable, FieldValue, VariableError, Variable
from calculate.install.variables.system import VariableOsInstallX11ServerSet
from builder import (VariableClBuilderPath, VariableClBuilderKernel,
VariableClBuilderKernelVer, VariableClBuilderInitrdInstall,
VariableClBuilderVideoDriverPath, VariableClBuilderVideodrvSet)
VariableClBuilderKernelVer, VariableClBuilderInitrdInstall,
VariableClBuilderVideoDriverPath,
VariableClBuilderVideodrvSet)
from action import Actions
_ = lambda x:x
_ = lambda x: x
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_builder3', sys.modules[__name__])
class VariableClBuilderIsoLabel(ReadonlyVariable):
"""
Метка в syslinux образе
@ -53,10 +53,12 @@ class VariableClBuilderIsoLabel(ReadonlyVariable):
return self.fullname_format.format(
name=name, ver=ver, subname=subname, arch=arch, build=build)
class VariableClBuilderSplash(ReadonlyVariable):
"""
Тип splash в образе
"""
def get(self):
prefix = self.Get('cl_builder_path')
if isPkgInstalled('media-gfx/splashutils', prefix=prefix):
@ -67,6 +69,7 @@ class VariableClBuilderSplash(ReadonlyVariable):
else:
return ""
class DataVarsBuilderImage(LinuxDataVars):
def variables(self):
l = super(DataVarsBuilderImage, self).variables()
@ -114,7 +117,7 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
if basename not in namelist:
return basename
for n in range(1, 99):
newname = "%s-%d"%(basename,n)
newname = "%s-%d" % (basename, n)
if newname not in namelist:
return newname
raise VariableError(_("Failed to generate kernel name"))
@ -127,7 +130,7 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
return (m.group(1), m.group(2),
-int(m.group(3)) if m.group(3) else 0, m.group(4))
else:
return (x,)
return x,
def generator(self, isopath):
n = 1
@ -149,9 +152,9 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
label = dv['cl_builder_iso_label']
m = numbered.search(iso_image)
if m:
label = "%s-%s"%(label, m.group(1))
label = "%s-%s" % (label, m.group(1))
yield ["cl-%d"%n,
yield ["cl-%d" % n,
label,
iso_image,
kernel, kernel_copy,
@ -164,7 +167,7 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
except DistributiveError:
pass
def get(self, hr=False):
def get(self, hr=HumanReadable.No):
isopath = self.Get('cl_builder_flash_repository')
if self.Get('cl_builder_action') != Actions.ImageMenu or not isopath:
return [[]]
@ -251,6 +254,7 @@ class VariableClBuilderImageDrivers(FieldValue, ReadonlyVariable):
source_variable = "cl_builder_image_data"
column = 8
class VariableClBuilderImageSplash(FieldValue, ReadonlyVariable):
"""
Какой сплэш содержит образ

@ -15,17 +15,15 @@
# limitations under the License.
import sys
import os
from os import path
import re
from os import path
from calculate.install import distr
from calculate.install.distr import DistributiveError
from calculate.lib.datavars import ReadonlyVariable, SimpleDataVars, \
VariableError, ReadonlyTableVariable, FieldValue
from calculate.lib.datavars import (ReadonlyVariable, VariableError,
ReadonlyTableVariable, FieldValue,
HumanReadable)
from calculate.lib.utils.files import pathJoin
from calculate.lib.utils.portage import Layman
from calculate.lib.utils.tools import ignore
from calculate.lib.variables import linux
from calculate.lib.variables import env
from calculate.update.variables import update
from calculate.lib.variables import system, linux
@ -33,8 +31,8 @@ from .action import Actions
from calculate.lib.cl_lang import setLocalTranslate
import datetime
import profiles
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
@ -42,20 +40,24 @@ class BuilderLinux(ReadonlyVariable):
# variable for get current system info (example: os_linux_shortname)
variable = ""
def get_fallback(self):
return ""
def get(self):
try:
dv = self.Get('cl_builder_linux_datavars')
if dv:
return dv[self.variable]
except VariableError:
return ""
if dv:
return dv[self.variable]
else:
return ""
pass
return self.get_fallback()
class DataVarsBuilderLinux(linux.LinuxDataVars):
"""
Упрощенная модель переменных для собираемого образа
"""
def variables(self):
l = super(DataVarsBuilderLinux, self).variables()
return l + [linux.VariableClProfileSystem(),
@ -91,8 +93,10 @@ class DataVarsBuilderLinux(linux.LinuxDataVars):
update.VariableClUpdateBinhostTime(section="update"),
update.VariableClUpdateBinhostTimeout(section="update"),
update.VariableClUpdateBinhostList(section="update"),
update.VariableClUpdateBinhostTimestampPath(section="update"),
update.VariableClUpdateBinhostRevisionPath(section="update"),
update.VariableClUpdateBinhostTimestampPath(
section="update"),
update.VariableClUpdateBinhostRevisionPath(
section="update"),
system.VariableOsArchMachineGentoo()]
@classmethod
@ -102,9 +106,9 @@ class DataVarsBuilderLinux(linux.LinuxDataVars):
if m:
map_arch = {'amd64': 'x86_64', 'x86': 'i686'}
c = {'os_linux_build': m.group(3),
'os_arch_machine':map_arch[m.group(2)],
'os_arch_machine': map_arch[m.group(2)],
'os_linux_shortname': 'Gentoo',
'os_linux_subname': "Stage%s"%m.group(1),
'os_linux_subname': "Stage%s" % m.group(1),
'cl_profile_name': 'Gentoo profile',
'os_linux_name': 'Gentoo'}
else:
@ -123,10 +127,12 @@ class DataVarsBuilderLinux(linux.LinuxDataVars):
def __repr__(self):
return "Builder variables"
class VariableClBuilderBinarySet(ReadonlyVariable):
"""
Собираемый дистрибутив - бинарный FEATURES="getbinpkg"
"""
def get(self):
dv = self.Get('cl_builder_linux_datavars')
if dv:
@ -134,10 +140,12 @@ class VariableClBuilderBinarySet(ReadonlyVariable):
return "on"
return "off"
class VariableClBuilderLinuxDatavars(ReadonlyVariable):
"""
Переменные дистрибутива
"""
def source_data(self):
image = self.Get('cl_builder_source')
image_fn = self.Get('cl_builder_source_filename')
@ -186,6 +194,7 @@ class VariableOsBuilderLinuxVer(BuilderLinux):
def init(self):
self.label = _("Building system version")
class VariableOsBuilderLinuxBuild(BuilderLinux):
"""Shortname of system"""
variable = "os_linux_build"
@ -206,6 +215,15 @@ class VariableOsBuilderArchMachine(BuilderLinux):
"""Shortname of system"""
variable = "os_arch_machine"
def get_fallback(self):
prefix = self.Get('cl_builder_path')
if prefix:
if path.exists(path.join(prefix, 'lib64')):
return 'x86_64'
else:
return 'i686'
return ""
class VariableOsBuilderLinuxFiles(BuilderLinux):
"""Shortname of system"""
@ -225,22 +243,12 @@ class VariableOsBuilderLinuxName(BuilderLinux):
class VariableClBuilderProfileSystem(BuilderLinux):
variable = "cl_profile_system"
#def get(self):
# action = self.Get('cl_action')
# if action == 'create':
# shortname = self.Get('cl_builder_profile_system_shortname')
# profile = self.Select('cl_builder_profile_path',
# where="cl_builder_profile_shortname",
# eq=shortname, limit=1)
# if profile:
# return profile
# return ""
class VariableOsBuilderLinuxSystem(BuilderLinux):
"""
Install system name
"""
def init(self):
self.label = _("System type")
@ -267,6 +275,7 @@ class VariableOsBuilderLinuxFullname(ReadonlyVariable):
return self.fullname_format.format(
name=name, ver=ver, subname=subname, arch=arch, build=build)
class VariableOsBuilderLinuxSubname(BuilderLinux):
"""
Install subname
@ -279,16 +288,19 @@ class VariableOsBuilderLinuxSubname(BuilderLinux):
def humanReadable(self):
return self.Get() or _("no")
class VariableClBuilderPortdirOverlay(ReadonlyVariable):
"""
Пути оверлеев в собираемом образе относительно точки монтирования
"""
def get(self):
return [location
for name, location in
filter(None,self.Get('builder.cl_builder_repository_data'))
filter(None, self.Get('builder.cl_builder_repository_data'))
if name not in ("portage", "gentoo")]
class VariableClBuilderOtherRepData(update.VariableClUpdateOtherRepData):
"""
Информация о прочих репозиториях
@ -298,7 +310,8 @@ class VariableClBuilderOtherRepData(update.VariableClUpdateOtherRepData):
portdir_overlay = "builder.cl_builder_portdir_overlay"
class VariableClBuilderOtherRepName(FieldValue,ReadonlyVariable):
class VariableClBuilderOtherRepName(FieldValue, ReadonlyVariable):
"""
Список имен прочих репозиториев
"""
@ -306,7 +319,8 @@ class VariableClBuilderOtherRepName(FieldValue,ReadonlyVariable):
source_variable = "builder.cl_builder_other_rep_data"
column = 0
class VariableClBuilderOtherRepPath(FieldValue,ReadonlyVariable):
class VariableClBuilderOtherRepPath(FieldValue, ReadonlyVariable):
"""
Список путей до прочих репозиториев
"""
@ -320,7 +334,7 @@ class VariableClBuilderRepositoryData(ReadonlyTableVariable):
"""
source = ["cl_repository_name", "cl_repository_location"]
def get(self):
def get(self, hr=HumanReadable.No):
try:
dv = self.Get('cl_builder_linux_datavars')
if dv:
@ -329,20 +343,23 @@ class VariableClBuilderRepositoryData(ReadonlyTableVariable):
pass
return [[]]
class VariableClBuilderRepositoryName(FieldValue,ReadonlyVariable):
class VariableClBuilderRepositoryName(FieldValue, ReadonlyVariable):
"""
"""
type = "list"
source_variable = "cl_builder_repository_data"
column = 0
class VariableClBuilderRepositoryLocation(FieldValue,ReadonlyVariable):
class VariableClBuilderRepositoryLocation(FieldValue, ReadonlyVariable):
"""
"""
type = "list"
source_variable = "cl_builder_repository_data"
column = 1
class VariableClBuilderSyncOverlayRep(ReadonlyVariable):
"""
Обновляемые репозитории (исключая portage)
@ -361,10 +378,12 @@ class VariableClBuilderSyncOverlayRep(ReadonlyVariable):
else:
return []
class VariableClBuilderLinuxDistdir(ReadonlyVariable):
"""
Полный путь до DISTDIR собираемой системы относительно текущего корня
"""
def get(self):
fallback_distdir = '/var/calculate/remote/distfiles'
dv = self.Get('cl_builder_linux_datavars')
@ -373,10 +392,12 @@ class VariableClBuilderLinuxDistdir(ReadonlyVariable):
return pathJoin(builder_path, dv.Get('cl_distdir'))
return pathJoin(builder_path, fallback_distdir)
class VariableClBuilderLinuxPkgdir(ReadonlyVariable):
"""
Полный путь до PKGDIR собираемой системы относительно текущего корня
"""
def get(self):
fallback_pkgdir = '/var/calculate/remote/packages'
dv = self.Get('cl_builder_linux_datavars')

@ -15,24 +15,20 @@
# limitations under the License.
import sys
import os
from os import path
from calculate.lib.datavars import (ReadonlyVariable, FieldValue, VariableError,
DataVarsError, Variable)
from calculate.lib.utils.files import listDirectory
from calculate.lib.utils.portage import GitError
from calculate.lib.datavars import (ReadonlyVariable, FieldValue)
from calculate.lib.variables import linux as lib_linux
from calculate.lib.variables import system as lib_system
from calculate.install import distr
from calculate.update.variables import update
from calculate.update import profile as update_profile
from calculate.lib.cl_lang import setLocalTranslate
from calculate.update.variables.update import DataVarsUpdateProfile
_ = lambda x: x
setLocalTranslate('cl_builder3', sys.modules[__name__])
class VariableClBuilderProfileStorage(ReadonlyVariable):
type = "object"
@ -125,6 +121,7 @@ class VariableClBuilderProfileName(lib_linux.VariableClProfileName):
def init(self):
self.label = _("System profile")
class VariableClBuilderProfileRepoName(update.VariableClUpdateProfileRepoName):
"""
Название репозитория
@ -132,6 +129,7 @@ class VariableClBuilderProfileRepoName(update.VariableClUpdateProfileRepoName):
storage = "builder.cl_builder_profile_storage"
url = "builder.cl_builder_profile_url"
class VariableClBuilderProfileRepository(
update.VariableClUpdateProfileRepository):
"""
@ -151,6 +149,7 @@ class VariableClBuilderTemplatesLocate(update.VariableClUpdateTemplatesLocate):
profile_datevars = "builder.cl_builder_profile_datavars"
class VariableClBuilderProfileDatavars(update.VariableClUpdateProfileDatavars):
type = "object"
@ -163,15 +162,16 @@ class VariableClBuilderProfileDatavars(update.VariableClUpdateProfileDatavars):
path_profile = self.Select(self.profiles_path,
where=self.profiles_shortname,
eq=profile, limit=1)
#print self.Get(self.profiles_path)
#print self.Get(self.profiles_shortname)
#print profile
# print self.Get(self.profiles_path)
# print self.Get(self.profiles_shortname)
# print profile
builder_path = self.Get('cl_builder_path')
#print "BUILDER_PATH", builder_path
# print "BUILDER_PATH", builder_path
if path_profile:
return DataVarsUpdateProfile(path_profile, builder_path)
return ""
class VariableClBuilderProfileSystemShortname(
update.VariableClUpdateProfileSystem):
"""
@ -187,7 +187,9 @@ class VariableClBuilderProfileSystemShortname(
url = "builder.cl_builder_profile_url"
gentoo_arch = 'builder.os_builder_arch_machine_gentoo'
class VariableOsBuilderArchMachineGentoo(lib_system.VariableOsArchMachineGentoo):
class VariableOsBuilderArchMachineGentoo(
lib_system.VariableOsArchMachineGentoo):
"""
Архитектура пакетов
"""
@ -195,7 +197,7 @@ class VariableOsBuilderArchMachineGentoo(lib_system.VariableOsArchMachineGentoo)
class VariableClBuilderProfileLinuxFullname(
update.VariableClUpdateProfileLinuxFullname):
update.VariableClUpdateProfileLinuxFullname):
"""
Имя системы в профиле
"""
@ -203,7 +205,7 @@ class VariableClBuilderProfileLinuxFullname(
class VariableClBuilderProfileDependData(
update.VariableClUpdateProfileDependData):
update.VariableClUpdateProfileDependData):
"""
Зависимые репозитории
"""
@ -230,16 +232,19 @@ class VariableClBuilderProfileDependUrl(FieldValue, ReadonlyVariable):
def init(self):
self.label = _("URL")
class VariableClBuilderProfileSyncRep(ReadonlyVariable):
type = "list"
def get(self):
return list(reversed(self.Get('update.cl_update_rep_name')))
class VariableClBuilderSyncRep(update.VariableClUpdateSyncRep):
"""
Обновляемый репозиторий
"""
@property
def rep_name(self):
dv = self.Get('cl_builder_linux_datavars')
@ -247,12 +252,13 @@ class VariableClBuilderSyncRep(update.VariableClUpdateSyncRep):
return dv.Get('cl_update_rep_name')
return ""
class VariableClBuilderRemoveRep(ReadonlyVariable):
def get(self):
dv_builder_linux = self.Get('cl_builder_linux_datavars')
dv_builder_profile = self.Get('cl_builder_profile_datavars')
if dv_builder_linux and dv_builder_profile:
return list(set(dv_builder_linux.Get('cl_update_rep_name')) -
set(dv_builder_profile.Get('cl_update_rep_name')))
set(dv_builder_profile.Get('cl_update_rep_name')))
else:
return []

@ -1,17 +0,0 @@
#-*- coding: utf-8 -*-
# Copyright 15 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__app__ = 'calculate-builder'
__version__ = '3.4.0_alpha1'

@ -1,4 +1,4 @@
#-*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2015 Calculate Ltd. http://www.calculate-linux.org
#
@ -25,7 +25,7 @@ from .builder import Builder
from calculate.update.update import UpdateError
from .datavars import BuilderError
from .variables.action import Actions as BuilderActions
from calculate.lib.utils.portage import GitError
from calculate.lib.utils.git import GitError
from utils.cl_builder_prepare import ClBuilderPrepareAction
from utils.cl_builder_profile import ClBuilderProfileAction
from utils.cl_builder_break import ClBuilderBreakAction
@ -33,10 +33,14 @@ from utils.cl_builder_update import ClBuilderUpdateAction
from utils.cl_builder_restore import ClBuilderRestoreAction
from utils.cl_builder_image import ClBuilderImageAction
from utils.cl_builder_menu import ClBuilderMenuAction
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
setLocalTranslate('cl_builder3',sys.modules[__name__])
_ = lambda x: x
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
setLocalTranslate('cl_builder3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class Wsdl(WsdlBase):
methods = [
#
@ -72,34 +76,35 @@ class Wsdl(WsdlBase):
# описание груп (список лямбда функций)
'groups': [
# Подготовить новую сборку
lambda group: group(_("Prepare the New Build"),
# Исходный образ (Source image)
normal=('cl_builder_source_filename',),
# Идентификатор сборки (Build ID)
expert=(# Место сборки
# (Build location)
'cl_builder_disk_dev',
# Использовать слои для сборки
# Use layers for build
'cl_builder_layered_set',
'cl_builder_new_id',
'cl_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
hide=('cl_templates_locate',
'cl_verbose_set',
'cl_builder_disk_dev',
'cl_builder_layered_set',
'cl_builder_new_id',
'cl_dispatch_conf'),
brief=('cl_builder_source_filename',
'cl_builder_profile_name',
'cl_builder_disk_dev',
'cl_builder_new_id',
'cl_builder_layered_set',
'cl_builder_disk_size',
),
next_label=_("Next"))],
lambda group: group(
_("Prepare the New Build"),
# Исходный образ (Source image)
normal=('cl_builder_source_filename',),
# Идентификатор сборки (Build ID)
expert=( # Место сборки
# (Build location)
'cl_builder_disk_dev',
# Использовать слои для сборки
# Use layers for build
'cl_builder_layered_set',
'cl_builder_new_id',
'cl_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
hide=('cl_templates_locate',
'cl_verbose_set',
'cl_builder_disk_dev',
'cl_builder_layered_set',
'cl_builder_new_id',
'cl_dispatch_conf'),
brief=('cl_builder_source_filename',
'cl_builder_profile_name',
'cl_builder_disk_dev',
'cl_builder_new_id',
'cl_builder_layered_set',
'cl_builder_disk_size',
),
next_label=_("Next"))],
'brief': {'next': __("Perform"),
'name': __("Prepare the New Build")},
},
@ -260,7 +265,8 @@ class Wsdl(WsdlBase):
lambda group: group(_("Break the Build"),
normal=('cl_builder_broken_id',),
expert=('cl_templates_locate',
'cl_verbose_set', 'cl_dispatch_conf'),
'cl_verbose_set',
'cl_dispatch_conf'),
next_label=_("Perform"))],
},
{
@ -337,7 +343,7 @@ class Wsdl(WsdlBase):
'cl_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
next_label=_("Next")),],
next_label=_("Next"))],
'brief': {'next': __("Perform"),
'name': __("Create the Image")}
},
@ -373,26 +379,28 @@ class Wsdl(WsdlBase):
'update.cl_update_world_default': 'rebuild'},
# описание груп (список лямбда функций)
'groups': [
lambda group: group(_("Repository"),
brief=('cl_builder_profile_repo_name',),
hide=('cl_builder_profile_url',
'update.cl_update_profile_sync_set'),
normal=('cl_builder_prepared_id',
'cl_builder_profile_url',),
expert=('update.cl_update_profile_sync_set',)),
lambda group: group(_("Profile"),
normal=('cl_builder_profile_system_shortname',
'update.cl_update_world'),
expert=('update.cl_update_skip_setup_set',
'cl_builder_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
hide=('cl_builder_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
brief=('cl_builder_profile_linux_fullname',
'cl_builder_profile_depend_data')
)],
lambda group: group(
_("Repository"),
brief=('cl_builder_profile_repo_name',),
hide=('cl_builder_profile_url',
'update.cl_update_profile_sync_set'),
normal=('cl_builder_prepared_id',
'cl_builder_profile_url',),
expert=('update.cl_update_profile_sync_set',)),
lambda group: group(
_("Profile"),
normal=('cl_builder_profile_system_shortname',
'update.cl_update_world'),
expert=('update.cl_update_skip_setup_set',
'cl_builder_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
hide=('cl_builder_templates_locate',
'cl_verbose_set',
'cl_dispatch_conf'),
brief=('cl_builder_profile_linux_fullname',
'cl_builder_profile_depend_data')
)],
'brief': {'next': __("Perform"),
'name': __("Set the Profile")}},
]

Loading…
Cancel
Save