diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-08-07 10:07:13 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-07 18:48:59 -0700 |
commit | 23225a062ac87a53c1a206a0c1978698458f7ce4 (patch) | |
tree | 8b80e27072ac01db001f41711ff987b7f1e35a55 | |
parent | Bug #308835: Support options in shebang and terminate 's' option of sed. (diff) | |
download | portage-multirepo-23225a062ac87a53c1a206a0c1978698458f7ce4.tar.gz portage-multirepo-23225a062ac87a53c1a206a0c1978698458f7ce4.tar.bz2 portage-multirepo-23225a062ac87a53c1a206a0c1978698458f7ce4.zip |
autounmask: Restart less often for use changes
-rw-r--r-- | pym/_emerge/depgraph.py | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index e0e215cf..1d78a0cb 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2627,19 +2627,37 @@ class depgraph(object): new_changes[flag] = False new_use.update(old_use.difference(target_use.keys())) - def want_restart_for_use_change(pkg): + def want_restart_for_use_change(pkg, new_use): if pkg not in self._dynamic_config.digraph.nodes: return False - #TODO: We can be more clever here. No need to restart if - # 1) we don't have a parent that can't work with our - # new use config - # and - # 2) none of pkg's *DEPEND vars changed - return True + + for key in "DEPEND", "RDEPEND", "PDEPEND", "LICENSE": + dep = pkg.metadata[key] + old_val = set(portage.dep.paren_normalize( \ + portage.dep.use_reduce(portage.dep.paren_reduce(dep), pkg.use.enabled))) + new_val = set(portage.dep.paren_normalize( \ + portage.dep.use_reduce(portage.dep.paren_reduce(dep), new_use))) + + if old_val != new_val: + return True + + parent_atoms = self._dynamic_config._parent_atoms.get(pkg) + if not parent_atoms: + return False + + new_use, changes = self._dynamic_config._needed_use_config_changes.get(pkg) + for ppkg, atom in parent_atoms: + if not atom.use or \ + not atom.use.required.intersection(changes.keys()): + continue + else: + return True + + return False if new_changes != old_changes: self._dynamic_config._needed_use_config_changes[pkg] = (new_use, new_changes) - if want_restart_for_use_change(pkg): + if want_restart_for_use_change(pkg, new_use): self._dynamic_config._need_restart = True return new_use |