You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
6.2 KiB
146 lines
6.2 KiB
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright 2015 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.
|
|
|
|
import sys
|
|
from calculate.core.server.func import Action, Tasks
|
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
|
from calculate.lib.utils.files import FilesError
|
|
from ..datavars import BuilderError
|
|
from calculate.lib.utils.portage import GitError
|
|
from calculate.install.distr import DistributiveError, IsoDistributive
|
|
|
|
setLocalTranslate('cl_builder3', sys.modules[__name__])
|
|
__ = getLazyLocalTranslate(_)
|
|
|
|
|
|
class ClBuilderImageAction(Action):
|
|
"""
|
|
Действие обновление конфигурационных файлов
|
|
"""
|
|
# ошибки, которые отображаются без подробностей
|
|
native_error = (DistributiveError, FilesError, BuilderError, GitError)
|
|
|
|
successMessage = __("Image created successfully")
|
|
failedMessage = __("Creating the image is failed")
|
|
interruptMessage = __("Image creating manually interrupted")
|
|
|
|
# список задач для действия
|
|
tasks = [
|
|
{'name': 'clear_log',
|
|
'method': 'Builder.clear_log(cl_builder_id_path)',
|
|
},
|
|
{'name': 'prepare_action',
|
|
'method': 'Builder.set_builder_action("prepare")',
|
|
},
|
|
{'name': 'apply_template',
|
|
'message': __("Configuring build"),
|
|
'method': 'Builder.applyTemplates(cl_builder_target,False,False,None)',
|
|
},
|
|
{'name': 'prelink',
|
|
'message': __("Executing prelink"),
|
|
'method': 'Builder.chroot_command(cl_builder_path,"prelink",'
|
|
'"-afmR")',
|
|
'condition': lambda Get: Get('cl_builder_prelink_set') == 'on'
|
|
},
|
|
# получить видеодрайверы
|
|
{'name': 'fetch_video_drivers',
|
|
'group': __("Fetching video drivers"),
|
|
'tasks': [
|
|
{'name': 'fetch_drivers',
|
|
'method': 'Builder.fetch_drivers(cl_builder_path,'
|
|
'cl_builder_linux_distdir,cl_builder_linux_pkgdir)',
|
|
'condition': lambda Get: Get('cl_builder_videodrv_set') == 'on'
|
|
},
|
|
{'name': 'create_video_data',
|
|
'message': __("Creating install video driver data"),
|
|
'method': 'Builder.create_video_data(cl_builder_path,'
|
|
'cl_builder_repository_data)',
|
|
'condition': lambda Get: Get('cl_builder_videodrv_set') == 'on'
|
|
},
|
|
]
|
|
},
|
|
{'name': 'remove_video_drivers',
|
|
'method': 'Builder.remove_video_drivers(cl_builder_path)',
|
|
'condition': lambda Get: Get('cl_builder_videodrv_set') == 'off'
|
|
},
|
|
{'name': 'creating_live_image',
|
|
'group': __("Creating live image"),
|
|
'tasks': [
|
|
# закрепить подключенные данные
|
|
{'name': 'detach',
|
|
'message': __("Detach target"),
|
|
'method': 'Builder.detach_target(cl_builder_target)',
|
|
},
|
|
{'name': 'umount_system',
|
|
'message': __("Umount build system resources"),
|
|
'method': 'Builder.umount_system(cl_builder_target)',
|
|
'condition': lambda Get: Get('cl_builder_build')
|
|
},
|
|
{'name': 'prepare_image',
|
|
'method': 'Builder.prepare_image(cl_builder_image)',
|
|
'condition': lambda Get: isinstance(Get('cl_builder_image'),
|
|
IsoDistributive)
|
|
},
|
|
{'name': 'squash_action',
|
|
'method': 'Builder.set_builder_action("squash")',
|
|
},
|
|
{'name': 'count_files',
|
|
'method': 'Builder.recount_files(cl_builder_path,'
|
|
'cl_builder_squash_exclude)'
|
|
},
|
|
{'name': 'create_dev_nodes',
|
|
'method': 'Builder.create_dev_nodes(cl_builder_path)'
|
|
},
|
|
{'name': 'apply_template',
|
|
'message': __("Configuring squash"),
|
|
# наложить шаблоны в развернутый дистрибутив
|
|
'method': 'Builder.applyTemplates(cl_builder_target,'
|
|
'False,False,None)',
|
|
},
|
|
{'name': 'squash_action',
|
|
'method': 'Builder.set_builder_action("iso")',
|
|
},
|
|
# сборка iso
|
|
{'name':'remove_list_digest',
|
|
'method': "Builder.remove_list_digest(cl_builder_image_filename)"
|
|
},
|
|
{'name': 'unpack',
|
|
'message': __("Pack squash"),
|
|
'method': 'Install.unpack(cl_builder_target, cl_builder_image,'
|
|
'"0")',
|
|
},
|
|
{'name': 'isohybrid',
|
|
'message': __("Appling isohybrid feature for image"),
|
|
'method': 'Builder.isohybrid(cl_builder_image_filename)',
|
|
'condition': lambda Get: Get('cl_builder_isohybrid_set') == 'on'
|
|
},
|
|
{'name': 'create_package_list',
|
|
'message': __("Creating package list"),
|
|
'method': 'Builder.create_package_list(cl_builder_path,'
|
|
'cl_builder_image_filename)',
|
|
},
|
|
{'name': 'create_digest',
|
|
'message': __("Creating DIGEST for image"),
|
|
'method': 'Builder.create_digest(cl_builder_image_filename)',
|
|
},
|
|
{'name': 'umount_system!:mount_system',
|
|
'warning': _("Restore build system resources"),
|
|
'method': 'Builder.mount_target(cl_builder_target)',
|
|
'condition': lambda Get: Get('cl_builder_build')
|
|
}]
|
|
}
|
|
]
|