summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-10-19 16:34:32 +1100
committerAndrew Tridgell <tridge@samba.org>2011-10-19 09:02:23 +0200
commit5c5fc5dde45618b9ec9f41fbb4aa090b161ebf35 (patch)
tree20861cdfac805b2bbc3c58fe7f27e8056ed8b94b
parent416bf1c677e52b52c1447bb0901f9a12930abdf4 (diff)
downloadsamba-5c5fc5dde45618b9ec9f41fbb4aa090b161ebf35.tar.gz
samba-5c5fc5dde45618b9ec9f41fbb4aa090b161ebf35.tar.bz2
samba-5c5fc5dde45618b9ec9f41fbb4aa090b161ebf35.zip
build: added deletion of stale .so and .o files
when we change our build rules to move a C file, we need to remove the old ('stale') .so and .o files from the build directory, or they may be used as part of the new build, which means that old code will be linked in. This expands the list of stale files that we remove on rule changes to include .so and .o files Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com> Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Wed Oct 19 09:02:23 CEST 2011 on sn-devel-104
-rw-r--r--buildtools/wafsamba/stale_files.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/buildtools/wafsamba/stale_files.py b/buildtools/wafsamba/stale_files.py
index 2b94f0823e..1ee1ff9d44 100644
--- a/buildtools/wafsamba/stale_files.py
+++ b/buildtools/wafsamba/stale_files.py
@@ -58,7 +58,20 @@ def replace_refill_task_list(self):
try:
if getattr(x, 'target'):
tlist = samba_utils.TO_LIST(getattr(x, 'target'))
+ ttype = getattr(x, 'samba_type', None)
+ task_list = getattr(x, 'compiled_tasks', [])
+ if task_list:
+ # this gets all of the .o files, including the task
+ # ids, so foo.c maps to foo_3.o for idx=3
+ for tsk in task_list:
+ for output in tsk.outputs:
+ objpath = os.path.normpath(output.abspath(bld.env))
+ expected.append(objpath)
for t in tlist:
+ if ttype in ['LIBRARY','MODULE']:
+ t = samba_utils.apply_pattern(t, bld.env.shlib_PATTERN)
+ if ttype == 'PYTHON':
+ t = samba_utils.apply_pattern(t, bld.env.pyext_PATTERN)
p = os.path.join(x.path.abspath(bld.env), t)
p = os.path.normpath(p)
expected.append(p)
@@ -78,13 +91,14 @@ def replace_refill_task_list(self):
p = link
if f in ['config.h']:
continue
- if f[-2:] not in [ '.c', '.h' ]:
+ (froot, fext) = os.path.splitext(f)
+ if fext not in [ '.c', '.h', '.so', '.o' ]:
continue
if f[-7:] == '.inst.h':
continue
if p.find("/.conf") != -1:
continue
- if not p in expected:
+ if not p in expected and os.path.exists(p):
Logs.warn("Removing stale file: %s" % p)
os.unlink(p)
return iit