rebuilt-binaries: prefer newer unbuilt
authorZac Medico <zmedico@gentoo.org>
Thu, 26 May 2011 00:30:36 +0000 (17:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 26 May 2011 06:12:38 +0000 (23:12 -0700)
pym/_emerge/depgraph.py

index 5f74b6deb17840cddb86ff6d3d46a7143da969ee..4556681b7097e77708835d95b778b6f1f9f49fc9 100644 (file)
@@ -3521,11 +3521,15 @@ class depgraph(object):
                        if rebuilt_binaries:
                                inst_pkg = None
                                built_pkg = None
+                               unbuilt_pkg = None
                                for pkg in matched_packages:
                                        if pkg.installed:
                                                inst_pkg = pkg
                                        elif pkg.built:
                                                built_pkg = pkg
+                                       else:
+                                               if unbuilt_pkg is None or pkg > unbuilt_pkg:
+                                                       unbuilt_pkg = pkg
                                if built_pkg is not None and inst_pkg is not None:
                                        # Only reinstall if binary package BUILD_TIME is
                                        # non-empty, in order to avoid cases like to
@@ -3541,7 +3545,9 @@ class depgraph(object):
                                        except (KeyError, ValueError):
                                                installed_timestamp = 0
 
-                                       if "--rebuilt-binaries-timestamp" in self._frozen_config.myopts:
+                                       if unbuilt_pkg is not None and unbuilt_pkg > built_pkg:
+                                               pass
+                                       elif "--rebuilt-binaries-timestamp" in self._frozen_config.myopts:
                                                minimal_timestamp = self._frozen_config.myopts["--rebuilt-binaries-timestamp"]
                                                if built_timestamp and \
                                                        built_timestamp > installed_timestamp and \