Difficulties bringing waf15 updates into Samba (was: Re:?[PATCH]?build scripts enhancements)
Michael Adam
obnox at samba.org
Tue Sep 1 10:43:39 UTC 2015
On 2015-09-01 at 13:57 +1200, Andrew Bartlett wrote:
> On Wed, 2015-07-08 at 08:04 +0200, Michael Adam wrote:
> > On 2015-07-06 at 12:42 +0200, Michael Adam wrote:
> > > On 2015-07-04 at 12:17 +0200, Michael Adam wrote:
> > > > On 2015-06-26 at 23:30 +0200, Thomas Nagy wrote:
> > > > >
> > > > > the files in attachment will apply directly to the Samba tree.
> > > > > The last new ones represent another important step towards the
> > > > > Waf 1.8 API usage.
> > > >
> > > > So, this all is part of the effort to move us toward
> > > > using waf 1.8. Thinking about it, are the following true:
> > > >
> > > > 1. waf 1.5 is not being developed any more, hence
> > > > you don't want to apply patches there at all.
> > > >
> > > > 2. Your general idea is to modify our wafadmin copy of waf 1.5
> > > > in our tree (and modify our wafsamba code accordingly) so
> > > > that it resembles waf 1.8 api and then our waf 1.5 (+patches)
> > > > can be exchanged with waf 1.8 without having to make tedious
> > > > adaptions to wafsamba at that time. Hence you want to decouple
> > > > the chang from wafadmin 1.5 to waflib 1.8 from the changes
> > > > to wafsamba.
> > > >
> > > > 3. Hence the changes you propose to waf 1.5 will never go
> > > > upstream
> > > > anyways and this would only be a short time of having more
> > > > additional patches on top our copy of waf and when the switch
> > > > to waf 1.8 has been made we should be on vanilla upstream
> > > > again.
> > > >
> > > > If these are true, then I am almost fine with the patches.
> > > > The commit messages need some improvement, and I will do some
> > > > more build tests over the week end (first local configure/build
> > > > runs looked fine.) and come back to you tomorrow or monday.
> > > > (Ping me if I don't! :-)
> > >
> > > Survives autobuild for me.
> > > So I if my understanding detailed above is correct,
> > > then I approve of these patches. As said above, I
> > > would like better commit messages,
> >
> > After checking with Thomas, I would do slight amendmends
> > for pushing, ... but:
> >
> > > we need a second voice from the team.
> >
> > Anybody?
>
> I got very confused trying to work out exactly what the patches were.
>
> Can you re-attach exactly what you would like me to provide a second
> review on?
Attached find a patchset with commit messages slightly modified
by me and with Thomas' signoff and my review tags.
Note: the patches from 2 months ago still apply cleanly and I did
not not need to resolve conflicts. Last time, they survived
autobuild for me, but we may need to re-check.
Thanks - Michael
-------------- next part --------------
From 5b56c5eb7bd6b2b3948274dd63e37edc557f8ff4 Mon Sep 17 00:00:00 2001
From: Thomas Nagy <tnagy at waf.io>
Date: Fri, 26 Jun 2015 20:13:09 +0200
Subject: [PATCH 1/4] third_party:waf: Backport parts of the waf 1.8 API
This modifies our waf 1.5 wafadmin copy to resemble the waf 1.8
waflib API. It is a preparation to change to waf 1.8, decoupling
this change from changes in wafsamba.
Signed-off-by: Thomas Nagy <tnagy at waf.io>
Reviewed-by: Michael Adam <obnox at samba.org>
---
third_party/waf/wafadmin/Build.py | 4 ++++
third_party/waf/wafadmin/Node.py | 7 ++++++
third_party/waf/wafadmin/TaskGen.py | 3 +++
third_party/waf/wafadmin/Tools/cc.py | 6 ++---
third_party/waf/wafadmin/Tools/ccroot.py | 10 ++++----
third_party/waf/wafadmin/Tools/msvc.py | 2 +-
third_party/waf/wafadmin/Tools/osx.py | 6 ++---
third_party/waf/wafadmin/Utils.py | 41 +++++++++++++++++++++++++-------
8 files changed, 58 insertions(+), 21 deletions(-)
diff --git a/third_party/waf/wafadmin/Build.py b/third_party/waf/wafadmin/Build.py
index 50f4d7f..d36d3df 100644
--- a/third_party/waf/wafadmin/Build.py
+++ b/third_party/waf/wafadmin/Build.py
@@ -645,6 +645,10 @@ class BuildContext(Utils.Context):
cache[v] = x
return cache.get(env.variant() + '_' + name, None)
+ def get_tgen_by_name(self, name):
+ """waf 1.8 api"""
+ return self.name_to_obj(name, self.env)
+
def flush(self, all=1):
"""tell the task generators to create the tasks"""
diff --git a/third_party/waf/wafadmin/Node.py b/third_party/waf/wafadmin/Node.py
index 158a4a4..6b03726 100644
--- a/third_party/waf/wafadmin/Node.py
+++ b/third_party/waf/wafadmin/Node.py
@@ -689,6 +689,13 @@ class Node(object):
child = self.ensure_dir_node_from_path(k)
child.update_build_dir(env)
+ def read(self, flags='r', encoding='ISO8859-1'):
+ """backported from waf 1.8"""
+ return Utils.readf(self.abspath(), flags, encoding)
+
+ def write(self, data, flags='w', encoding='ISO8859-1'):
+ """backported from waf 1.8"""
+ Utils.writef(self.abspath(self.bld.env), data, flags, encoding)
class Nodu(Node):
pass
diff --git a/third_party/waf/wafadmin/TaskGen.py b/third_party/waf/wafadmin/TaskGen.py
index 5900809..386798f 100644
--- a/third_party/waf/wafadmin/TaskGen.py
+++ b/third_party/waf/wafadmin/TaskGen.py
@@ -242,6 +242,9 @@ class task_gen(object):
def name_to_obj(self, name):
return self.bld.name_to_obj(name, self.env)
+ def get_tgen_by_name(self, name):
+ return self.bld.get_tgen_by_name(name)
+
def find_sources_in_dirs(self, dirnames, excludes=[], exts=[]):
"""
The attributes "excludes" and "exts" must be lists to avoid the confusion
diff --git a/third_party/waf/wafadmin/Tools/cc.py b/third_party/waf/wafadmin/Tools/cc.py
index e54df47..7eb5272 100644
--- a/third_party/waf/wafadmin/Tools/cc.py
+++ b/third_party/waf/wafadmin/Tools/cc.py
@@ -23,7 +23,7 @@ g_cc_type_vars = ['CCFLAGS', 'LINKFLAGS']
class cc_taskgen(ccroot.ccroot_abstract):
pass
- at feature('cc')
+ at feature('c', 'cc')
@before('apply_type_vars')
@after('default_cc')
def init_cc(self):
@@ -33,7 +33,7 @@ def init_cc(self):
if not self.env['CC_NAME']:
raise Utils.WafError("At least one compiler (gcc, ..) must be selected")
- at feature('cc')
+ at feature('c', 'cc')
@after('apply_incpaths')
def apply_obj_vars_cc(self):
"""after apply_incpaths for INC_PATHS"""
@@ -51,7 +51,7 @@ def apply_obj_vars_cc(self):
for i in env['CPPPATH']:
app('_CCINCFLAGS', cpppath_st % i)
- at feature('cc')
+ at feature('c', 'cc')
@after('apply_lib_vars')
def apply_defines_cc(self):
"""after uselib is set for CCDEFINES"""
diff --git a/third_party/waf/wafadmin/Tools/ccroot.py b/third_party/waf/wafadmin/Tools/ccroot.py
index c130b40..2240b2f 100644
--- a/third_party/waf/wafadmin/Tools/ccroot.py
+++ b/third_party/waf/wafadmin/Tools/ccroot.py
@@ -190,7 +190,7 @@ def get_target_name(self):
return os.path.join(dir, pattern % name)
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@before('apply_core')
def default_cc(self):
"""compiled_tasks attribute must be set before the '.c->.o' tasks can be created"""
@@ -253,7 +253,7 @@ def default_link_install(self):
if self.install_path:
self.bld.install_files(self.install_path, self.link_task.outputs[0], env=self.env, chmod=self.chmod)
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@after('apply_type_vars', 'apply_lib_vars', 'apply_core')
def apply_incpaths(self):
"""used by the scanner
@@ -297,7 +297,7 @@ def apply_incpaths(self):
if USE_TOP_LEVEL:
self.env.append_value('INC_PATHS', self.bld.srcnode)
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@after('init_cc', 'init_cxx')
@before('apply_lib_vars')
def apply_type_vars(self):
@@ -339,7 +339,7 @@ def apply_link(self):
self.link_task = tsk
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@after('apply_link', 'init_cc', 'init_cxx', 'apply_core')
def apply_lib_vars(self):
"""after apply_link because of 'link_task'
@@ -523,7 +523,7 @@ c_attrs = {
'frameworkpath' : 'FRAMEWORKPATH'
}
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@before('init_cxx', 'init_cc')
@before('apply_lib_vars', 'apply_obj_vars', 'apply_incpaths', 'init_cc')
def add_extra_flags(self):
diff --git a/third_party/waf/wafadmin/Tools/msvc.py b/third_party/waf/wafadmin/Tools/msvc.py
index 2a97d19..72e7376 100644
--- a/third_party/waf/wafadmin/Tools/msvc.py
+++ b/third_party/waf/wafadmin/Tools/msvc.py
@@ -638,7 +638,7 @@ def msvc_common_flags(conf):
##### conf above, build below
@after('apply_link')
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
def apply_flags_msvc(self):
if self.env.CC_NAME != 'msvc' or not self.link_task:
return
diff --git a/third_party/waf/wafadmin/Tools/osx.py b/third_party/waf/wafadmin/Tools/osx.py
index 88ca0d9..95184ee 100644
--- a/third_party/waf/wafadmin/Tools/osx.py
+++ b/third_party/waf/wafadmin/Tools/osx.py
@@ -38,7 +38,7 @@ app_info = '''
# see WAF issue 285
# and also http://trac.macports.org/ticket/17059
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@before('apply_lib_vars')
def set_macosx_deployment_target(self):
if self.env['MACOSX_DEPLOYMENT_TARGET']:
@@ -47,7 +47,7 @@ def set_macosx_deployment_target(self):
if sys.platform == 'darwin':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[:2])
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
@after('apply_lib_vars')
def apply_framework(self):
for x in self.to_list(self.env['FRAMEWORKPATH']):
@@ -145,7 +145,7 @@ def apply_link_osx(self):
self.env.append_value('LINKFLAGS', path)
@before('apply_link', 'apply_lib_vars')
- at feature('cc', 'cxx')
+ at feature('c', 'cc', 'cxx')
def apply_bundle(self):
"""use env['MACBUNDLE'] to force all shlibs into mac bundles
or use obj.mac_bundle = True for specific targets only"""
diff --git a/third_party/waf/wafadmin/Utils.py b/third_party/waf/wafadmin/Utils.py
index 5a59a4c..03b4229 100644
--- a/third_party/waf/wafadmin/Utils.py
+++ b/third_party/waf/wafadmin/Utils.py
@@ -147,6 +147,38 @@ except ImportError:
# portability fixes may be added elsewhere (although, md5 should be everywhere by now)
md5 = None
+def readf(fname, m='r', encoding='ISO8859-1'):
+ """backported from waf 1.8"""
+ if sys.hexversion > 0x3000000 and not 'b' in m:
+ m += 'b'
+ f = open(fname, m)
+ try:
+ txt = f.read()
+ finally:
+ f.close()
+ if encoding:
+ txt = txt.decode(encoding)
+ else:
+ txt = txt.decode()
+ else:
+ f = open(fname, m)
+ try:
+ txt = f.read()
+ finally:
+ f.close()
+ return txt
+
+def writef(fname, data, m='w', encoding='ISO8859-1'):
+ """backported from waf 1.8"""
+ if sys.hexversion > 0x3000000 and not 'b' in m:
+ data = data.encode(encoding)
+ m += 'b'
+ f = open(fname, m)
+ try:
+ f.write(data)
+ finally:
+ f.close()
+
class ordered_dict(UserDict):
def __init__(self, dict = None):
self.allkeys = []
@@ -557,15 +589,6 @@ def load_tool(tool, tooldir=None):
for dt in tooldir:
sys.path.remove(dt)
-def readf(fname, m='r'):
- "get the contents of a file, it is not used anywhere for the moment"
- f = open(fname, m)
- try:
- txt = f.read()
- finally:
- f.close()
- return txt
-
def nada(*k, **kw):
"""A function that does nothing"""
pass
--
2.4.3
From 9cb80ff4f63e4a4ce86da9753450b40cbaf88180 Mon Sep 17 00:00:00 2001
From: Thomas Nagy <tnagy at waf.io>
Date: Fri, 26 Jun 2015 20:17:06 +0200
Subject: [PATCH 2/4] third_party:waf: fix a mis-merge - Utils.check_dir issue
Signed-off-by: Thomas Nagy <tnagy at waf.io>
Reviewed-by: Michael Adam <obnox at samba.org>
---
third_party/waf/wafadmin/Utils.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/third_party/waf/wafadmin/Utils.py b/third_party/waf/wafadmin/Utils.py
index 03b4229..abb46a7 100644
--- a/third_party/waf/wafadmin/Utils.py
+++ b/third_party/waf/wafadmin/Utils.py
@@ -455,8 +455,7 @@ def check_dir(path):
os.makedirs(path)
except OSError, e:
if not os.path.isdir(path):
- raise Errors.WafError('Cannot create the folder %r' % path, ex=e)
-
+ raise WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
def cmd_output(cmd, **kw):
--
2.4.3
From cf3212f91e739b8f9c28892ef9aaf8bbfd1354ef Mon Sep 17 00:00:00 2001
From: Thomas Nagy <tnagy at waf.io>
Date: Fri, 26 Jun 2015 20:48:43 +0200
Subject: [PATCH 3/4] build:wafsamba: Close file handles in the build scripts
too
Signed-off-by: Thomas Nagy <tnagy at waf.io>
Reviewed-by: Michael Adam <obnox at samba.org>
---
buildtools/wafsamba/configure_file.py | 10 ++--------
buildtools/wafsamba/pkgconfig.py | 10 ++--------
buildtools/wafsamba/samba_abi.py | 4 +---
buildtools/wafsamba/samba_conftests.py | 25 ++++++-------------------
buildtools/wafsamba/samba_patterns.py | 5 +----
buildtools/wafsamba/samba_version.py | 5 +----
buildtools/wafsamba/wafsamba.py | 4 +---
docs-xml/wscript_build | 4 +---
8 files changed, 15 insertions(+), 52 deletions(-)
diff --git a/buildtools/wafsamba/configure_file.py b/buildtools/wafsamba/configure_file.py
index 8e2ba3b..21264cf 100644
--- a/buildtools/wafsamba/configure_file.py
+++ b/buildtools/wafsamba/configure_file.py
@@ -7,12 +7,8 @@ def subst_at_vars(task):
'''substiture @VAR@ style variables in a file'''
env = task.env
- src = task.inputs[0].srcpath(env)
- tgt = task.outputs[0].bldpath(env)
+ s = task.inputs[0].read()
- f = open(src, 'r')
- s = f.read()
- f.close()
# split on the vars
a = re.split('(@\w+@)', s)
out = []
@@ -27,9 +23,7 @@ def subst_at_vars(task):
v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
out.append(v)
contents = ''.join(out)
- f = open(tgt, 'w')
- s = f.write(contents)
- f.close()
+ task.outputs[0].write(contents)
return 0
def CONFIGURE_FILE(bld, in_file, **kwargs):
diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
index 8a3f807..c837804 100644
--- a/buildtools/wafsamba/pkgconfig.py
+++ b/buildtools/wafsamba/pkgconfig.py
@@ -5,12 +5,8 @@ from samba_utils import *
def subst_at_vars(task):
'''substiture @VAR@ style variables in a file'''
- src = task.inputs[0].srcpath(task.env)
- tgt = task.outputs[0].bldpath(task.env)
- f = open(src, 'r')
- s = f.read()
- f.close()
+ s = task.inputs[0].read()
# split on the vars
a = re.split('(@\w+@)', s)
out = []
@@ -37,9 +33,7 @@ def subst_at_vars(task):
break
out.append(v)
contents = ''.join(out)
- f = open(tgt, 'w')
- s = f.write(contents)
- f.close()
+ task.outputs[0].write(contents)
return 0
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 76acd00..3ff6d77 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -147,12 +147,10 @@ def abi_check(self):
def abi_process_file(fname, version, symmap):
'''process one ABI file, adding new symbols to the symmap'''
- f = open(fname, mode='r')
- for line in f:
+ for line in Utils.readf(fname).splitlines():
symname = line.split(":")[0]
if not symname in symmap:
symmap[symname] = version
- f.close()
def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 96fead5..fe8c30b 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -216,9 +216,7 @@ def CHECK_NEED_LC(conf, msg):
os.makedirs(subdir)
- dest = open(os.path.join(subdir, 'liblc1.c'), 'w')
- dest.write('#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n')
- dest.close()
+ Utils.writef(os.path.join(subdir, 'liblc1.c'), '#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n')
bld = Build.BuildContext()
bld.log = conf.log
@@ -291,13 +289,8 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
os.makedirs(subdir)
- dest = open(os.path.join(subdir, 'lib1.c'), 'w')
- dest.write('int lib_func(void) { return 42; }\n')
- dest.close()
-
- dest = open(os.path.join(dir, 'main.c'), 'w')
- dest.write('int main(void) {return !(lib_func() == 42);}\n')
- dest.close()
+ Utils.writef(os.path.join(subdir, 'lib1.c'), 'int lib_func(void) { return 42; }\n')
+ Utils.writef(os.path.join(dir, 'main.c'), 'int main(void) {return !(lib_func() == 42);}\n')
bld = Build.BuildContext()
bld.log = conf.log
@@ -311,9 +304,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
ldflags = []
if version_script:
ldflags.append("-Wl,--version-script=%s/vscript" % bld.path.abspath())
- dest = open(os.path.join(dir,'vscript'), 'w')
- dest.write('TEST_1.0A2 { global: *; };\n')
- dest.close()
+ Utils.writef(os.path.join(dir,'vscript'), 'TEST_1.0A2 { global: *; };\n')
bld(features='cc cshlib',
source='libdir/lib1.c',
@@ -383,15 +374,13 @@ def CHECK_PERL_MANPAGE(conf, msg=None, section=None):
if not os.path.exists(bdir):
os.makedirs(bdir)
- dest = open(os.path.join(bdir, 'Makefile.PL'), 'w')
- dest.write("""
+ Utils.writef(os.path.join(bdir, 'Makefile.PL'), """
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'WafTest',
'EXE_FILES' => [ 'WafTest' ]
);
""")
- dest.close()
back = os.path.abspath('.')
os.chdir(bdir)
proc = Utils.pproc.Popen(['perl', 'Makefile.PL'],
@@ -406,9 +395,7 @@ WriteMakefile(
return
if section:
- f = open(os.path.join(bdir,'Makefile'), 'r')
- man = f.read()
- f.close()
+ man = Utils.readf(os.path.join(bdir,'Makefile'))
m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
if not m:
conf.check_message_2('not found', color='YELLOW')
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index 0469992..5183e86 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -8,14 +8,11 @@ from wafsamba import samba_version_file
def write_version_header(task):
'''print version.h contents'''
src = task.inputs[0].srcpath(task.env)
- tgt = task.outputs[0].bldpath(task.env)
version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.env.is_install)
string = str(version)
- f = open(tgt, 'w')
- s = f.write(string)
- f.close()
+ task.outputs[0].write(string)
return 0
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index bb0be96..950a855 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -42,12 +42,10 @@ def git_version_summary(path, env=None):
def distversion_version_summary(path):
#get version from .distversion file
- f = open(path + '/.distversion', 'r')
suffix = None
fields = {}
- for line in f:
- line = line.strip()
+ for line in Utils.readf(path + '/.distversion').splitlines():
if line == '':
continue
if line.startswith("#"):
@@ -64,7 +62,6 @@ def distversion_version_summary(path):
except:
print("Failed to parse line %s from .distversion file." % (line))
raise
- f.close()
if "COMMIT_TIME" in fields:
fields["COMMIT_TIME"] = int(fields["COMMIT_TIME"])
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index c27241e..078e411 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -95,9 +95,7 @@ Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
def generate_empty_file(task):
- target_fname = installed_location=task.outputs[0].bldpath(task.env)
- target_file = open(installed_location, 'w')
- target_file.close()
+ task.outputs[0].write('')
return 0
#################################################################
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index 5157460..568eba1 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -111,9 +111,7 @@ def smbdotconf_generate_parameter_list(task):
t += "]>\n"
t += "<section>\n"
for article in articles:
- f = open(article.abspath(task.env), 'r')
- t += f.read()
- f.close()
+ t += article.read()
t += "</section>\n"
save_file(parameter_all, t , create_dir=True)
--
2.4.3
From 1779bba9e425a0d7a58fcdfcd847ea232dfbf67a Mon Sep 17 00:00:00 2001
From: Thomas Nagy <tnagy at waf.io>
Date: Fri, 26 Jun 2015 22:32:43 +0200
Subject: [PATCH 4/4] build:wafsamba: Use the Waf 1.8 API get_tgen_by_name
instead of name_to_obj
Signed-off-by: Thomas Nagy <tnagy at waf.io>
Reviewed-by: Michael Adam <obnox at samba.org>
---
buildtools/wafsamba/samba_deps.py | 54 +++++++++++++++----------------
buildtools/wafsamba/samba_optimisation.py | 4 +--
buildtools/wafsamba/samba_pidl.py | 2 +-
buildtools/wafsamba/samba_utils.py | 6 ++--
buildtools/wafsamba/symbols.py | 14 ++++----
5 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index beb366b..606de41 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -47,7 +47,7 @@ def expand_subsystem_deps(bld):
# module_name = rpc_epmapper (a module within the dcerpc_server subsystem)
# module = rpc_epmapper (a module object within the dcerpc_server subsystem)
- subsystem = bld.name_to_obj(subsystem_name, bld.env)
+ subsystem = bld.get_tgen_by_name(subsystem_name)
bld.ASSERT(subsystem is not None, "Unable to find subsystem %s" % subsystem_name)
for d in subsystem_list[subsystem_name]:
module_name = d['TARGET']
@@ -101,7 +101,7 @@ def build_dependencies(self):
self.uselib = list(self.final_syslibs)
self.uselib.extend(list(self.direct_syslibs))
for lib in self.final_libs:
- t = self.bld.name_to_obj(lib, self.bld.env)
+ t = self.bld.get_tgen_by_name(lib)
self.uselib.extend(list(t.final_syslibs))
self.uselib = unique_list(self.uselib)
@@ -150,7 +150,7 @@ def build_includes(self):
inc_abs = []
for d in inc_deps:
- t = bld.name_to_obj(d, bld.env)
+ t = bld.get_tgen_by_name(d)
bld.ASSERT(t is not None, "Unable to find dependency %s for %s" % (d, self.sname))
inclist = getattr(t, 'samba_includes_extended', [])[:]
if getattr(t, 'local_include', True):
@@ -285,7 +285,7 @@ def check_duplicate_sources(bld, tgt_list):
if not targets[t.sname] in [ 'LIBRARY', 'BINARY', 'PYTHON' ]:
continue
for obj in t.add_objects:
- t2 = t.bld.name_to_obj(obj, bld.env)
+ t2 = t.bld.get_tgen_by_name(obj)
source_set = getattr(t2, 'samba_source_set', set())
for s in source_set:
if not s in subsystems:
@@ -349,7 +349,7 @@ def check_group_ordering(bld, tgt_list):
for t in tgt_list:
tdeps = getattr(t, 'add_objects', []) + getattr(t, 'uselib_local', [])
for d in tdeps:
- t2 = bld.name_to_obj(d, bld.env)
+ t2 = bld.get_tgen_by_name(d)
if t2 is None:
continue
map1 = grp_map[t.samba_group]
@@ -432,7 +432,7 @@ def build_direct_deps(bld, tgt_list):
global_deps = bld.env.GLOBAL_DEPENDENCIES
global_deps_exclude = set()
for dep in global_deps:
- t = bld.name_to_obj(dep, bld.env)
+ t = bld.get_tgen_by_name(dep)
for d in t.samba_deps:
# prevent loops from the global dependencies list
global_deps_exclude.add(d)
@@ -472,7 +472,7 @@ def build_direct_deps(bld, tgt_list):
implied, t.sname, targets[implied]))
sys.exit(1)
continue
- t2 = bld.name_to_obj(d, bld.env)
+ t2 = bld.get_tgen_by_name(d)
if t2 is None:
Logs.error("no task %s of type %s in %s" % (d, targets[d], t.sname))
sys.exit(1)
@@ -510,7 +510,7 @@ def indirect_libs(bld, t, chain, loops):
dependency_loop(loops, t, obj)
continue
chain.add(obj)
- t2 = bld.name_to_obj(obj, bld.env)
+ t2 = bld.get_tgen_by_name(obj)
r2 = indirect_libs(bld, t2, chain, loops)
chain.remove(obj)
ret = ret.union(t2.direct_libs)
@@ -521,7 +521,7 @@ def indirect_libs(bld, t, chain, loops):
dependency_loop(loops, t, obj)
continue
chain.add(obj)
- t2 = bld.name_to_obj(obj, bld.env)
+ t2 = bld.get_tgen_by_name(obj)
r2 = indirect_libs(bld, t2, chain, loops)
chain.remove(obj)
ret = ret.union(t2.direct_libs)
@@ -548,7 +548,7 @@ def indirect_objects(bld, t, chain, loops):
dependency_loop(loops, t, lib)
continue
chain.add(lib)
- t2 = bld.name_to_obj(lib, bld.env)
+ t2 = bld.get_tgen_by_name(lib)
r2 = indirect_objects(bld, t2, chain, loops)
chain.remove(lib)
ret = ret.union(t2.direct_objects)
@@ -576,7 +576,7 @@ def extended_objects(bld, t, chain):
for lib in t.final_libs:
if lib in chain:
continue
- t2 = bld.name_to_obj(lib, bld.env)
+ t2 = bld.get_tgen_by_name(lib)
chain.add(lib)
r2 = extended_objects(bld, t2, chain)
chain.remove(lib)
@@ -604,7 +604,7 @@ def includes_objects(bld, t, chain, inc_loops):
dependency_loop(inc_loops, t, obj)
continue
chain.add(obj)
- t2 = bld.name_to_obj(obj, bld.env)
+ t2 = bld.get_tgen_by_name(obj)
r2 = includes_objects(bld, t2, chain, inc_loops)
chain.remove(obj)
ret = ret.union(t2.direct_objects)
@@ -615,7 +615,7 @@ def includes_objects(bld, t, chain, inc_loops):
dependency_loop(inc_loops, t, lib)
continue
chain.add(lib)
- t2 = bld.name_to_obj(lib, bld.env)
+ t2 = bld.get_tgen_by_name(lib)
if t2 is None:
targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
Logs.error('Target %s of type %s not found in direct_libs for %s' % (
@@ -668,7 +668,7 @@ def break_dependency_loops(bld, tgt_list):
# expand indirect subsystem and library loops
for loop in loops.copy():
- t = bld.name_to_obj(loop, bld.env)
+ t = bld.get_tgen_by_name(loop)
if t.samba_type in ['SUBSYSTEM']:
loops[loop] = loops[loop].union(t.indirect_objects)
loops[loop] = loops[loop].union(t.direct_objects)
@@ -680,7 +680,7 @@ def break_dependency_loops(bld, tgt_list):
# expand indirect includes loops
for loop in inc_loops.copy():
- t = bld.name_to_obj(loop, bld.env)
+ t = bld.get_tgen_by_name(loop)
inc_loops[loop] = inc_loops[loop].union(t.includes_objects)
if loop in inc_loops[loop]:
inc_loops[loop].remove(loop)
@@ -726,7 +726,7 @@ def reduce_objects(bld, tgt_list):
# if we will indirectly link to a target then we don't need it
new = t.final_objects.copy()
for l in t.final_libs:
- t2 = bld.name_to_obj(l, bld.env)
+ t2 = bld.get_tgen_by_name(l)
t2_obj = extended_objects(bld, t2, set())
dup = new.intersection(t2_obj)
if t.sname in rely_on:
@@ -746,7 +746,7 @@ def reduce_objects(bld, tgt_list):
# add back in any objects that were relied upon by the reduction rules
for r in rely_on:
- t = bld.name_to_obj(r, bld.env)
+ t = bld.get_tgen_by_name(r)
t.final_objects = t.final_objects.union(rely_on[r])
return True
@@ -755,7 +755,7 @@ def reduce_objects(bld, tgt_list):
def show_library_loop(bld, lib1, lib2, path, seen):
'''show the detailed path of a library loop between lib1 and lib2'''
- t = bld.name_to_obj(lib1, bld.env)
+ t = bld.get_tgen_by_name(lib1)
if not lib2 in getattr(t, 'final_libs', set()):
return
@@ -794,7 +794,7 @@ def calculate_final_deps(bld, tgt_list, loops):
# replace lib deps with objlist deps
for l in t.final_libs:
objname = l + '.objlist'
- t2 = bld.name_to_obj(objname, bld.env)
+ t2 = bld.get_tgen_by_name(objname)
if t2 is None:
Logs.error('ERROR: subsystem %s not found' % objname)
sys.exit(1)
@@ -810,7 +810,7 @@ def calculate_final_deps(bld, tgt_list, loops):
objname = module_name
else:
continue
- t2 = bld.name_to_obj(objname, bld.env)
+ t2 = bld.get_tgen_by_name(objname)
if t2 is None:
Logs.error('ERROR: subsystem %s not found' % objname)
sys.exit(1)
@@ -822,7 +822,7 @@ def calculate_final_deps(bld, tgt_list, loops):
for t in tgt_list:
if t.samba_type in ['LIBRARY', 'PYTHON']:
for l in t.final_libs.copy():
- t2 = bld.name_to_obj(l, bld.env)
+ t2 = bld.get_tgen_by_name(l)
if t.sname in t2.final_libs:
if getattr(bld.env, "ALLOW_CIRCULAR_LIB_DEPENDENCIES", False):
# we could break this in either direction. If one of the libraries
@@ -856,7 +856,7 @@ def calculate_final_deps(bld, tgt_list, loops):
diff.remove(t.sname)
# make sure we don't recreate the loop again!
for d in diff.copy():
- t2 = bld.name_to_obj(d, bld.env)
+ t2 = bld.get_tgen_by_name(d)
if t2.samba_type == 'LIBRARY':
if t.sname in t2.final_libs:
debug('deps: removing expansion %s from %s', d, t.sname)
@@ -881,12 +881,12 @@ def calculate_final_deps(bld, tgt_list, loops):
continue
syslibs = set()
for d in t.final_objects:
- t2 = bld.name_to_obj(d, bld.env)
+ t2 = bld.get_tgen_by_name(d)
syslibs = syslibs.union(t2.direct_syslibs)
# this adds the indirect syslibs as well, which may not be needed
# depending on the linker flags
for d in t.final_libs:
- t2 = bld.name_to_obj(d, bld.env)
+ t2 = bld.get_tgen_by_name(d)
syslibs = syslibs.union(t2.direct_syslibs)
t.final_syslibs = syslibs
@@ -896,7 +896,7 @@ def calculate_final_deps(bld, tgt_list, loops):
for t in tgt_list:
if t.samba_type in ['LIBRARY', 'PYTHON']:
for l in t.final_libs.copy():
- t2 = bld.name_to_obj(l, bld.env)
+ t2 = bld.get_tgen_by_name(l)
if t.sname in t2.final_libs:
Logs.error('ERROR: Unresolved library loop %s from %s' % (t.sname, t2.sname))
lib_loop_error = True
@@ -912,7 +912,7 @@ def show_dependencies(bld, target, seen):
if target in seen:
return
- t = bld.name_to_obj(target, bld.env)
+ t = bld.get_tgen_by_name(target)
if t is None:
Logs.error("ERROR: Unable to find target '%s'" % target)
sys.exit(1)
@@ -941,7 +941,7 @@ def show_object_duplicates(bld, tgt_list):
if not targets[t.sname] in [ 'LIBRARY', 'PYTHON' ]:
continue
for n in getattr(t, 'final_objects', set()):
- t2 = bld.name_to_obj(n, bld.env)
+ t2 = bld.get_tgen_by_name(n)
if not n in used_by:
used_by[n] = set()
used_by[n].add(t.sname)
diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py
index 51d514e..43b12a2 100644
--- a/buildtools/wafsamba/samba_optimisation.py
+++ b/buildtools/wafsamba/samba_optimisation.py
@@ -165,7 +165,7 @@ def is_this_a_static_lib(self, name):
try:
return cache[name]
except KeyError:
- ret = cache[name] = 'cstaticlib' in self.bld.name_to_obj(name, self.env).features
+ ret = cache[name] = 'cstaticlib' in self.bld.get_tgen_by_name(name).features
return ret
TaskGen.task_gen.is_this_a_static_lib = is_this_a_static_lib
@@ -215,7 +215,7 @@ def apply_lib_vars(self):
if lib_name in seen:
continue
- y = self.name_to_obj(lib_name)
+ y = self.get_tgen_by_name(lib_name)
if not y:
raise Utils.WafError('object %r was not found in uselib_local (required by %r)' % (lib_name, self.name))
y.post()
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index 110b15e..abf6e9c 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -118,7 +118,7 @@ from TaskGen import feature, before
def collect(self):
pidl_headers = LOCAL_CACHE(self.bld, 'PIDL_HEADERS')
for (name, hd) in pidl_headers.items():
- y = self.bld.name_to_obj(name, self.env)
+ y = self.bld.get_tgen_by_name(name)
self.bld.ASSERT(y is not None, 'Failed to find PIDL header %s' % name)
y.post()
for node in hd:
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 540fe44..9bbe6ac 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -66,7 +66,7 @@ def ADD_LD_LIBRARY_PATH(path):
def needs_private_lib(bld, target):
'''return True if a target links to a private library'''
for lib in getattr(target, "final_libs", []):
- t = bld.name_to_obj(lib, bld.env)
+ t = bld.get_tgen_by_name(lib)
if t and getattr(t, 'private_library', False):
return True
return False
@@ -173,7 +173,7 @@ def process_depends_on(self):
if getattr(self , 'depends_on', None):
lst = self.to_list(self.depends_on)
for x in lst:
- y = self.bld.name_to_obj(x, self.env)
+ y = self.bld.get_tgen_by_name(x)
self.bld.ASSERT(y is not None, "Failed to find dependency %s of %s" % (x, self.name))
y.post()
if getattr(y, 'more_includes', None):
@@ -644,7 +644,7 @@ def get_tgt_list(bld):
type = targets[tgt]
if not type in ['SUBSYSTEM', 'MODULE', 'BINARY', 'LIBRARY', 'ASN1', 'PYTHON']:
continue
- t = bld.name_to_obj(tgt, bld.env)
+ t = bld.get_tgen_by_name(tgt)
if t is None:
Logs.error("Target %s of type %s has no task generator" % (tgt, type))
sys.exit(1)
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index daa18b9..d37cce2 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -251,7 +251,7 @@ def build_symbol_sets(bld, tgt_list):
bld.env.public_symbols[name] = t.public_symbols
if t.samba_type == 'LIBRARY':
for dep in t.add_objects:
- t2 = bld.name_to_obj(dep, bld.env)
+ t2 = bld.get_tgen_by_name(dep)
bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep))
bld.env.public_symbols[name] = bld.env.public_symbols[name].union(t2.public_symbols)
@@ -264,7 +264,7 @@ def build_symbol_sets(bld, tgt_list):
bld.env.used_symbols[name] = t.used_symbols
if t.samba_type == 'LIBRARY':
for dep in t.add_objects:
- t2 = bld.name_to_obj(dep, bld.env)
+ t2 = bld.get_tgen_by_name(dep)
bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep))
bld.env.used_symbols[name] = bld.env.used_symbols[name].union(t2.used_symbols)
@@ -362,7 +362,7 @@ def build_autodeps(bld, t):
if targets[depname[0]] in [ 'SYSLIB' ]:
deps.add(depname[0])
continue
- t2 = bld.name_to_obj(depname[0], bld.env)
+ t2 = bld.get_tgen_by_name(depname[0])
if len(t2.in_library) != 1:
deps.add(depname[0])
continue
@@ -385,7 +385,7 @@ def build_library_names(bld, tgt_list):
for t in tgt_list:
if t.samba_type in [ 'LIBRARY' ]:
for obj in t.samba_deps_extended:
- t2 = bld.name_to_obj(obj, bld.env)
+ t2 = bld.get_tgen_by_name(obj)
if t2 and t2.samba_type in [ 'SUBSYSTEM', 'ASN1' ]:
if not t.sname in t2.in_library:
t2.in_library.append(t.sname)
@@ -402,7 +402,7 @@ def check_library_deps(bld, t):
Logs.warn("WARNING: Target '%s' in multiple libraries: %s" % (t.sname, t.in_library))
for dep in t.autodeps:
- t2 = bld.name_to_obj(dep, bld.env)
+ t2 = bld.get_tgen_by_name(dep)
if t2 is None:
continue
for dep2 in t2.autodeps:
@@ -435,7 +435,7 @@ def check_syslib_collisions(bld, tgt_list):
def check_dependencies(bld, t):
'''check for depenencies that should be changed'''
- if bld.name_to_obj(t.sname + ".objlist", bld.env):
+ if bld.get_tgen_by_name(t.sname + ".objlist"):
return
targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
@@ -475,7 +475,7 @@ def check_dependencies(bld, t):
def check_syslib_dependencies(bld, t):
'''check for syslib depenencies'''
- if bld.name_to_obj(t.sname + ".objlist", bld.env):
+ if bld.get_tgen_by_name(t.sname + ".objlist"):
return
sname = real_name(t.sname)
--
2.4.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150901/57182f50/attachment-0001.sig>
More information about the samba-technical
mailing list