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

Unified Diff: build/landmines.py

Issue 532323002: Have build/landmines.py delete contents of build directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 f7dc07d1cb27d761a88c550f7c03ed922fbd1079..a03486499bba4b055881804d24915d2f8db80fd1 100755
--- a/build/landmines.py
+++ b/build/landmines.py
@@ -5,7 +5,8 @@
"""
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
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):
sys.stdout.write('Clobbering due to:\n')
sys.stdout.writelines(diff)
- # Clobber.
- shutil.rmtree(out_dir)
+ # 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)
+ if os.path.isfile(path):
+ os.unlink(path)
+ elif os.path.isdir(path):
+ shutil.rmtree(path)
# Save current set of landmines for next time.
with open(landmines_path, 'w') as f:
« 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