diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-04-08 07:59:15 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-05-27 03:52:06 -0700 |
commit | 0c85dbb060efade7114a72db615199c88e8558d6 (patch) | |
tree | d5ebb6809ccc8826e5909badb6ab13761e520b40 | |
parent | Bug #310947 - When expanding categories for atoms inside select_files, (diff) | |
download | portage-idfetch-0c85dbb060efade7114a72db615199c88e8558d6.tar.gz portage-idfetch-0c85dbb060efade7114a72db615199c88e8558d6.tar.bz2 portage-idfetch-0c85dbb060efade7114a72db615199c88e8558d6.zip |
Add --rebuilt-binaries-timestamp option
This option makes emerge ignore binaries that would have been used
for --rebuilt-binaries, if they are older than the given timestamp.
Binaries are only reinstalled if they have a newer BUILD_TIME than
the installed package (not only unequal) with this option.
-rw-r--r-- | man/emerge.1 | 7 | ||||
-rw-r--r-- | pym/_emerge/depgraph.py | 26 | ||||
-rw-r--r-- | pym/_emerge/main.py | 20 |
3 files changed, 49 insertions, 4 deletions
diff --git a/man/emerge.1 b/man/emerge.1 index e717c982..d1b73778 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -504,6 +504,13 @@ automatically when using binary packages (\fB\-\-usepkgonly\fR or \fB\-\-getbinpkgonly\fR) together with \fB\-\-update\fR and \fB\-\-deep\fR. .TP +.BR "\-\-rebuilt\-binaries\-timestamp[=TIMESTAMP]" +This option modifies emerge's behaviour only if +\fB\-\-rebuilt\-binaries\fR is given. Only binaries that +have a BUILD_TIME that is larger than the given TIMESTAMP +and that is larger than that of the installed package will +be considered by the rebuilt\-binaries logic. +.TP .BR "\-\-reinstall changed\-use" Tells emerge to include installed packages where USE flags have changed since installation. Unlike \fB\-\-newuse\fR, this option does diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5a7d2b76..ae7b2113 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2771,10 +2771,28 @@ class depgraph(object): # non-empty, in order to avoid cases like to # bug #306659 where BUILD_TIME fields are missing # in local and/or remote Packages file. - if built_pkg.metadata['BUILD_TIME'] and \ - (built_pkg.metadata['BUILD_TIME'] != \ - inst_pkg.metadata['BUILD_TIME']): - return built_pkg, built_pkg + try: + built_timestamp = int(built_pkg.metadata['BUILD_TIME']) + except (KeyError, ValueError): + built_timestamp = 0 + + try: + installed_timestamp = int(inst_pkg.metadata['BUILD_TIME']) + except (KeyError, ValueError): + installed_timestamp = 0 + + if "--rebuilt-binaries-timestamp" in self._frozen_config.myopts: + minimal_timestamp = self._frozen_config.myopts["--rebuilt-binaries-timestamp"] + if built_timestamp > installed_timestamp and \ + built_timestamp >= minimal_timestamp: + return built_pkg, built_pkg + else: + #Don't care if the binary has an older BUILD_TIME than the installed + #package. This is for closely tracking a binhost. + #Use --rebuilt-binaries-timestamp 0 if you want only newer binaries + #pulled in here. + if built_timestamp != installed_timestamp: + return built_pkg, built_pkg if avoid_update: for pkg in matched_packages: diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index ca3d17be..fa2dbaa1 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -637,6 +637,12 @@ def parse_opts(tmpcmdline, silent=False): "type" : "choice", "choices" : ("True", "n") }, + + "--rebuilt-binaries-timestamp": { + "help" : "use only binaries that are newer than this " + \ + "timestamp for --rebuilt-binaries", + "action" : "store" + }, "--root": { "help" : "specify the target root filesystem for merging packages", @@ -855,6 +861,20 @@ def parse_opts(tmpcmdline, silent=False): (myoptions.load_average,), noiselevel=-1) myoptions.load_average = load_average + + if myoptions.rebuilt_binaries_timestamp: + try: + rebuilt_binaries_timestamp = int(myoptions.rebuilt_binaries_timestamp) + except ValueError: + rebuilt_binaries_timestamp = -1 + + if rebuilt_binaries_timestamp < 0: + rebuilt_binaries_timestamp = 0 + if not silent: + writemsg("!!! Invalid --rebuilt-binaries-timestamp parameter: '%s'\n" % \ + (myoptions.rebuilt_binaries_timestamp,), noiselevel=-1) + + myoptions.rebuilt_binaries_timestamp = rebuilt_binaries_timestamp if myoptions.use_ebuild_visibility in ("True",): myoptions.use_ebuild_visibility = True |