diff options
author | David James <davidjames@google.com> | 2011-03-25 10:10:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-03-25 10:10:54 -0700 |
commit | 83e1a973f7abc19c099a8459209ca0979246896b (patch) | |
tree | 8c7e6e2e2fc866e2d05601299265d17c6d6616e7 | |
parent | 1f1e49dfcbb1858af8a0a09165bb311aac33b423 (diff) | |
download | portage-83e1a973f7abc19c099a8459209ca0979246896b.tar.gz portage-83e1a973f7abc19c099a8459209ca0979246896b.tar.bz2 portage-83e1a973f7abc19c099a8459209ca0979246896b.zip |
env_update: remove sleep_for_mtime_granularity
Instead of sleeping, use os.utime to avoid mtime ambiguity.
Change-Id: I359ececca19b6be9f5997ac5c8fe6fea6ea49dd5
Review URL: http://codereview.chromium.org/6676150
-rw-r--r-- | pym/portage/util/env_update.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py index 68531da59..e2cb97f02 100644 --- a/pym/portage/util/env_update.py +++ b/pym/portage/util/env_update.py @@ -181,11 +181,6 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None, newprelink.write("-b %s\n" % (x,)) newprelink.close() - # Portage stores mtimes with 1 second granularity but in >=python-2.5 finer - # granularity is possible. In order to avoid the potential ambiguity of - # mtimes that differ by less than 1 second, sleep here if any of the - # directories have been modified during the current second. - sleep_for_mtime_granularity = False current_time = long(time.time()) mtime_changed = False lib_dirs = set() @@ -205,8 +200,13 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None, continue raise if newldpathtime == current_time: - sleep_for_mtime_granularity = True - if x in prev_mtimes: + # Reset mtime to avoid the potential ambiguity of times that + # differ by less than 1 second. + newldpathtime -= 1 + os.utime(x, (newldpathtime, newldpathtime)) + prev_mtimes[x] = newldpathtime + mtime_changed = True + elif x in prev_mtimes: if prev_mtimes[x] == newldpathtime: pass else: @@ -287,7 +287,3 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None, for x in env_keys: outfile.write("setenv %s '%s'\n" % (x, env[x])) outfile.close() - - if sleep_for_mtime_granularity: - while current_time == long(time.time()): - time.sleep(1) |