Esempio n. 1
0
 def _install_phase_download(self):
     koji_client = utils_koji.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = utils_koji.KojiPkgSpec(pkg_text)
         if pkg.is_valid():
             koji_client.get_pkgs(pkg, dst_dir=self.test_srcdir)
         else:
             logging.error('Package specification (%s) is invalid: %s' %
                           (pkg, pkg.describe_invalid()))
     for pkg_text in self.koji_scratch_pkgs:
         pkg = utils_koji.KojiScratchPkgSpec(pkg_text)
         koji_client.get_scratch_pkgs(pkg, dst_dir=self.test_srcdir)
Esempio n. 2
0
 def _get_rpm_file_names(self):
     all_rpm_file_names = []
     koji_client = utils_koji.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = utils_koji.KojiPkgSpec(pkg_text)
         rpm_file_names = koji_client.get_pkg_rpm_file_names(pkg)
         all_rpm_file_names += rpm_file_names
     for scratch_pkg_text in self.koji_scratch_pkgs:
         pkg = utils_koji.KojiScratchPkgSpec(scratch_pkg_text)
         rpm_urls = koji_client.get_scratch_pkg_urls(pkg)
         file_names = map(os.path.basename, rpm_urls)
         all_rpm_file_names += file_names
     return all_rpm_file_names
Esempio n. 3
0
 def _get_rpm_names(self):
     all_rpm_names = []
     koji_client = utils_koji.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = utils_koji.KojiPkgSpec(pkg_text)
         rpm_names = koji_client.get_pkg_rpm_names(pkg)
         all_rpm_names += rpm_names
     for scratch_pkg_text in self.koji_scratch_pkgs:
         pkg = utils_koji.KojiScratchPkgSpec(scratch_pkg_text)
         rpm_urls = koji_client.get_scratch_pkg_urls(pkg)
         file_names = map(os.path.basename, rpm_urls)
         for f in file_names:
             r = utils_koji.RPMFileNameInfo(f)
             all_rpm_names.append(r.get_nvr_info()['name'])
     return all_rpm_names
Esempio n. 4
0
    def _kernel_install_koji(self,
                             kernel_koji_spec,
                             kernel_deps_koji_spec,
                             need_reboot=True):
        # Using hardcoded package names (the names are not expected to change)
        # we avoid lookup errors due to SSL problems, so let's go with that.
        for koji_package in ['koji', 'brewkoji']:
            if not self.sm.check_installed(koji_package):
                LOG.debug("%s missing - trying to install", koji_package)
                self.sm.install(koji_package)

        sys.path.append(self.bindir)
        try:
            from staging import utils_koji
        except ImportError:
            from autotest.client.shared import utils_koji
        # First, download packages via koji/brew
        c = utils_koji.KojiClient()

        deps_rpms = []
        k_dep = utils_koji.KojiPkgSpec(text=kernel_deps_koji_spec)
        LOG.info('Fetching kernel dependencies: %s', kernel_deps_koji_spec)
        c.get_pkgs(k_dep, self.bindir)
        rpm_file_name_list = c.get_pkg_rpm_file_names(k_dep)
        if len(rpm_file_name_list) == 0:
            raise error.TestError("No packages on brew/koji match spec %s" %
                                  kernel_deps_koji_spec)
        dep_rpm_basename = rpm_file_name_list[0]
        deps_rpms.append(os.path.join(self.bindir, dep_rpm_basename))

        k = utils_koji.KojiPkgSpec(text=kernel_koji_spec)
        LOG.info('Fetching kernel: %s', kernel_koji_spec)
        c.get_pkgs(k, self.bindir)
        rpm_file_name_list = c.get_pkg_rpm_file_names(k)
        if len(rpm_file_name_list) == 0:
            raise error.TestError("No packages on brew/koji match spec %s" %
                                  kernel_koji_spec)

        kernel_rpm_basename = rpm_file_name_list[0]
        kernel_rpm_path = os.path.join(self.bindir, kernel_rpm_basename)

        # Then install kernel rpm packages.
        self._kernel_install_rpm(kernel_rpm_path, deps_rpms, need_reboot)