本文整理汇总了Python中kiwi.xml_state.XMLState.get_build_type_name方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.get_build_type_name方法的具体用法?Python XMLState.get_build_type_name怎么用?Python XMLState.get_build_type_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.xml_state.XMLState
的用法示例。
在下文中一共展示了XMLState.get_build_type_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_build_type_explicitly_selected
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
def test_build_type_explicitly_selected(self):
description = XMLDescription('../data/example_config.xml')
xml_data = description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_name() == 'vmx'
示例2: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
class TestXMLState(object):
@patch('platform.machine')
def setup(self, mock_machine):
mock_machine.return_value = 'x86_64'
description = XMLDescription(
'../data/example_config.xml'
)
self.state = XMLState(
description.load()
)
boot_description = XMLDescription(
'../data/isoboot/example-distribution/config.xml'
)
self.boot_state = XMLState(
boot_description.load()
)
def test_build_type_primary_selected(self):
assert self.state.get_build_type_name() == 'oem'
def test_build_type_first_selected(self):
self.state.xml_data.get_preferences()[1].get_type()[0].set_primary(
False
)
assert self.state.get_build_type_name() == 'oem'
def test_get_package_manager(self):
assert self.state.get_package_manager() == 'zypper'
def test_get_image_version(self):
assert self.state.get_image_version() == '1.13.2'
def test_get_bootstrap_packages(self):
assert self.state.get_bootstrap_packages() == [
'filesystem'
]
def test_get_system_packages(self):
assert self.state.get_system_packages() == [
'gfxboot-branding-openSUSE',
'grub2-branding-openSUSE',
'ifplugd',
'iputils',
'kernel-default',
'openssh',
'plymouth-branding-openSUSE',
'vim'
]
def test_get_system_collections(self):
assert self.state.get_system_collections() == [
'base'
]
def test_get_system_products(self):
assert self.state.get_system_products() == [
'openSUSE'
]
def test_get_system_archives(self):
assert self.state.get_system_archives() == [
'image.tgz'
]
def test_get_system_collection_type(self):
assert self.state.get_system_collection_type() == 'plusRecommended'
def test_get_bootstrap_collections(self):
assert self.state.get_bootstrap_collections() == [
'bootstrap-collection'
]
def test_get_bootstrap_products(self):
assert self.state.get_bootstrap_products() == ['kiwi']
def test_get_bootstrap_archives(self):
assert self.state.get_bootstrap_archives() == ['bootstrap.tgz']
def test_get_bootstrap_collection_type(self):
assert self.state.get_bootstrap_collection_type() == 'onlyRequired'
def test_translate_obs_to_ibs_repositories(self):
self.state.translate_obs_to_ibs_repositories()
source_path = self.state.xml_data.get_repository()[1].get_source()
assert source_path.get_path() == \
'ibs://Devel:PubCloud:AmazonEC2/SLE_12_GA'
def test_translate_obs_to_suse_repositories(self):
self.state.translate_obs_to_suse_repositories()
source_path = self.state.xml_data.get_repository()[1].get_source()
assert source_path.get_path() == \
'suse://Devel:PubCloud:AmazonEC2/SLE_12_GA'
def test_set_repository(self):
self.state.set_repository('repo', 'type', 'alias', 1)
assert self.state.xml_data.get_repository()[0].get_source().get_path() \
== 'repo'
assert self.state.xml_data.get_repository()[0].get_type() == 'type'
assert self.state.xml_data.get_repository()[0].get_alias() == 'alias'
assert self.state.xml_data.get_repository()[0].get_priority() == 1
#.........这里部分代码省略.........
示例3: BootImageBase
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
#.........这里部分代码省略.........
description boot attribute
"""
log.info('Loading Boot XML description')
boot_description_directory = self.get_boot_description_directory()
if not boot_description_directory:
raise KiwiConfigFileNotFound(
'no boot reference specified in XML description'
)
boot_config_file = boot_description_directory + '/config.xml'
if not os.path.exists(boot_config_file):
raise KiwiConfigFileNotFound(
'no Boot XML description found in %s' %
boot_description_directory
)
boot_description = XMLDescription(
description=boot_config_file,
derived_from=self.xml_state.xml_data.description_dir
)
boot_image_profile = self.xml_state.build_type.get_bootprofile()
if not boot_image_profile:
boot_image_profile = 'default'
boot_kernel_profile = self.xml_state.build_type.get_bootkernel()
if not boot_kernel_profile:
boot_kernel_profile = 'std'
self.boot_xml_state = XMLState(
boot_description.load(), [boot_image_profile, boot_kernel_profile]
)
log.info('--> loaded %s', boot_config_file)
if self.boot_xml_state.build_type:
log.info(
'--> Selected build type: %s',
self.boot_xml_state.get_build_type_name()
)
if self.boot_xml_state.profiles:
log.info(
'--> Selected boot profiles: image: %s, kernel: %s',
boot_image_profile, boot_kernel_profile
)
def import_system_description_elements(self):
"""
Copy information from the system image relevant to create the
boot image to the boot image state XML description
"""
self.xml_state.copy_displayname(
self.boot_xml_state
)
self.xml_state.copy_name(
self.boot_xml_state
)
self.xml_state.copy_repository_sections(
target_state=self.boot_xml_state,
wipe=True
)
self.xml_state.copy_drivers_sections(
self.boot_xml_state
)
strip_description = XMLDescription(
Defaults.get_boot_image_strip_file()
)
strip_xml_state = XMLState(strip_description.load())
strip_xml_state.copy_strip_sections(
self.boot_xml_state
)
示例4: CliTask
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
#.........这里部分代码省略.........
"""
Load, upgrade, validate XML description
Attributes
* :attr:`xml_data`
instance of XML data toplevel domain (image), stateless data
* :attr:`config_file`
used config file path
* :attr:`xml_state`
Instance of XMLState, stateful data
"""
from ..logger import log
log.info('Loading XML description')
config_file = description_directory + '/config.xml'
if not os.path.exists(config_file):
# alternative config file lookup location
config_file = description_directory + '/image/config.xml'
if not os.path.exists(config_file):
# glob config file search, first match wins
glob_match = description_directory + '/*.kiwi'
for kiwi_file in glob.iglob(glob_match):
config_file = kiwi_file
break
if not os.path.exists(config_file):
raise KiwiConfigFileNotFound(
'no XML description found in %s' % description_directory
)
description = XMLDescription(
config_file
)
self.xml_data = description.load()
self.config_file = config_file.replace('//', '/')
self.xml_state = XMLState(
self.xml_data,
self.global_args['--profile'],
self.global_args['--type']
)
log.info('--> loaded %s', self.config_file)
if self.xml_state.build_type:
log.info(
'--> Selected build type: %s',
self.xml_state.get_build_type_name()
)
if self.xml_state.profiles:
log.info(
'--> Selected profiles: %s',
','.join(self.xml_state.profiles)
)
self.runtime_checker = RuntimeChecker(self.xml_state)
def quadruple_token(self, option):
"""
Helper method for commandline options of the form --option a,b,c,d
Make sure to provide a common result for option values which
separates the information in a comma separated list of values
:return: common option value representation
:rtype: str
"""
tokens = option.split(',', 3)
return [
self._pop_token(tokens) if len(tokens) else None for _ in range(
0, 4
)
]
def sextuple_token(self, option):
"""
Helper method for commandline options of the form --option a,b,c,d,e,f
Make sure to provide a common result for option values which
separates the information in a comma separated list of values
:return: common option value representation
:rtype: str
"""
tokens = option.split(',', 5)
return [
self._pop_token(tokens) if len(tokens) else None for _ in range(
0, 6
)
]
def _pop_token(self, tokens):
token = tokens.pop(0)
if len(token) > 0 and token == 'true':
return True
elif len(token) > 0 and token == 'false':
return False
else:
return token
示例5: test_build_type_explicitly_selected
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
def test_build_type_explicitly_selected(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_name() == 'vmx'
示例6: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_name [as 别名]
class TestXMLState(object):
@patch('platform.machine')
def setup(self, mock_machine):
mock_machine.return_value = 'x86_64'
self.description = XMLDescription(
'../data/example_config.xml'
)
self.state = XMLState(
self.description.load()
)
boot_description = XMLDescription(
'../data/isoboot/example-distribution/config.xml'
)
self.boot_state = XMLState(
boot_description.load()
)
no_image_packages_description = XMLDescription(
'../data/example_no_image_packages_config.xml'
)
self.no_image_packages_boot_state = XMLState(
no_image_packages_description.load()
)
def test_build_type_primary_selected(self):
assert self.state.get_build_type_name() == 'oem'
def test_build_type_first_selected(self):
self.state.xml_data.get_preferences()[1].get_type()[0].set_primary(
False
)
assert self.state.get_build_type_name() == 'oem'
@patch('kiwi.xml_state.XMLState.get_preferences_sections')
def test_get_rpm_excludedocs_without_entry(self, mock_preferences):
mock_preferences.return_value = []
assert self.state.get_rpm_excludedocs() is False
def test_get_rpm_excludedocs(self):
assert self.state.get_rpm_excludedocs() is True
@patch('kiwi.xml_state.XMLState.get_preferences_sections')
def test_get_rpm_check_signatures_without_entry(self, mock_preferences):
mock_preferences.return_value = []
assert self.state.get_rpm_check_signatures() is False
def test_get_rpm_check_signatures(self):
assert self.state.get_rpm_check_signatures() is True
def test_get_package_manager(self):
assert self.state.get_package_manager() == 'zypper'
def test_get_image_version(self):
assert self.state.get_image_version() == '1.13.2'
def test_get_bootstrap_packages(self):
assert self.state.get_bootstrap_packages() == [
'filesystem', 'zypper'
]
assert self.no_image_packages_boot_state.get_bootstrap_packages() == [
'patterns-openSUSE-base'
]
def test_get_system_packages(self):
assert self.state.get_system_packages() == [
'gfxboot-branding-openSUSE',
'grub2-branding-openSUSE',
'ifplugd',
'iputils',
'kernel-default',
'openssh',
'plymouth-branding-openSUSE',
'vim'
]
@patch('platform.machine')
def test_get_system_packages_some_arch(self, mock_machine):
mock_machine.return_value = 's390'
state = XMLState(
self.description.load()
)
assert state.get_system_packages() == [
'foo',
'gfxboot-branding-openSUSE',
'grub2-branding-openSUSE',
'ifplugd',
'iputils',
'kernel-default',
'openssh',
'plymouth-branding-openSUSE',
'vim'
]
def test_get_system_collections(self):
assert self.state.get_system_collections() == [
'base'
]
def test_get_system_products(self):
assert self.state.get_system_products() == [
'openSUSE'
#.........这里部分代码省略.........