예제 #1
0
 def _install_phase_download(self):
     koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = virt_utils.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 = virt_utils.KojiScratchPkgSpec(pkg_text)
         koji_client.get_scratch_pkgs(pkg, dst_dir=self.test_srcdir)
예제 #2
0
 def _get_rpm_file_names(self):
     all_rpm_file_names = []
     koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = virt_utils.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 = virt_utils.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
예제 #3
0
 def _get_rpm_names(self):
     all_rpm_names = []
     koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
     for pkg_text in self.koji_pkgs:
         pkg = virt_utils.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 = virt_utils.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 = virt_utils.RPMFileNameInfo(f)
             all_rpm_names.append(r.get_nvr_info()['name'])
     return all_rpm_names
예제 #4
0
    def parse(self):
        '''
        Parse options.

        If any brew options is specified, instantiate KojiDownloader
        '''
        (self.command_line_options,
         self.command_line_leftover) = super(site_job_create, self).parse()

        #
        # creating the new control file
        #
        if (self.command_line_options.template
                and self.command_line_options.control_file):
            generated_control_file = self._generate_control_file()
            self.data['control_file'] = open(generated_control_file).read()

        if self.command_line_options.koji_pkg:
            if self.koji_client is None:
                self.koji_client = virt_utils.KojiClient()

        return (self.command_line_options, self.command_line_leftover)
예제 #5
0
    def _kernel_install_koji(self,
                             koji_tag,
                             package="kernel",
                             dep_pkgs=None,
                             need_reboot=True):
        sm = software_manager.SoftwareManager()
        for utility in ['/usr/bin/koji', '/usr/bin/brew']:
            if not os.access(utility, os.X_OK):
                logging.debug("%s missing - trying to install", utility)
                pkg = sm.provides(utility)
                if pkg is not None:
                    sm.install(pkg)
                else:
                    logging.error("No %s available on software sources" %
                                  utility)
        # First, download packages via koji/brew
        c = virt_utils.KojiClient()
        deps_rpms = ""
        if dep_pkgs:
            for p in dep_pkgs.split():
                logging.info('Fetching kernel dependencies: %s', p)
                k_dep = virt_utils.KojiPkgSpec(tag=koji_tag,
                                               package=p,
                                               subpackages=[p])
                c.get_pkgs(k_dep, self.bindir)
                deps_rpms += " "
                deps_rpms += os.path.join(self.bindir,
                                          c.get_pkg_rpm_file_names(k_dep)[0])

        k = virt_utils.KojiPkgSpec(tag=koji_tag,
                                   package=package,
                                   subpackages=[package])

        c.get_pkgs(k, self.bindir)

        rpm_file = os.path.join(self.bindir, c.get_pkg_rpm_file_names(k)[0])

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