Merged from trunk -r15477:15489
authorFabian Groffen <grobian@gentoo.org>
Sun, 28 Feb 2010 14:11:50 +0000 (14:11 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 28 Feb 2010 14:11:50 +0000 (14:11 -0000)
   | 15486   | Add a --quiet-unmerge-warn option to disable the warning     |
   | zmedico | message that's shown prior to --unmerge actions. Thanks to   |
   |         | Thomas Sachau <tommy@gentoo.org> for the suggestion.         |

   | 15487   | Make _global_updates ensure that the binarytree is only      |
   | zmedico | populated with local packages (getbinpkgs=0), and fix        |
   |         | binarytree.populate() to behave properly when called more    |
   |         | than once.                                                   |

   | 15488   | Make bindbapi override cpv_inject and cpv_remove, for        |
   | zmedico | deleting stale values from self._aux_cache. Also, add a      |
   |         | comment about stale cache handling inside aux_update.        |

   | 15489   | Fix vardbapi.move_ent and aux_update to clear relevant       |
   | zmedico | caches.                                                      |

svn path=/main/branches/prefix/; revision=15498

man/emerge.1
pym/_emerge/actions.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/portage/_global_updates.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py

index bebae95f89af766bdb298f0f53838e0e3f3eba08..c16bfac1c29e0174eab9f54dbd2810b1759d9a16 100644 (file)
@@ -477,6 +477,12 @@ output from portage's displays.
 Redirect all build output to logs alone, and do not
 display it on stdout.
 .TP
+.BR \-\-quiet\-unmerge\-warn
+Disable the warning message that's shown prior to
+\fB\-\-unmerge\fR actions. This option is intended
+to be set in the \fBmake.conf\fR(5)
+\fBEMERGE_DEFAULT_OPTS\fR variable.
+.TP
 .BR "\-\-rebuilt\-binaries[=n]"
 Replace installed packages with binary packages that have
 been rebuilt. Rebuilds are detected by comparison of
index aff3ce7b13e6a130dc95581a1d258bad15e3752f..6655dea435c54fe6058eb534aa3ebdc1aaae594d 100644 (file)
@@ -2330,7 +2330,9 @@ def action_uninstall(settings, trees, ldpath_mtimes,
        if files and not valid_atoms:
                return 1
 
-       if action == 'unmerge' and '--quiet' not in opts:
+       if action == 'unmerge' and \
+               '--quiet' not in opts and \
+               '--quiet-unmerge-warn' not in opts:
                msg = "This action can remove important packages! " + \
                        "In order to be safer, use " + \
                        "`emerge -pv --depclean <atom>` to check for " + \
index 867902a6cc5795eb5a0f1b3fddb70f7dabdf260a..1dfb63a47bd919a853ee8a1a70c32c04c93322f1 100644 (file)
@@ -506,6 +506,14 @@ def help(myopts, havecolor=1):
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
+               print("       "+green("--quiet-unmerge-warn"))
+               desc = "Disable the warning message that's shown prior to " + \
+                       "--unmerge actions. This option is intended " + \
+                       "to be set in the make.conf(5) " + \
+                       "EMERGE_DEFAULT_OPTS variable."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("       "+green("--rebuilt-binaries") + "[=%s]" % turquoise("n"))
                desc = "Replace installed packages with binary packages that have " + \
                        "been rebuilt. Rebuilds are detected by comparison of " + \
index 48a799423260be00ccd34412ad44766d42bbac22..28fe40ebdfb32c219c3194841d244549f2f67ae6 100644 (file)
@@ -70,6 +70,7 @@ options=[
 "--onlydeps",     "--pretend",
 "--quiet",
 "--quiet-build",
+"--quiet-unmerge-warn",
 "--resume",
 "--searchdesc",
 "--skipfirst",
index acb548ba5fa7ef4bfd0bcd9a6e73f53fff4b5893..4310c892afa19c6f8adf0c8bab618af7e096d7f8 100644 (file)
@@ -94,6 +94,10 @@ def _global_updates(trees, prev_mtimes):
                bindb = trees["/"]["bintree"].dbapi
                if not os.access(bindb.bintree.pkgdir, os.W_OK):
                        bindb = None
+               else:
+                       # Call binarytree.populate(), since we want to make sure it's
+                       # only populated with local packages here (getbinpkgs=0).
+                       bindb.bintree.populate()
                for update_cmd in myupd:
                        if update_cmd[0] == "move":
                                moves = vardb.move_ent(update_cmd)
index 13a5e4f3785ee2e479e028f05d8464324e574dba..6a5a4f862490d55cf9530f2af20d7fa61fc8fae0 100644 (file)
@@ -67,6 +67,14 @@ class bindbapi(fakedbapi):
                        self.bintree.populate()
                return fakedbapi.match(self, *pargs, **kwargs)
 
+       def cpv_inject(self, cpv, **kwargs):
+               self._aux_cache.pop(cpv, None)
+               fakedbapi.cpv_inject(cpv, **kwargs)
+
+       def cpv_remove(self, cpv):
+               self._aux_cache.pop(cpv, None)
+               fakedbapi.cpv_remove(cpv)
+
        def aux_get(self, mycpv, wants):
                if self.bintree and not self.bintree.populated:
                        self.bintree.populate()
@@ -137,6 +145,7 @@ class bindbapi(fakedbapi):
                        if not v:
                                del mydata[k]
                mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
+               # inject will clear stale caches via cpv_inject.
                self.bintree.inject(cpv)
 
        def cp_list(self, *pargs, **kwargs):
@@ -485,6 +494,13 @@ class binarytree(object):
                if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
                        return 0
 
+               # Clear all caches in case populate is called multiple times
+               # as may be the case when _global_updates calls populate()
+               # prior to performing package moves since it only wants to
+               # operate on local packages (getbinpkgs=0).
+               self._remotepkgs = None
+               self.dbapi._clear_cache()
+               self.dbapi._aux_cache.clear()
                if True:
                        pkg_paths = {}
                        self._pkg_paths = pkg_paths
@@ -696,10 +712,7 @@ class binarytree(object):
                        writemsg(_("!!! PORTAGE_BINHOST unset, but use is requested.\n"),
                                noiselevel=-1)
 
-               if getbinpkgs and \
-                       "PORTAGE_BINHOST" in self.settings and \
-                       not self._remotepkgs:
-
+               if getbinpkgs and 'PORTAGE_BINHOST' in self.settings:
                        base_url = self.settings["PORTAGE_BINHOST"]
                        from portage.const import CACHE_PATH
                        try:
@@ -916,7 +929,6 @@ class binarytree(object):
                        return
                slot = slot.strip()
                self.dbapi.cpv_inject(cpv)
-               self.dbapi._aux_cache.pop(cpv, None)
 
                # Reread the Packages index (in case it's been changed by another
                # process) and then updated it, all while holding a lock.
index c04caf940ed30e286e80a053ca7d138ac98b630c..618f8be44c6638a80c4fe3ffbdd2f0a770593a88 100644 (file)
@@ -1940,6 +1940,8 @@ class vardbapi(dbapi):
                                #dest already exists; keep this puppy where it is.
                                continue
                        _movefile(origpath, newpath, mysettings=self.settings)
+                       self._clear_pkg_cache(self._dblink(mycpv))
+                       self._clear_pkg_cache(self._dblink(mynewcpv))
 
                        # We need to rename the ebuild now.
                        old_pf = catsplit(mycpv)[1]
@@ -2336,6 +2338,7 @@ class vardbapi(dbapi):
                treetype="vartree", vartree=self.vartree)
                if not mylink.exists():
                        raise KeyError(cpv)
+               self._clear_pkg_cache(mylink)
                for k, v in values.items():
                        if v:
                                mylink.setfile(k, v)