Beispiel #1
0
 def iter_pull_data(self, pkg):
     l = [self.defaults]
     for specific in self.freeform:
         l.extend(data for restrict, data in specific if restrict.match(pkg))
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             l.append(data)
     if len(l) == 1:
         return iter(self.defaults)
     return iflatten_instance(l)
Beispiel #2
0
 def iter_pull_data(self, pkg):
     l = [self.defaults]
     for specific in self.freeform:
         l.extend(data for restrict, data in specific if restrict.match(pkg))
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             l.append(data)
     if len(l) == 1:
         return iter(self.defaults)
     return iflatten_instance(l)
Beispiel #3
0
 def iter_pull_data(self, pkg, pre_defaults=()):
     for item in pre_defaults:
         yield item
     for item in self.defaults:
         yield item
     for specific in self.freeform:
         for restrict, data in specific:
             if restrict.match(pkg):
                 for item in data:
                     yield item
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             for item in data:
                 yield item
Beispiel #4
0
 def iter_pull_data(self, pkg, pre_defaults=()):
     for item in pre_defaults:
         yield item
     for item in self.defaults:
         yield item
     for specific in self.freeform:
         for restrict, data in specific:
             if restrict.match(pkg):
                 for item in data:
                     yield item
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             for item in data:
                 yield item
Beispiel #5
0
 def pull_data(self, pkg, force_copy=False):
     l = []
     for specific in self.freeform:
         for restrict, data in specific:
             if restrict.match(pkg):
                 l.append(data)
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             l.append(data)
     if not l:
         if force_copy:
             return set(self.defaults)
         return self.defaults
     s = set(self.defaults)
     s.update(iflatten_instance(l))
     return s
Beispiel #6
0
 def pull_data(self, pkg, force_copy=False):
     l = []
     for specific in self.freeform:
         for restrict, data in specific:
             if restrict.match(pkg):
                 l.append(data)
     for atom, data in self.atoms.get(pkg.key, ()):
         if atom.match(pkg):
             l.append(data)
     if not l:
         if force_copy:
             return set(self.defaults)
         return self.defaults
     s = set(self.defaults)
     s.update(iflatten_instance(l))
     return s
Beispiel #7
0
    def pull_data(self, pkg, force_copy=False, pre_defaults=()):
        l = []
        for specific in self.freeform:
            for restrict, data in specific:
                if restrict.match(pkg):
                    l.append(data)
        for atom, data in self.atoms.get(pkg.key, ()):
            if atom.match(pkg):
                l.append(data)

        if pre_defaults:
            s = set(pre_defaults)
            incremental_expansion(s, self.defaults)
        else:
            s = set(self.defaults_finalized)

        if l:
            incremental_expansion(s, iflatten_instance(l))
        return s
Beispiel #8
0
    def pull_data(self, pkg, force_copy=False, pre_defaults=()):
        l = []
        for specific in self.freeform:
            for restrict, data in specific:
                if restrict.match(pkg):
                    l.append(data)
        for atom, data in self.atoms.get(pkg.key, ()):
            if atom.match(pkg):
                l.append(data)

        if pre_defaults:
            s = set(pre_defaults)
            incremental_expansion(s, self.defaults)
        else:
            s = set(self.defaults_finalized)

        if l:
            incremental_expansion(s, iflatten_instance(l))
        return s
Beispiel #9
0
    def feed(self, pkg):
        for attr in sorted(x.lower() for x in pkg.eapi.dep_keys):
            try:
                deps = getattr(pkg, attr)
            except MetadataException as e:
                cls = globals()[f'Invalid{attr.capitalize()}']
                yield cls(attr, e.msg(), pkg=pkg)
                continue

            nodes, unstated = self.iuse_filter(
                (atom_cls, boolean.OrRestriction), pkg, deps, attr=attr)
            yield from unstated

            outdated_blockers = set()
            nonexistent_blockers = set()
            deprecated = set()

            for node in nodes:
                if isinstance(node, boolean.OrRestriction):
                    in_or_restriction = True
                else:
                    in_or_restriction = False

                for atom in iflatten_instance(node, (atom_cls,)):
                    if self.deprecated(atom) and not self.masked(atom):
                        deprecated.add(atom)

                    if in_or_restriction and atom.slot_operator == '=':
                        yield BadDependency(
                            attr, atom, '= slot operator used inside || block', pkg=pkg)

                    if pkg.eapi.options.has_use_dep_defaults and atom.use is not None:
                        missing_use_deps = self._check_use_deps(attr, atom)
                        for use, atoms in missing_use_deps.items():
                            pkgs = (x.cpvstr for x in sorted(atoms))
                            yield MissingUseDepDefault(attr, str(atom), use, pkgs, pkg=pkg)

                    if atom.op == '=' and not atom.revision:
                        yield MissingPackageRevision(attr, str(atom), pkg=pkg)

                    if atom.blocks:
                        if atom.match(pkg):
                            yield BadDependency(attr, atom, "package blocks itself", pkg=pkg)
                        elif atom.slot_operator == '=':
                            yield BadDependency(
                                attr, atom, '= slot operator used in blocker', pkg=pkg)
                        elif self.existence_repo is not None:
                            # check for outdated blockers (2+ years old)
                            if atom.op == '=*':
                                s = f"={atom.cpvstr}*"
                            else:
                                s = atom.op + atom.cpvstr
                            unblocked = atom_cls(s)
                            if not self.options.search_repo.match(unblocked):
                                matches = self.existence_repo.match(unblocked)
                                if matches:
                                    removal = max(x.date for x in matches)
                                    removal = datetime.strptime(removal, '%Y-%m-%d')
                                    years = round((self.today - removal).days / 365, 2)
                                    if years > 2:
                                        outdated_blockers.add((atom, years))
                                else:
                                    nonexistent_blockers.add(atom)

            for atom, years in sorted(outdated_blockers):
                yield OutdatedBlocker(attr.upper(), str(atom), years, pkg=pkg)
            for atom in sorted(nonexistent_blockers):
                yield NonexistentBlocker(attr.upper(), str(atom), pkg=pkg)
            for atom in sorted(deprecated):
                yield DeprecatedPkg(attr.upper(), str(atom), pkg=pkg)