summaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-11 03:23:24 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-11 03:23:24 +0000
commit453c3a1b7a5568d0a06f2c77c86fd098e9af39ba (patch)
tree89bd43eda8f2e43dae55858cfdaaec374f7a69a9 /pym
parentRemove ManifestEntry.__cmp__() since it's not needed and py3k won't use it. (diff)
downloadportage-multirepo-453c3a1b7a5568d0a06f2c77c86fd098e9af39ba.tar.gz
portage-multirepo-453c3a1b7a5568d0a06f2c77c86fd098e9af39ba.tar.bz2
portage-multirepo-453c3a1b7a5568d0a06f2c77c86fd098e9af39ba.zip
Make BinpkgFetcher synchronize the local timestamp of the downloaded file
with the remote file, if the fetcher hasn't done it automatically. svn path=/main/trunk/; revision=12201
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 63276549..de3ab627 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -3462,6 +3462,30 @@ class BinpkgFetcher(SpawnProcess):
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
+ if self.returncode == os.EX_OK:
+ # If possible, update the mtime to match the remote package if
+ # the fetcher didn't already do it automatically.
+ bintree = self.pkg.root_config.trees["bintree"]
+ if bintree._remote_has_index:
+ remote_mtime = bintree._remotepkgs[self.pkg.cpv].get("MTIME")
+ if remote_mtime is not None:
+ try:
+ remote_mtime = float(remote_mtime)
+ except ValueError:
+ pass
+ else:
+ try:
+ local_mtime = os.stat(self.pkg_path).st_mtime
+ except OSError:
+ pass
+ else:
+ if remote_mtime != local_mtime:
+ try:
+ os.utime(self.pkg_path,
+ (remote_mtime, remote_mtime))
+ except OSError:
+ pass
+
if self.locked:
self.unlock()