Example #1
0
 def __import_system_description_elements(self):
     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)
     preferences_subsection_names = [
         'bootloader_theme', 'bootsplash_theme', 'locale', 'packagemanager',
         'rpm_check_signatures', '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', 'bootprofile', 'boottimeout',
         'btrfs_root_is_snapshot', 'devicepersistency', 'filesystem',
         'firmware', 'fsmountoptions', 'hybrid', 'hybridpersistent',
         'hybridpersistent_filesystem', 'installboot',
         'installprovidefailsafe', 'kernelcmdline', 'ramonly', '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)
Example #2
0
    def __load_boot_xml_description(self):
        log.info('Loading Boot XML description')
        boot_description_directory = self.__boot_description_directory()
        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(boot_config_file)
        self.boot_xml_data = boot_description.load()
        self.boot_config_file = boot_config_file

        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(
            self.boot_xml_data, [boot_image_profile, boot_kernel_profile])
        log.info('--> loaded %s', self.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)
Example #3
0
    def load_xml_description(self, description_directory):
        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)
            )