Commit bb04e105 authored by scherkus's avatar scherkus Committed by Commit bot

Have build/landmines.py delete contents of build directory.

Some checkouts have the build directory mounted, which causes the script
to throw an exception when it attempts to remove the directory itself.

Review URL: https://codereview.chromium.org/532323002

Cr-Commit-Position: refs/heads/master@{#293199}
parent 5f405efc
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
""" """
This script runs every build as the first hook (See DEPS). If it detects that This script runs every build as the first hook (See DEPS). If it detects that
the build should be clobbered, it will remove the build directory. the build should be clobbered, it will delete the contents of the build
directory.
A landmine is tripped when a builder checks out a different revision, and the A landmine is tripped when a builder checks out a different revision, and the
diff between the new landmines and the old ones is non-null. At this point, the diff between the new landmines and the old ones is non-null. At this point, the
...@@ -70,8 +71,14 @@ def clobber_if_necessary(new_landmines): ...@@ -70,8 +71,14 @@ def clobber_if_necessary(new_landmines):
sys.stdout.write('Clobbering due to:\n') sys.stdout.write('Clobbering due to:\n')
sys.stdout.writelines(diff) sys.stdout.writelines(diff)
# Clobber. # Clobber contents of build directory but not directory itself: some
shutil.rmtree(out_dir) # checkouts have the build directory mounted.
for f in os.listdir(out_dir):
path = os.path.join(out_dir, f)
if os.path.isfile(path):
os.unlink(path)
elif os.path.isdir(path):
shutil.rmtree(path)
# Save current set of landmines for next time. # Save current set of landmines for next time.
with open(landmines_path, 'w') as f: with open(landmines_path, 'w') as f:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment