aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2016-04-07 22:34:15 -0700
committerZac Medico <zmedico@gentoo.org>2016-05-18 09:27:58 -0700
commit8e57a8b34cc552267dd987f744f04d021041c75b (patch)
treed850bc5635d7dcfcf82c8f46f9f36cce88110ace /bin/egencache
parent__eapi6_src_prepare: handle empty PATCHES array (bug 579626) (diff)
downloadportage-8e57a8b34cc552267dd987f744f04d021041c75b.tar.gz
portage-8e57a8b34cc552267dd987f744f04d021041c75b.tar.bz2
portage-8e57a8b34cc552267dd987f744f04d021041c75b.zip
egencache --update-changelogs: fix timestamp assumptions (bug 579292)
Since commit times are not necessarily ordered, synchronize the ChangeLog mtime with the last commit time, and use exact comparison to detect changes. X-Gentoo-bug: 579292 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=579292 Acked-by: Brian Dolbec <dolsen@gentoo.org>
Diffstat (limited to 'bin/egencache')
-rwxr-xr-xbin/egencache9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/egencache b/bin/egencache
index af0e1f2a5..80738cfee 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -775,12 +775,16 @@ class GenChangeLogs(object):
# This cp has not been added to the repo.
return
+ lmod = long(lmod)
+
try:
- cmod = os.stat('ChangeLog').st_mtime
+ cmod = os.stat('ChangeLog')[stat.ST_MTIME]
except OSError:
cmod = 0
- if float(cmod) >= float(lmod):
+ # Use exact comparison, since commit times are
+ # not necessarily ordered.
+ if cmod == lmod:
return
try:
@@ -903,6 +907,7 @@ class GenChangeLogs(object):
'\n%s\n\n' % '\n'.join(self._wrapper.fill(x) for x in body))
output.close()
+ os.utime(self._changelog_output, (lmod, lmod))
def _task_iter(self):
if not os.path.isdir(os.environ.get('GIT_DIR', os.path.join(self._repo_path, '.git'))):