当前位置: 首页>>代码示例>>Python>>正文


Python XMLState.copy_strip_sections方法代码示例

本文整理汇总了Python中kiwi.xml_state.XMLState.copy_strip_sections方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.copy_strip_sections方法的具体用法?Python XMLState.copy_strip_sections怎么用?Python XMLState.copy_strip_sections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kiwi.xml_state.XMLState的用法示例。


在下文中一共展示了XMLState.copy_strip_sections方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: import_system_description_elements

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import copy_strip_sections [as 别名]
 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
     )
     self.xml_state.copy_strip_sections(
         self.boot_xml_state
     )
     preferences_subsection_names = [
         'bootloader_theme',
         'bootsplash_theme',
         'locale',
         'packagemanager',
         'rpm_check_signatures',
         'rpm_excludedocs',
         'showlicense'
     ]
     self.xml_state.copy_preferences_subsections(
         preferences_subsection_names, self.boot_xml_state
     )
     self.xml_state.copy_bootincluded_packages(
         self.boot_xml_state
     )
     self.xml_state.copy_bootincluded_archives(
         self.boot_xml_state
     )
     self.xml_state.copy_bootdelete_packages(
         self.boot_xml_state
     )
     type_attributes = [
         'bootkernel',
         'bootloader',
         'bootloader_console',
         'bootprofile',
         'boottimeout',
         'btrfs_root_is_snapshot',
         'gpt_hybrid_mbr',
         'devicepersistency',
         'filesystem',
         'firmware',
         'fsmountoptions',
         'hybridpersistent',
         'hybridpersistent_filesystem',
         'initrd_system',
         'installboot',
         'installprovidefailsafe',
         'kernelcmdline',
         'ramonly',
         'target_removable',
         'vga',
         'wwid_wait_timeout'
     ]
     self.xml_state.copy_build_type_attributes(
         type_attributes, self.boot_xml_state
     )
     self.xml_state.copy_systemdisk_section(
         self.boot_xml_state
     )
     self.xml_state.copy_machine_section(
         self.boot_xml_state
     )
     self.xml_state.copy_oemconfig_section(
         self.boot_xml_state
     )
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:86,代码来源:base.py

示例2: TestXMLState

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import copy_strip_sections [as 别名]

#.........这里部分代码省略.........

    def test_get_drivers_list(self):
        assert self.state.get_drivers_list() == \
            ['crypto/*', 'drivers/acpi/*', 'bar']

    def test_get_build_type_oemconfig_section(self):
        description = XMLDescription('../data/example_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, None, 'oem')
        assert state.get_build_type_oemconfig_section().get_oem_swap()[0] ==\
            'true'

    def test_get_users_sections(self):
        assert self.state.get_users_sections()[0].get_user()[0].get_name() == \
            'root'

    def test_get_users(self):
        assert self.state.get_users()[0].user_sections[0].get_name() == \
            'root'

    def test_copy_displayname(self):
        self.state.copy_displayname(self.boot_state)
        assert self.boot_state.xml_data.get_displayname() == 'Bob'

    def test_copy_drivers_sections(self):
        self.state.copy_drivers_sections(self.boot_state)
        assert 'bar' in self.boot_state.get_drivers_list()

    def test_copy_systemdisk_section(self):
        self.state.copy_systemdisk_section(self.boot_state)
        systemdisk = self.boot_state.get_build_type_system_disk_section()
        assert systemdisk.get_name() == 'mydisk'

    def test_copy_strip_sections(self):
        self.state.copy_strip_sections(self.boot_state)
        assert 'del-a' in self.boot_state.get_strip_files_to_delete()

    def test_copy_machine_section(self):
        self.state.copy_machine_section(self.boot_state)
        machine = self.boot_state.get_build_type_machine_section()
        assert machine.get_memory() == 512

    def test_copy_oemconfig_section(self):
        self.state.copy_oemconfig_section(self.boot_state)
        oemconfig = self.boot_state.get_build_type_oemconfig_section()
        assert oemconfig.get_oem_systemsize()[0] == 2048

    def test_copy_repository_sections(self):
        self.state.copy_repository_sections(self.boot_state, True)
        repository = self.boot_state.get_repository_sections()[0]
        assert repository.get_source().get_path() == 'iso:///image/CDs/dvd.iso'

    def test_copy_preferences_subsections(self):
        self.state.copy_preferences_subsections(
            ['bootsplash_theme'], self.boot_state
        )
        preferences = self.boot_state.get_preferences_sections()[0]
        assert preferences.get_bootsplash_theme()[0] == 'openSUSE'

    def test_copy_build_type_attributes(self):
        self.state.copy_build_type_attributes(
            ['firmware'], self.boot_state
        )
        assert self.boot_state.build_type.get_firmware() == 'efi'

    def test_copy_bootincluded_packages(self):
开发者ID:toabctl,项目名称:kiwi,代码行数:70,代码来源:xml_state_test.py

示例3: TestXMLState

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import copy_strip_sections [as 别名]

#.........这里部分代码省略.........
        state = XMLState(xml_data)
        users = state.get_users()
        assert len(users) == 3
        assert any(u.get_name() == 'root' for u in users)
        assert any(u.get_name() == 'tux' for u in users)
        assert any(u.get_name() == 'kiwi' for u in users)

    def test_get_user_groups(self):
        description = XMLDescription('../data/example_multiple_users_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data)

        assert len(state.get_user_groups('root')) == 0
        assert len(state.get_user_groups('tux')) == 1
        assert any(grp == 'users' for grp in state.get_user_groups('tux'))
        assert len(state.get_user_groups('kiwi')) == 3
        assert any(grp == 'users' for grp in state.get_user_groups('kiwi'))
        assert any(grp == 'kiwi' for grp in state.get_user_groups('kiwi'))
        assert any(grp == 'admin' for grp in state.get_user_groups('kiwi'))

    def test_copy_displayname(self):
        self.state.copy_displayname(self.boot_state)
        assert self.boot_state.xml_data.get_displayname() == 'Bob'

    def test_copy_drivers_sections(self):
        self.state.copy_drivers_sections(self.boot_state)
        assert 'bar' in self.boot_state.get_drivers_list()

    def test_copy_systemdisk_section(self):
        self.state.copy_systemdisk_section(self.boot_state)
        systemdisk = self.boot_state.get_build_type_system_disk_section()
        assert systemdisk.get_name() == 'mydisk'

    def test_copy_strip_sections(self):
        self.state.copy_strip_sections(self.boot_state)
        assert 'del-a' in self.boot_state.get_strip_files_to_delete()

    def test_copy_machine_section(self):
        self.state.copy_machine_section(self.boot_state)
        machine = self.boot_state.get_build_type_machine_section()
        assert machine.get_memory() == 512

    def test_copy_oemconfig_section(self):
        self.state.copy_oemconfig_section(self.boot_state)
        oemconfig = self.boot_state.get_build_type_oemconfig_section()
        assert oemconfig.get_oem_systemsize()[0] == 2048

    def test_copy_repository_sections(self):
        self.state.copy_repository_sections(self.boot_state, True)
        repository = self.boot_state.get_repository_sections()[0]
        assert repository.get_source().get_path() == 'iso:///image/CDs/dvd.iso'

    def test_copy_preferences_subsections(self):
        self.state.copy_preferences_subsections(
            ['bootsplash_theme'], self.boot_state
        )
        preferences = self.boot_state.get_preferences_sections()[0]
        assert preferences.get_bootsplash_theme()[0] == 'openSUSE'

    def test_copy_build_type_attributes(self):
        self.state.copy_build_type_attributes(
            ['firmware'], self.boot_state
        )
        assert self.boot_state.build_type.get_firmware() == 'efi'

    def test_copy_bootincluded_packages_with_no_image_packages(self):
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:70,代码来源:xml_state_test.py


注:本文中的kiwi.xml_state.XMLState.copy_strip_sections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。