Reviewers: jochen (slow), Jakob, tandrii(chromium),

Message:
PTAL

Description:
Trigger a landmine on first-time landmine deployment.

Without this change, it is non-trivial to know during
runhooks, if a landmine was just triggered in a checkout
that doesn't have the initial landmines script CL yet, i.e.
that didn't create a .landmines file yet.

BUG=chromium:403263
LOG=n

Please review this at https://codereview.chromium.org/954153002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+27, -19 lines):
  M build/landmines.py


Index: build/landmines.py
diff --git a/build/landmines.py b/build/landmines.py
index a35123afc528ebd13832d966593c3350254bedb6..c41f123051a3829f65670c1d1be35f5df5dfafdc 100755
--- a/build/landmines.py
+++ b/build/landmines.py
@@ -132,16 +132,7 @@ depfile = build.ninja.d
     f.write('build.ninja: nonexistant_file.gn\n')


-def clobber_if_necessary(new_landmines):
-  """Does the work of setting, planting, and triggering landmines."""
-  out_dir = get_build_dir(landmine_utils.builder())
- landmines_path = os.path.normpath(os.path.join(out_dir, '..', '.landmines'))
-  try:
-    os.makedirs(out_dir)
-  except OSError as e:
-    if e.errno == errno.EEXIST:
-      pass
-
+def needs_clobber(landmines_path, new_landmines):
   if os.path.exists(landmines_path):
     with open(landmines_path, 'r') as f:
       old_landmines = f.readlines()
@@ -152,16 +143,33 @@ def clobber_if_necessary(new_landmines):
           fromfiledate=old_date, tofiledate=time.ctime(), n=0)
       sys.stdout.write('Clobbering due to:\n')
       sys.stdout.writelines(diff)
+      return True
+  else:
+    sys.stdout.write('Clobbering due to missing landmines file.\n')
+    return True
+  return False
+
+
+def clobber_if_necessary(new_landmines):
+  """Does the work of setting, planting, and triggering landmines."""
+  out_dir = get_build_dir(landmine_utils.builder())
+ landmines_path = os.path.normpath(os.path.join(out_dir, '..', '.landmines'))
+  try:
+    os.makedirs(out_dir)
+  except OSError as e:
+    if e.errno == errno.EEXIST:
+      pass

-      # Clobber contents of build directory but not directory itself: some
-      # checkouts have the build directory mounted.
-      for f in os.listdir(out_dir):
-        path = os.path.join(out_dir, f)
- # Soft version of chromium's clobber. Only delete directories not files - # as e.g. on windows the output dir is the build dir that shares some
-        # checked out files.
- if os.path.isdir(path) and re.search(r"(?:[Rr]elease)| (?:[Dd]ebug)", f):
-          delete_build_dir(path)
+  if needs_clobber(landmines_path, new_landmines):
+    # Clobber contents of build directory but not directory itself: some
+    # checkouts have the build directory mounted.
+    for f in os.listdir(out_dir):
+      path = os.path.join(out_dir, f)
+ # Soft version of chromium's clobber. Only delete directories not files
+      # as e.g. on windows the output dir is the build dir that shares some
+      # checked out files.
+ if os.path.isdir(path) and re.search(r"(?:[Rr]elease)|(?:[Dd]ebug)", f):
+        delete_build_dir(path)

   # Save current set of landmines for next time.
   with open(landmines_path, 'w') as f:


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to