if bin is not empty and I have been sharing the samba tree into
a Vagrant environment and we run make, we get annoying linking error like this:
File "~/samba/lib/tevent/wscript", line 130, in build
installdir='python')
File "./buildtools/wafsamba/wafsamba.py", line 745, in SAMBA_SCRIPT
os.symlink(link_src, link_dst)
FileExistsError: [Errno 17] File exists: '~/samba/lib/tevent/tevent.py' -> '~/samba/bin/default/../python/tevent.py'
Makefile:7: recipe for target 'all' failed
Override the symlink method to allow force linking.
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
import os, sys, re, fnmatch, shlex, inspect
from optparse import SUPPRESS_HELP
from waflib import Build, Options, Utils, Task, Logs, Configure, Errors, Context
import os, sys, re, fnmatch, shlex, inspect
from optparse import SUPPRESS_HELP
from waflib import Build, Options, Utils, Task, Logs, Configure, Errors, Context
+def symlink(src, dst, force=True):
+ """Can create symlink by force"""
+ try:
+ os.symlink(src, dst)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST and force:
+ os.remove(dst)
+ os.symlink(src, dst)
+ else:
+ raise
+
+
def mkdir_p(dir):
'''like mkdir -p'''
if not dir:
def mkdir_p(dir):
'''like mkdir -p'''
if not dir:
# bring in the other samba modules
from samba_utils import *
# bring in the other samba modules
from samba_utils import *
+from samba_utils import symlink
from samba_version import *
from samba_autoconf import *
from samba_patterns import *
from samba_version import *
from samba_autoconf import *
from samba_patterns import *
for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python')]:
link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target)
if not os.path.lexists(link_target):
for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python')]:
link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target)
if not os.path.lexists(link_target):
- os.symlink('../' + source, link_target)
+ symlink('../' + source, link_target)
# get perl to put the blib files in the build directory
blib_bld = os.path.join(conf.env.BUILD_DIRECTORY, 'default/pidl/blib')
# get perl to put the blib files in the build directory
blib_bld = os.path.join(conf.env.BUILD_DIRECTORY, 'default/pidl/blib')
if os.path.exists(link_dst):
os.unlink(link_dst)
Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
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)
+ symlink(link_src, link_dst)
Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT