From 59ffddbb08375caab794d73804d7142ad94ca700 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 11 Mar 2010 18:39:54 +0000 Subject: [PATCH] Merged from trunk -r15795:15815 | 15802 | Use ewarn output style to add some color. | | zmedico | | | 15803 | Add periods. | | zmedico | | | 15804 | Merge libc asap for all roots instead of just ROOT="/". | | zmedico | | | 15809 | Disable implicit libc deps for ROOT != "/" since it's | | zmedico | probably not needed. | | 15810 | Only create implicit libc deps when the version changes. | | zmedico | | | 15813 | Only try to merge portage asap when the new version is | | zmedico | different. | svn path=/main/branches/prefix/; revision=15817 --- pym/_emerge/Scheduler.py | 17 +++++++++++++++-- pym/_emerge/depgraph.py | 20 +++++++++++++------- pym/_emerge/sync/old_tree_timestamp.py | 14 +++++++------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index c35c2eaba..404a4483b 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -425,6 +425,7 @@ class Scheduler(PollScheduler): list contains both a new-style virtual and an old-style PROVIDE virtual, the new-style virtual is used. """ + implicit_libc_roots = set([self._running_root.root]) libc_set = InternalPackageSet([LIBC_PACKAGE_ATOM]) norm_libc_pkgs = {} virt_libc_pkgs = {} @@ -434,7 +435,8 @@ class Scheduler(PollScheduler): continue if pkg.installed: continue - if pkg.operation == 'merge': + if pkg.root in implicit_libc_roots and \ + pkg.operation == 'merge': if libc_set.findAtomForPackage(pkg): if pkg.category == 'virtual': d = virt_libc_pkgs @@ -449,6 +451,16 @@ class Scheduler(PollScheduler): # Prefer new-style virtuals over old-style PROVIDE virtuals. libc_pkg_map = norm_libc_pkgs.copy() libc_pkg_map.update(virt_libc_pkgs) + + # Only add a dep when the version changes. + for libc_pkg in list(libc_pkg_map.values()): + if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( + libc_pkg.cpv): + del libc_pkg_map[pkg.root] + + if not libc_pkg_map: + return + libc_pkgs = set(libc_pkg_map.values()) earlier_libc_pkgs = set() @@ -458,7 +470,8 @@ class Scheduler(PollScheduler): continue if pkg.installed: continue - if pkg.operation == 'merge': + if pkg.root in implicit_libc_roots and \ + pkg.operation == 'merge': if pkg in libc_pkgs: earlier_libc_pkgs.add(pkg) else: diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 7d3504167..366aa3cb8 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3341,7 +3341,9 @@ class depgraph(object): if replacement_portage == running_portage: replacement_portage = None - if replacement_portage is not None: + if replacement_portage is not None and \ + (running_portage is None or \ + (running_portage.cpv != replacement_portage.cpv)): # update from running_portage to replacement_portage asap asap_nodes.append(replacement_portage) @@ -3363,12 +3365,16 @@ class depgraph(object): # Merge libc asap, in order to account for implicit # dependencies. See bug #303567. - libc_pkg = self._dynamic_config.mydbapi[running_root].match_pkgs( - portage.const.LIBC_PACKAGE_ATOM) - if libc_pkg: - libc_pkg = libc_pkg[0] - if libc_pkg.operation == 'merge': - asap_nodes.append(libc_pkg) + for root in (running_root,): + libc_pkg = self._dynamic_config.mydbapi[root].match_pkgs( + portage.const.LIBC_PACKAGE_ATOM) + if libc_pkg: + libc_pkg = libc_pkg[0] + if libc_pkg.operation == 'merge': + # Only add a dep when the version changes. + if not libc_pkg.root_config.trees[ + 'vartree'].dbapi.cpv_exists(libc_pkg.cpv): + asap_nodes.append(libc_pkg) def gather_deps(ignore_priority, mergeable_nodes, selected_nodes, node): diff --git a/pym/_emerge/sync/old_tree_timestamp.py b/pym/_emerge/sync/old_tree_timestamp.py index 9bd070c13..00d671c29 100644 --- a/pym/_emerge/sync/old_tree_timestamp.py +++ b/pym/_emerge/sync/old_tree_timestamp.py @@ -9,7 +9,8 @@ import time from portage import os from portage.exception import PortageException from portage.localization import _ -from portage.util import grabfile, writemsg_level, writemsg_stdout +from portage.output import EOutput +from portage.util import grabfile, writemsg_level def have_english_locale(): lang, enc = locale.getdefaultlocale() @@ -87,13 +88,12 @@ def old_tree_timestamp_warn(portdir, settings): return False if (unixtime - 86400 * warnsync) > lastsync: + out = EOutput() if have_english_locale(): - writemsg_stdout(">>> Last emerge --sync was %s ago\n" % \ - whenago(unixtime - lastsync), noiselevel=-1) + out.ewarn("Last emerge --sync was %s ago." % \ + whenago(unixtime - lastsync)) else: - writemsg_stdout(">>> %s\n" % \ - _("Last emerge --sync was %s") % \ - time.strftime('%c', time.localtime(lastsync)), - noiselevel=-1) + out.ewarn(_("Last emerge --sync was %s.") % \ + time.strftime('%c', time.localtime(lastsync))) return True return False -- 2.26.2