Merged from trunk -r15717:15732
authorFabian Groffen <grobian@gentoo.org>
Wed, 3 Mar 2010 18:49:02 +0000 (18:49 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 3 Mar 2010 18:49:02 +0000 (18:49 -0000)
   | 15720   | Bug #304981 - Remove redundant fetch log removal code which  |
   | zmedico | is already handled by EbuildFetcher.                         |

   | 15721   | Remove fetch log after successful fetch.                     |
   | zmedico |                                                              |

   | 15722   | Unlink log instead of truncate, to avoid leaving empty log   |
   | zmedico | in $PORT_LOGDIR. This reverts bug 304981 (reporting doesn't  |
   |         | use tee like this anymore so he'd prefer the old behavior).  |

   | 15728   | Make _global_updates() silently return if ROOT != "/" and    |
   | zmedico | make fixpackages bail out with an error message in this case |
   |         | which suggests to instead use emaint --fix movebin and/or    |
   |         | moveinst. This prevents useless/ugly global updates messages |
   |         | that flood the terminal when ROOT != "/".                    |

   | 15730   | Add news about splitting the top-level __init__.py.          |
   | zmedico |                                                              |

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

NEWS
bin/fixpackages
pym/_emerge/Binpkg.py
pym/_emerge/EbuildBuild.py
pym/_emerge/EbuildBuildDir.py
pym/portage/_global_updates.py

diff --git a/NEWS b/NEWS
index b8357778615f5c0780bc85dcb0d5931fcaaceac7..81255cb662a8e2bd2ad23dfb1f5d2954186efe91 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,12 @@ portage-2.2
   in order to protect against uninstallation of required libraries.
 * Add support for generic package sets (also see RELEASE-NOTES)
 
+portage-2.1.8
+-------------
+* The top-level __init__.py for the portage python package has been split into
+  many smaller python modules, making the code easier to navigate and allowing
+  small parts of the portage api to be imported with less overhead.
+
 portage-2.1.7
 -------------
 
index fed30ac754b29dc3dae191b9ad1f820db0ca0b9e..391102e2cb02a0ef64398c8bc7738026d1a40c47 100755 (executable)
@@ -9,11 +9,22 @@ import os,sys
 os.environ["PORTAGE_CALLER"]="fixpackages"
 
 from portage import os
+from portage.output import EOutput
+from textwrap import wrap
 from portage._global_updates import _global_updates
 mysettings = portage.settings
 mytrees = portage.db
 mtimedb = portage.mtimedb
 
+if mysettings['ROOT'] != "/":
+       out = EOutput()
+       msg = "The fixpackages program is not intended for use with " + \
+               "ROOT != \"/\". Instead use `emaint --fix movebin` and/or " + \
+               "`emaint --fix moveinst."
+       for line in wrap(msg, 72):
+               out.eerror(line)
+       sys.exit(1)
+
 try:
        os.nice(int(mysettings.get("PORTAGE_NICENESS", "0")))
 except (OSError, ValueError) as e:
index ae61b7918598943c19c5745a2d91090a7f873500..e47b572be42a75a15f3378444cfb40a2ff81a0c9 100644 (file)
@@ -180,6 +180,14 @@ class Binpkg(CompositeTask):
                if self._fetched_pkg:
                        self._bintree.inject(pkg.cpv, filename=pkg_path)
 
+               logfile = self.settings.get("PORTAGE_LOG_FILE")
+               if logfile is not None and os.path.isfile(logfile):
+                       # Remove fetch log after successful fetch.
+                       try:
+                               os.unlink(logfile)
+                       except OSError:
+                               pass
+
                if self.opts.fetchonly:
                        self._current_task = None
                        self.returncode = os.EX_OK
index add3a00b7c84dc33b12e6c6625bfa44e44d2c3da..915149eb07f303ebdbe91bfc91d1853ef6d44f06 100644 (file)
@@ -107,13 +107,6 @@ class EbuildBuild(CompositeTask):
                        os.path.exists(fetcher.logfile):
                        self.settings["PORTAGE_LOG_FILE"] = fetcher.logfile
 
-               if not fetch_failed and fetcher.logfile is not None:
-                       # Fetch was successful, so remove the fetch log.
-                       try:
-                               os.unlink(fetcher.logfile)
-                       except OSError:
-                               pass
-
                if fetch_failed or opts.fetchonly:
                        self.wait()
                        return
index b6fad9c14c8fdba2deb7917617f9faf9d02af12f..78bef63d2e5298466091907c21d615149cf515f0 100644 (file)
@@ -66,9 +66,8 @@ class EbuildBuildDir(SlotObject):
                settings = self.settings
                log_file = settings.get('PORTAGE_LOG_FILE')
                if log_file is not None and os.path.isfile(log_file):
-                       # Truncate rather than unlink, so tail -f still works.
                        try:
-                               open(log_file, 'wb')
+                               os.unlink(log_file)
                        except OSError:
                                pass
 
index 4310c892afa19c6f8adf0c8bab618af7e096d7f8..e12fd94eb55946010b43bb440f06cc5c63b12bf5 100644 (file)
@@ -18,6 +18,8 @@ from portage.util import grabfile, writemsg, writemsg_stdout, write_atomic
 def _global_updates(trees, prev_mtimes):
        """
        Perform new global updates if they exist in $PORTDIR/profiles/updates/.
+       This simply returns if ROOT != "/" (when len(trees) != 1). If ROOT != "/"
+       then the user should instead use emaint --fix movebin and/or moveinst.
 
        @param trees: A dictionary containing portage trees.
        @type trees: dict
@@ -30,8 +32,10 @@ def _global_updates(trees, prev_mtimes):
        """
        # only do this if we're root and not running repoman/ebuild digest
 
-       if secpass < 2 or "SANDBOX_ACTIVE" in os.environ:
-               return
+       if secpass < 2 or \
+               "SANDBOX_ACTIVE" in os.environ or \
+               len(trees) != 1:
+               return 0
        root = "/"
        mysettings = trees["/"]["vartree"].settings
        updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates")
@@ -44,7 +48,7 @@ def _global_updates(trees, prev_mtimes):
        except DirectoryNotFound:
                writemsg(_("--- 'profiles/updates' is empty or "
                        "not available. Empty portage tree?\n"), noiselevel=1)
-               return
+               return 0
        myupd = None
        if len(update_data) > 0:
                do_upgrade_packagesmessage = 0