Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: build/landmines.py

Issue 410893002: Make landmines work on the first landmine. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/landmines.py
diff --git a/build/landmines.py b/build/landmines.py
index 2b3d7753c0db9fe26b1b9e659a0b8600bbadc287..fb8246f212f6cc7b483b8dcd2626dd7032bf32f6 100755
--- a/build/landmines.py
+++ b/build/landmines.py
@@ -58,21 +58,26 @@ def set_up_landmines(target, new_landmines):
if not os.path.exists(out_dir):
return
- if os.path.exists(landmines_path):
- triggered = os.path.join(out_dir, '.landmines_triggered')
- with open(landmines_path, 'r') as f:
- old_landmines = f.readlines()
- if old_landmines != new_landmines:
- old_date = time.ctime(os.stat(landmines_path).st_ctime)
- diff = difflib.unified_diff(old_landmines, new_landmines,
- fromfile='old_landmines', tofile='new_landmines',
- fromfiledate=old_date, tofiledate=time.ctime(), n=0)
-
- with open(triggered, 'w') as f:
- f.writelines(diff)
- elif os.path.exists(triggered):
- # Remove false triggered landmines.
- os.remove(triggered)
+ # Make sure the landmines tracker exists.
+ open(landmines_path, 'a').close()
+
+ triggered = os.path.join(out_dir, '.landmines_triggered')
+ with open(landmines_path, 'r') as f:
+ old_landmines = f.readlines()
+ if old_landmines != new_landmines:
+ old_date = time.ctime(os.stat(landmines_path).st_ctime)
+ diff = difflib.unified_diff(old_landmines, new_landmines,
+ fromfile='old_landmines', tofile='new_landmines',
+ fromfiledate=old_date, tofiledate=time.ctime(), n=0)
+
+ with open(triggered, 'w') as f:
+ f.writelines(diff)
+ print "Setting landmine: %s" % triggered
Jakob Kummerow 2014/07/23 11:05:48 are you keeping these print statements intentional
+ print "Reason:\n%s" % diff
+ elif os.path.exists(triggered):
+ # Remove false triggered landmines.
+ os.remove(triggered)
+ print "Removing landmine: %s" % triggered
with open(landmines_path, 'w') as f:
f.writelines(new_landmines)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698