diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-02-18 07:07:41 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-02-18 07:07:41 +0000 |
commit | 744b5b12943ba4dbe27a694250c8a5d390b6e5bc (patch) | |
tree | 097b22b5d402975d7745b39f1c25bd80262238c4 /pym/_emerge/depgraph.py | |
parent | b4a4c9af72e036d8a0b2698c823cdf2979315369 (diff) | |
download | portage-744b5b12943ba4dbe27a694250c8a5d390b6e5bc.tar.gz portage-744b5b12943ba4dbe27a694250c8a5d390b6e5bc.tar.bz2 portage-744b5b12943ba4dbe27a694250c8a5d390b6e5bc.zip |
Add a --rebuilt-binaries[=n] option, causing automatic replacement of
installed packages with binary packages that have been rebuilt. Rebuilds
are detected by comparison of BUILD_TIME package metadata. This option is
enabled automatically when using binary packages, so rebuilt binaries are
installed with a user's typical update command. This isn't possible with
the existing @rebuild-binaries package set since that only works with
--selective=n and therefore can't be used with a typical world update.
The package set framework should support this type of behavior sometime
in the future.
svn path=/main/trunk/; revision=15364
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r-- | pym/_emerge/depgraph.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 38a48d6fe..ac6744a6b 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2396,6 +2396,9 @@ class depgraph(object): atom_set = InternalPackageSet(initial_atoms=(atom,)) existing_node = None myeb = None + usepkg = "--usepkg" in self._frozen_config.myopts + rebuilt_binaries = usepkg and \ + self._frozen_config.myopts.get('--rebuilt-binaries') != 'n' usepkgonly = "--usepkgonly" in self._frozen_config.myopts empty = "empty" in self._dynamic_config.myparams selective = "selective" in self._dynamic_config.myparams @@ -2615,10 +2618,26 @@ class depgraph(object): if pkg.cp == cp] break + if existing_node is not None and \ + existing_node in matched_packages: + return existing_node, existing_node + if len(matched_packages) > 1: + if rebuilt_binaries: + inst_pkg = None + built_pkg = None + for pkg in matched_packages: + if pkg.installed: + inst_pkg = pkg + elif pkg.built: + built_pkg = pkg + if built_pkg is not None and inst_pkg is not None: + if built_pkg >= inst_pkg and \ + built_pkg.metadata['BUILD_TIME'] != \ + inst_pkg.metadata['BUILD_TIME']: + return built_pkg, built_pkg + if avoid_update: - if existing_node is not None: - return existing_node, existing_node for pkg in matched_packages: if pkg.installed: return pkg, existing_node |