public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] egencache --update-changelogs: fix timestamp assumptions (bug 579292)
@ 2016-04-08  5:46 Zac Medico
  2016-04-08  6:51 ` Brian Dolbec
  0 siblings, 1 reply; 5+ messages in thread
From: Zac Medico @ 2016-04-08  5:46 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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
---
 bin/egencache | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 0123d57..41612e5 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'))):
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-09  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08  5:46 [gentoo-portage-dev] [PATCH] egencache --update-changelogs: fix timestamp assumptions (bug 579292) Zac Medico
2016-04-08  6:51 ` Brian Dolbec
2016-04-08  7:29   ` Zac Medico
2016-04-09  1:12     ` Brian Dolbec
2016-04-09  7:51       ` Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox