Exemplo n.º 1
0
 def __init__(self, distro, root_dir, instances, opts=None):
     super(YumDependencyHandler, self).__init__(distro, root_dir, instances,
                                                opts)
     # Various paths we will use while operating
     self.rpmbuild_dir = sh.joinpths(self.deps_dir, "rpmbuild")
     self.deps_repo_dir = sh.joinpths(self.deps_dir, "openstack-deps")
     self.deps_src_repo_dir = sh.joinpths(self.deps_dir,
                                          "openstack-deps-sources")
     self.rpm_sources_dir = sh.joinpths(self.rpmbuild_dir, "SOURCES")
     self.anvil_repo_dir = sh.joinpths(self.root_dir, "repo")
     # Executables we require to operate
     self.py2rpm_executable = sh.which("py2rpm", ["tools/"])
     self.rpmbuild_executable = sh.which("rpmbuild")
     self.specprint_executable = sh.which('specprint', ["tools/"])
     self.yumfind_executable = sh.which("yumfind", ["tools/"])
     # We inspect yum for packages, this helper allows us to do this.
     self.helper = yum_helper.Helper(self.log_dir)
     # See if we are requested to run at a higher make parallelism level
     self._jobs = self.JOBS
     if 'jobs' in self.opts:
         try:
             self._jobs = int(self.opts.get('jobs', self.JOBS))
             if self._jobs <= 0:
                 self._jobs = self.JOBS
         except (TypeError, ValueError):
             pass
Exemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     comp.Component.__init__(self, *args, **kwargs)
     self.tracewriter = tr.TraceWriter(tr.trace_filename(self.get_option('trace_dir'), 'created'),
                                       break_if_there=False)
     self.package_dir = sh.joinpths(self.get_option('component_dir'), 'package')
     self.match_installed = tu.make_bool(kwargs.get('match_installed'))
     self._build_paths = None
     self._details = None
     self._helper = yum_helper.Helper()
Exemplo n.º 3
0
 def __init__(self, distro, root_dir, instances):
     super(YumDependencyHandler, self).__init__(distro, root_dir, instances)
     self.rpmbuild_dir = sh.joinpths(self.deps_dir, "rpmbuild")
     self.deps_repo_dir = sh.joinpths(self.deps_dir, "openstack-deps")
     self.deps_src_repo_dir = sh.joinpths(self.deps_dir,
                                          "openstack-deps-sources")
     self.anvil_repo_filename = sh.joinpths(self.deps_dir, self.REPO_FN)
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.helper = yum_helper.Helper()
Exemplo n.º 4
0
    def filter_download_requires(self):
        yum_map = {}
        for pkg in yum_helper.Helper().get_available():
            for provides in pkg.provides:
                yum_map.setdefault(provides[0], set()).add(
                    (pkg.version, pkg.repo))

        nopips = [
            pkg_resources.Requirement.parse(name).key
            for name in self.python_names
        ]

        pips_to_download = []
        req_to_install = [
            pkg_resources.Requirement.parse(pkg)
            for pkg in self.pips_to_install
        ]
        req_to_install = [
            req for req in req_to_install if req.key not in nopips
        ]

        requested_names = [req.key for req in req_to_install]
        rpm_to_install = self._convert_names_python2rpm(requested_names)

        satisfied_list = []
        for (req, rpm_name) in zip(req_to_install, rpm_to_install):
            yum_versions = yum_map.get(rpm_name, [])
            satisfied = False
            for (version, repo) in yum_versions:
                if version in req:
                    satisfied = True
                    satisfied_list.append((req, rpm_name, version, repo))
                    break
            if not satisfied:
                pips_to_download.append(str(req))

        if satisfied_list:
            # Organize by repo
            repos = collections.defaultdict(list)
            for (req, rpm_name, version, repo) in satisfied_list:
                repos[repo].append("%s as %s-%s" % (req, rpm_name, version))
            for r in sorted(repos.keys()):
                header = ("%s Python packages are already available "
                          "as RPMs from repository %s")
                header = header % (len(repos[r]), colorizer.quote(r))
                utils.log_iterable(sorted(repos[r]), logger=LOG, header=header)
        return pips_to_download
Exemplo n.º 5
0
 def __init__(self, distro, root_dir, instances, opts):
     super(YumDependencyHandler, self).__init__(distro, root_dir, instances,
                                                opts)
     # Various paths we will use while operating
     self.rpmbuild_dir = sh.joinpths(self.deps_dir, "rpmbuild")
     self.deps_repo_dir = sh.joinpths(self.deps_dir, "openstack-deps")
     self.deps_src_repo_dir = sh.joinpths(self.deps_dir,
                                          "openstack-deps-sources")
     self.rpm_sources_dir = sh.joinpths(self.rpmbuild_dir, "SOURCES")
     self.anvil_repo_dir = sh.joinpths(self.root_dir, "repo")
     self.build_requires_filename = sh.joinpths(self.deps_dir,
                                                "build-requires")
     self.yum_satisfies_filename = sh.joinpths(self.deps_dir,
                                               "yum-satisfiable")
     # Executables we require to operate
     self.rpmbuild_executable = sh.which("rpmbuild")
     self.specprint_executable = sh.which('specprint', ["tools/"])
     # We inspect yum for packages, this helper allows us to do this.
     self.helper = yum_helper.Helper(self.log_dir, self.REPOS)
     # See if we are requested to run at a higher make parallelism level
     try:
         self.jobs = max(self.JOBS, int(self.opts.get('jobs')))
     except (TypeError, ValueError):
         self.jobs = self.JOBS
Exemplo n.º 6
0
 def __init__(self, distro, remove_default=False):
     pack.Packager.__init__(self, distro, remove_default)
     self.helper = yum_helper.Helper()