From: Zac Medico Date: Fri, 26 Oct 2007 06:10:58 +0000 (-0000) Subject: Make emerge add sets to the world file as one would expect. X-Git-Tag: v2.2_pre1~502 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a2c83b84058aa9aa59be6cee2449e81c70ae02fe;p=portage.git Make emerge add sets to the world file as one would expect. svn path=/main/trunk/; revision=8308 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 17e130c22..e6ccc39b8 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -3520,14 +3520,27 @@ class depgraph(object): if myfavkey in added_favorites: continue added_favorites.add(myfavkey) - world_set.add(myfavkey) - print ">>> Recording",myfavkey,"in \"world\" favorites file..." except portage.exception.InvalidDependString, e: writemsg("\n\n!!! '%s' has invalid PROVIDE: %s\n" % \ (pkg_key, str(e)), noiselevel=-1) writemsg("!!! see '%s'\n\n" % os.path.join( root, portage.VDB_PATH, pkg_key, "PROVIDE"), noiselevel=-1) del e + all_added = [] + for k in self._sets: + if k in ("args", "world"): + continue + s = SETPREFIX + k + if s in world_set: + continue + all_added.append(SETPREFIX + k) + all_added.extend(added_favorites) + all_added.sort() + for a in all_added: + print ">>> Recording %s in \"world\" favorites file..." % \ + colorize("INFORM", a) + if all_added: + world_set.update(all_added) world_set.unlock() def loadResumeCommand(self, resume_data): @@ -6171,8 +6184,7 @@ def action_build(settings, trees, mtimedb, pkglist.append(pkg) else: pkglist = mydepgraph.altlist() - if favorites: - mydepgraph.saveNomergeFavorites() + mydepgraph.saveNomergeFavorites() del mydepgraph mergetask = MergeTask(settings, trees, myopts) retval = mergetask.merge(pkglist, favorites, mtimedb) diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py index 1f3858137..c22ee9953 100644 --- a/pym/portage/sets/base.py +++ b/pym/portage/sets/base.py @@ -26,7 +26,7 @@ class PackageSet(object): self._nonatoms = set() def __contains__(self, atom): - return atom in self.getAtoms() + return atom in self.getAtoms() or atom in self._nonatoms def __iter__(self): for x in self.getAtoms(): @@ -122,9 +122,20 @@ class EditablePackageSet(PackageSet): def update(self, atoms): self.getAtoms() - self._atoms.update(atoms) - self._updateAtomMap(atoms=atoms) - self.write() + modified = False + normal_atoms = [] + for a in atoms: + if isvalidatom(a): + normal_atoms.append(a) + else: + modified = True + self._nonatoms.add(a) + if normal_atoms: + modified = True + self._atoms.update(normal_atoms) + self._updateAtomMap(atoms=normal_atoms) + if modified: + self.write() def add(self, atom): self.update([atom])