From: Fabian Groffen Date: Wed, 3 Mar 2010 18:49:02 +0000 (-0000) Subject: Merged from trunk -r15717:15732 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=4fe7fd1a0b1098a11011f7440b7f70d764ad4da1;p=portage.git Merged from trunk -r15717:15732 | 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 --- diff --git a/NEWS b/NEWS index b83577786..81255cb66 100644 --- 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 ------------- diff --git a/bin/fixpackages b/bin/fixpackages index fed30ac75..391102e2c 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -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: diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index ae61b7918..e47b572be 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -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 diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index add3a00b7..915149eb0 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -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 diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.py index b6fad9c14..78bef63d2 100644 --- a/pym/_emerge/EbuildBuildDir.py +++ b/pym/_emerge/EbuildBuildDir.py @@ -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 diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py index 4310c892a..e12fd94eb 100644 --- a/pym/portage/_global_updates.py +++ b/pym/portage/_global_updates.py @@ -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