[llvm] r222308 - Teach llvm-build to avoid touching LibraryDependencies.inc unless the contents
Peter Collingbourne
peter at pcc.me.uk
Tue Nov 18 19:34:20 PST 2014
Author: pcc
Date: Tue Nov 18 21:34:20 2014
New Revision: 222308
URL: http://llvm.org/viewvc/llvm-project?rev=222308&view=rev
Log:
Teach llvm-build to avoid touching LibraryDependencies.inc unless the contents
change. This saves us from rebuilding llvm-config each time we reconfigure.
Modified:
llvm/trunk/utils/llvm-build/llvmbuild/main.py
Modified: llvm/trunk/utils/llvm-build/llvmbuild/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm-build/llvmbuild/main.py?rev=222308&r1=222307&r2=222308&view=diff
==============================================================================
--- llvm/trunk/utils/llvm-build/llvmbuild/main.py (original)
+++ llvm/trunk/utils/llvm-build/llvmbuild/main.py Tue Nov 18 21:34:20 2014
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+import filecmp
import os
import sys
@@ -382,7 +383,7 @@ subdirectories = %s
# Write out the library table.
make_install_dir(os.path.dirname(output_path))
- f = open(output_path, 'w')
+ f = open(output_path+'.new', 'w')
f.write("""\
//===- llvm-build generated file --------------------------------*- C++ -*-===//
//
@@ -420,6 +421,14 @@ subdirectories = %s
f.write('};\n')
f.close()
+ if not os.path.isfile(output_path):
+ os.rename(output_path+'.new', output_path)
+ elif filecmp.cmp(output_path, output_path+'.new'):
+ os.remove(output_path+'.new')
+ else:
+ os.remove(output_path)
+ os.rename(output_path+'.new', output_path)
+
def get_required_libraries_for_component(self, ci, traverse_groups = False):
"""
get_required_libraries_for_component(component_info) -> iter
More information about the llvm-commits
mailing list