From 77b7b2e6dc2e13d3795df6f5792db851ba9f9e24 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Mon, 30 Apr 2012 15:18:58 +1200 Subject: [PATCH] Bug 707579, xpt.py shouldn't try to generate destination file if inputs are all older, r=khuey --- xpcom/typelib/xpt/tools/xpt.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xpcom/typelib/xpt/tools/xpt.py b/xpcom/typelib/xpt/tools/xpt.py index f751782a6c1..3dce370283d 100644 --- a/xpcom/typelib/xpt/tools/xpt.py +++ b/xpcom/typelib/xpt/tools/xpt.py @@ -1321,12 +1321,25 @@ def xpt_dump(file): def xpt_link(dest, inputs): """ Link all of the xpt files in |inputs| together and write the - result ot |dest|. + result to |dest|. """ + if not inputs: print >>sys.stderr, "Usage: xpt_link " return + + # Don't re-create dest if newer than the input files. + if os.path.exists(dest): + maxInputChange = 0; + for f in inputs: + s = os.stat(f).st_mtime + if s > maxInputChange: + maxInputChange = s + if maxInputChange < os.stat(dest).st_mtime: + print dest, " is already up-to-date." + return + t1 = Typelib.read(inputs[0]) for f in inputs[1:]: t2 = Typelib.read(f)