From f725e2b64eec48c0fe21a125065152c684d361ee Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 1 Jun 2011 11:43:52 +1000 Subject: build: fixed a problem with installing scripts in the build tree the SAMBA_SCRIPT() function was not always triggering correctly. The base problem was that we were using a target outside the build tree. This implements a simpler solution where we just create the links directly in SAMBA_SCRIPT() rather than creating a waf task Autobuild-User: Andrew Tridgell Autobuild-Date: Wed Jun 1 06:50:04 CEST 2011 on sn-devel-104 --- buildtools/wafsamba/wafsamba.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'buildtools/wafsamba/wafsamba.py') diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 2a1c82a307..43b7f616dc 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -628,17 +628,6 @@ def ENABLE_TIMESTAMP_DEPENDENCIES(conf): Utils.h_file = h_file - -t = Task.simple_task_type('copy_script', 'rm -f "${LINK_TARGET}" && ln -s "${SRC[0].abspath(env)}" ${LINK_TARGET}', - shell=True, color='PINK', ext_in='.bin') -t.quiet = True - -@feature('copy_script') -@before('apply_link') -def copy_script(self): - tsk = self.create_task('copy_script', self.allnodes[0]) - tsk.env.TARGET = self.target - def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None): '''used to copy scripts from the source tree into the build directory for use by selftest''' @@ -653,15 +642,17 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None): target = os.path.join(installdir, iname) tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target)) mkdir_p(tgtdir) - t = bld(features='copy_script', - source = s, - target = target, - always = True, - install_path = None) - t.env.LINK_TARGET = target - + link_src = os.path.normpath(os.path.join(bld.curdir, s)) + link_dst = os.path.join(tgtdir, os.path.basename(iname)) + if os.path.islink(link_dst) and os.readlink(link_dst) == link_src: + continue + if os.path.exists(link_dst): + os.unlink(link_dst) + Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname)) + os.symlink(link_src, link_dst) Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT + def copy_and_fix_python_path(task): pattern='sys.path.insert(0, "bin/python")' if task.env["PYTHONARCHDIR"] in sys.path and task.env["PYTHONDIR"] in sys.path: -- cgit