Make emerge add sets to the world file as one would expect.
authorZac Medico <zmedico@gentoo.org>
Fri, 26 Oct 2007 06:10:58 +0000 (06:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 26 Oct 2007 06:10:58 +0000 (06:10 -0000)
svn path=/main/trunk/; revision=8308

pym/_emerge/__init__.py
pym/portage/sets/base.py

index 17e130c223f0e325a0fbadb64a001b5b58b557ad..e6ccc39b87e485ddd3533ecc93ade0b8b55183b1 100644 (file)
@@ -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)
index 1f385813767a1647bc7a81261d0737f0d1033502..c22ee995363d9ae3860b94f27a1c3c4978e6ed41 100644 (file)
@@ -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])