コード例 #1
0
 def import_repositories_marked_as_imageinclude(self):
     """
     Those <repository> sections which are marked with the
     imageinclude attribute should be permanently added to
     the image repository configuration
     """
     repository_sections = \
         self.xml_state.get_repository_sections_used_in_image()
     root = RootInit(root_dir=self.root_dir, allow_existing=True)
     repo = Repository(RootBind(root), self.xml_state.get_package_manager())
     repo.use_default_location()
     for xml_repo in repository_sections:
         repo_type = xml_repo.get_type()
         repo_source = xml_repo.get_source().get_path()
         repo_user = xml_repo.get_username()
         repo_secret = xml_repo.get_password()
         repo_alias = xml_repo.get_alias()
         repo_priority = xml_repo.get_priority()
         repo_dist = xml_repo.get_distribution()
         repo_components = xml_repo.get_components()
         repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
         repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
         uri = Uri(repo_source, repo_type)
         repo_source_translated = uri.translate(
             check_build_environment=False)
         if not repo_alias:
             repo_alias = uri.alias()
         log.info('Setting up image repository %s', repo_source)
         log.info('--> Type: %s', repo_type)
         log.info('--> Translated: %s', repo_source_translated)
         log.info('--> Alias: %s', repo_alias)
         repo.add_repo(repo_alias, repo_source_translated, repo_type,
                       repo_priority, repo_dist, repo_components, repo_user,
                       repo_secret, uri.credentials_file_name(),
                       repo_repository_gpgcheck, repo_package_gpgcheck)
コード例 #2
0
ファイル: prepare.py プロジェクト: michal42/kiwi-1
    def setup_repositories(self, clear_cache=False, signing_keys=None):
        """
        Set up repositories for software installation and return a
        package manager for performing software installation tasks

        :return: Instance of PackageManager
        :rtype: PackageManager
        """
        repository_options = []
        repository_sections = \
            self.xml_state.get_repository_sections_used_for_build()
        package_manager = self.xml_state.get_package_manager()
        if self.xml_state.get_rpm_check_signatures():
            repository_options.append('check_signatures')
        if self.xml_state.get_rpm_excludedocs():
            repository_options.append('exclude_docs')
        repo = Repository(self.root_bind, package_manager, repository_options)
        if signing_keys:
            repo.import_trusted_keys(signing_keys)
        for xml_repo in repository_sections:
            repo_type = xml_repo.get_type()
            repo_source = xml_repo.get_source().get_path()
            repo_user = xml_repo.get_username()
            repo_secret = xml_repo.get_password()
            repo_alias = xml_repo.get_alias()
            repo_priority = xml_repo.get_priority()
            repo_dist = xml_repo.get_distribution()
            repo_components = xml_repo.get_components()
            repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
            repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
            log.info('Setting up repository %s', repo_source)
            log.info('--> Type: %s', repo_type)
            if repo_priority:
                log.info('--> Priority: %s', repo_priority)

            uri = Uri(repo_source, repo_type)
            repo_source_translated = uri.translate()
            log.info('--> Translated: %s', repo_source_translated)
            if not repo_alias:
                repo_alias = uri.alias()
            log.info('--> Alias: %s', repo_alias)

            if not uri.is_remote() and not os.path.exists(
                    repo_source_translated):
                log.warning('repository %s does not exist and will be skipped',
                            repo_source)
                continue

            if not uri.is_remote():
                self.root_bind.mount_shared_directory(repo_source_translated)

            repo.add_repo(repo_alias, repo_source_translated, repo_type,
                          repo_priority, repo_dist, repo_components, repo_user,
                          repo_secret, uri.credentials_file_name(),
                          repo_repository_gpgcheck, repo_package_gpgcheck)
            if clear_cache:
                repo.delete_repo_cache(repo_alias)
            self.uri_list.append(uri)
        repo.cleanup_unused_repos()
        return PackageManager(repo, package_manager)
コード例 #3
0
ファイル: setup.py プロジェクト: AdamMajer/kiwi-ng
 def import_repositories_marked_as_imageinclude(self):
     """
     Those <repository> sections which are marked with the
     imageinclude attribute should be permanently added to
     the image repository configuration
     """
     repository_sections = \
         self.xml_state.get_repository_sections_used_in_image()
     root = RootInit(
         root_dir=self.root_dir, allow_existing=True
     )
     repo = Repository(
         RootBind(root), self.xml_state.get_package_manager()
     )
     repo.use_default_location()
     for xml_repo in repository_sections:
         repo_type = xml_repo.get_type()
         repo_source = xml_repo.get_source().get_path()
         repo_user = xml_repo.get_username()
         repo_secret = xml_repo.get_password()
         repo_alias = xml_repo.get_alias()
         repo_priority = xml_repo.get_priority()
         repo_dist = xml_repo.get_distribution()
         repo_components = xml_repo.get_components()
         repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
         repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
         uri = Uri(repo_source, repo_type)
         repo_source_translated = uri.translate(
             check_build_environment=False
         )
         if not repo_alias:
             repo_alias = uri.alias()
         log.info('Setting up image repository %s', repo_source)
         log.info('--> Type: %s', repo_type)
         log.info('--> Translated: %s', repo_source_translated)
         log.info('--> Alias: %s', repo_alias)
         repo.add_repo(
             repo_alias, repo_source_translated,
             repo_type, repo_priority, repo_dist, repo_components,
             repo_user, repo_secret, uri.credentials_file_name(),
             repo_repository_gpgcheck, repo_package_gpgcheck
         )
コード例 #4
0
ファイル: prepare.py プロジェクト: Conan-Kudo/kiwi
    def setup_repositories(self, clear_cache=False, signing_keys=None):
        """
        Set up repositories for software installation and return a
        package manager for performing software installation tasks

        :param bool clear_cache: flag the clear cache before configure
            anything
        :param list signing_keys: keys imported to the package manager

        :return: instance of :class:`PackageManager`

        :rtype: PackageManager
        """
        repository_options = []
        repository_sections = \
            self.xml_state.get_repository_sections_used_for_build()
        package_manager = self.xml_state.get_package_manager()
        if self.xml_state.get_rpm_check_signatures():
            repository_options.append('check_signatures')
        if self.xml_state.get_rpm_excludedocs():
            repository_options.append('exclude_docs')
        repo = Repository(
            self.root_bind, package_manager, repository_options
        )
        if signing_keys:
            repo.import_trusted_keys(signing_keys)
        for xml_repo in repository_sections:
            repo_type = xml_repo.get_type()
            repo_source = xml_repo.get_source().get_path()
            repo_user = xml_repo.get_username()
            repo_secret = xml_repo.get_password()
            repo_alias = xml_repo.get_alias()
            repo_priority = xml_repo.get_priority()
            repo_dist = xml_repo.get_distribution()
            repo_components = xml_repo.get_components()
            repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
            repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
            log.info('Setting up repository %s', repo_source)
            log.info('--> Type: %s', repo_type)
            if repo_priority:
                log.info('--> Priority: %s', repo_priority)

            uri = Uri(repo_source, repo_type)
            repo_source_translated = uri.translate()
            log.info('--> Translated: %s', repo_source_translated)
            if not repo_alias:
                repo_alias = uri.alias()
            log.info('--> Alias: %s', repo_alias)

            if not uri.is_remote() and not os.path.exists(
                repo_source_translated
            ):
                log.warning(
                    'repository %s does not exist and will be skipped',
                    repo_source
                )
                continue

            if not uri.is_remote():
                self.root_bind.mount_shared_directory(repo_source_translated)

            repo.add_repo(
                repo_alias, repo_source_translated,
                repo_type, repo_priority, repo_dist, repo_components,
                repo_user, repo_secret, uri.credentials_file_name(),
                repo_repository_gpgcheck, repo_package_gpgcheck
            )
            if clear_cache:
                repo.delete_repo_cache(repo_alias)
            self.uri_list.append(uri)
        repo.cleanup_unused_repos()
        return PackageManager(
            repo, package_manager
        )