def _collect(self): self._non_private_cp_to_atoms = defaultdict(list) self._private_cp_to_atoms = defaultdict(list) self._total_count = 0 self._private_count = 0 for location in self._locations(): for x in portage.grabfile_package(os.path.join( location, self._section), recursive=1): self._total_count = self._total_count + 1 if x.startswith('-'): print ' no proper support for "-cat/pkg" style entry "%s" yet, sorry.' % x.strip( ) continue cp = get_cp(x) if self._privacy_filter and is_private_package_atom(cp): self._private_count = self._private_count + 1 dict_ref = self._private_cp_to_atoms else: dict_ref = self._non_private_cp_to_atoms merge_with = set([x]) if cp in dict_ref: dict_ref[cp] = dict_ref[cp].union(merge_with) else: dict_ref[cp] = merge_with
def _hits(self, cpv, dict_ref): test_atom = '=' + cpv cp = get_cp(test_atom) if cp not in dict_ref: return False for a in dict_ref[cp]: if portage.dep.get_operator(a) == None: return True elif not not portage.dep.match_from_list(test_atom, [a]): return True return False
def is_private_package_atom(atom, installed_from=None, debug=False): cat = catsplit(get_cp(atom))[0] if GeneratedPackages().is_generated_cat(cat): if GeneratedPackages().is_private_cat(cat): if debug: print ' skipping "%s" (%s, %s)' % \ (atom, 'was generated', 'is currently blacklisted') return True else: if installed_from and \ installed_from[0] != '' and \ not GeneratedPackages().is_dedicated_repo_name( installed_from[0]): if debug: print ' removing %s source tree "%s" for atom "%s"' % \ ('misleading', installed_from[0], atom) installed_from[0] = '' if installed_from != None: """ - We collect private packages iff they come from a non-private overlay, because that means they were in there before and are actually not private. An example would be media-sound/xmms. - We collect packages from private overlays iff the package also exists in a non-private overlay. An example would be that you posted your ebuild to bugs.gentoo.org and somebody added it to the tree in the meantime. """ if not Overlays().is_private_overlay_name(installed_from[0]): return False if not Overlays().is_private_package_atom(atom): if installed_from and installed_from[0] != '': if debug: print ' removing %s source tree "%s" for atom "%s"' % \ ('private', installed_from[0], atom) installed_from[0] = '' return False if debug: print ' skipping "%s" (%s, %s)' % \ (atom, 'was installed from private tree', 'is currently not in non-private tree') return True else: not_in_public_trees = Overlays().is_private_package_atom(atom) if debug and not_in_public_trees: print ' skipping "%s" (not in public trees)' % atom return not_in_public_trees
def _collect(self): self._non_private_cp_to_atoms = defaultdict(list) self._private_cp_to_atoms = defaultdict(list) self._total_count = 0 self._private_count = 0 for location in self._locations(): for x in portage.grabfile_package( os.path.join(location, self._section), recursive = 1): self._total_count = self._total_count + 1 if x.startswith('-'): print ' no proper support for "-cat/pkg" style entry "%s" yet, sorry.' % x.strip() continue cp = get_cp(x) if self._privacy_filter and is_private_package_atom(cp): self._private_count = self._private_count + 1 dict_ref = self._private_cp_to_atoms else: dict_ref = self._non_private_cp_to_atoms merge_with = set([x]) if cp in dict_ref: dict_ref[cp] = dict_ref[cp].union(merge_with) else: dict_ref[cp] = merge_with
def is_private_package_atom(self, atom): cp = get_cp(atom) return not self._dbapi.cp_list(cp)