summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-09 21:12:02 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-09 21:12:09 +1000
commit45d3ac05b3781a8c14e7f4426a515746e9a99172 (patch)
tree5dce7065b5b86fd9dcb6133bde9308358a78f151 /buildtools
parentd661759780d70c771c3748095db5a5308451266d (diff)
downloadsamba-45d3ac05b3781a8c14e7f4426a515746e9a99172.tar.gz
samba-45d3ac05b3781a8c14e7f4426a515746e9a99172.tar.bz2
samba-45d3ac05b3781a8c14e7f4426a515746e9a99172.zip
build: use Logs.error() and Logs.info() instead of print()
this gives appropriate colors on output, and ensures it works with compiler output
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py6
-rw-r--r--buildtools/wafsamba/samba_bundled.py5
-rw-r--r--buildtools/wafsamba/samba_deps.py23
-rw-r--r--buildtools/wafsamba/samba_dist.py6
-rw-r--r--buildtools/wafsamba/samba_utils.py12
-rw-r--r--buildtools/wafsamba/wafsamba.py4
6 files changed, 29 insertions, 27 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 4731a4e13d..fcd900dec1 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -1,6 +1,6 @@
# a waf tool to add autoconf-like macros to the configure section
-import Build, os, Options, preproc
+import Build, os, Options, preproc, Logs
import string
from Configure import conf
from samba_utils import *
@@ -456,7 +456,7 @@ def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True):
if not conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags):
if mandatory:
- print("Mandatory library '%s' not found for functions '%s'" % (lib, list))
+ Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list))
sys.exit(1)
if empty_decl:
# if it isn't a mandatory library, then remove it from dependency lists
@@ -511,7 +511,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False,
for lib in liblist[:]:
if not GET_TARGET_TYPE(conf, lib) == 'SYSLIB':
if mandatory:
- print("Mandatory library '%s' not found for functions '%s'" % (lib, list))
+ Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list))
sys.exit(1)
# if it isn't a mandatory library, then remove it from dependency lists
liblist.remove(lib)
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index e0a8e54eae..bab4143a9a 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -1,6 +1,7 @@
# functions to support bundled libraries
from Configure import conf
+import Logs
from samba_utils import *
def BUNDLED_NAME(bld, name, bundled_extension):
@@ -78,7 +79,7 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
f = 'FOUND_SYSTEM_%s' % syslib
if not f in conf.env:
if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS:
- print('ERROR: Use of system library %s depends on missing system library %s' % (libname, syslib))
+ Logs.error('ERROR: Use of system library %s depends on missing system library %s' % (libname, syslib))
sys.exit(1)
conf.env[found] = False
return False
@@ -103,6 +104,6 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
return True
conf.env[found] = False
if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS:
- print('ERROR: System library %s of version %s not found, and bundling disabled' % (libname, minversion))
+ Logs.error('ERROR: System library %s of version %s not found, and bundling disabled' % (libname, minversion))
sys.exit(1)
return False
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index 452120d657..232ed34ae6 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -1,6 +1,6 @@
# Samba automatic dependency handling and project rules
-import Build, os, re, Environment
+import Build, os, re, Environment, Logs
from samba_utils import *
from samba_autoconf import *
from samba_bundled import BUILTIN_LIBRARY
@@ -17,7 +17,7 @@ def TARGET_ALIAS(bld, target, alias):
'''define an alias for a target name'''
cache = LOCAL_CACHE(bld, 'TARGET_ALIAS')
if alias in cache:
- print("Target alias %s already set to %s : newalias %s" % (alias, cache[alias], target))
+ Logs.error("Target alias %s already set to %s : newalias %s" % (alias, cache[alias], target))
sys.exit(1)
cache[alias] = target
Build.BuildContext.TARGET_ALIAS = TARGET_ALIAS
@@ -258,7 +258,7 @@ def check_duplicate_sources(bld, tgt_list):
if s['dep'] == s2['dep']: continue
common = s['src'].intersection(s2['src'])
if common.difference(seen):
- print("Target %s has duplicate source files in %s and %s : %s" % (t.sname,
+ Logs.error("Target %s has duplicate source files in %s and %s : %s" % (t.sname,
s['dep'], s2['dep'],
common))
seen = seen.union(common)
@@ -279,7 +279,7 @@ def check_orpaned_targets(bld, tgt_list):
type = target_dict[t.sname]
if not type in ['BINARY', 'LIBRARY', 'MODULE', 'ET', 'PYTHON']:
if re.search('^PIDL_', t.sname) is None:
- print("Target %s of type %s is unused by any other target" % (t.sname, type))
+ Logs.warn("Target %s of type %s is unused by any other target" % (t.sname, type))
def show_final_deps(bld, tgt_list):
@@ -328,7 +328,7 @@ def build_direct_deps(bld, tgt_list):
d = EXPAND_ALIAS(bld, d)
if d == t.sname: continue
if not d in targets:
- print("Unknown dependency %s in %s" % (d, t.sname))
+ Logs.error("Unknown dependency %s in %s" % (d, t.sname))
sys.exit(1)
if targets[d] in [ 'EMPTY', 'DISABLED' ]:
continue
@@ -343,7 +343,8 @@ def build_direct_deps(bld, tgt_list):
continue
t2 = bld.name_to_obj(d, bld.env)
if t2 is None:
- print("no task %s type %s" % (d, targets[d]))
+ Logs.error("no task %s of type %s in %s" % (d, targets[d], t.sname))
+ sys.exit(1)
if t2.samba_type in [ 'LIBRARY', 'MODULE' ]:
t.direct_libs.add(d)
elif t2.samba_type in [ 'SUBSYSTEM', 'ASN1', 'PYTHON' ]:
@@ -665,7 +666,7 @@ def calculate_final_deps(bld, tgt_list, loops):
while reduce_objects(bld, tgt_list):
count += 1
if count > 100:
- print("WARNING: Unable to remove all inter-target object duplicates")
+ Logs.warn("WARNING: Unable to remove all inter-target object duplicates")
break
debug('deps: Object reduction took %u iterations', count)
@@ -822,7 +823,7 @@ def check_project_rules(bld):
continue
t = bld.name_to_obj(tgt, bld.env)
if t is None:
- print("Target %s of type %s has no task generator" % (tgt, type))
+ Logs.error("Target %s of type %s has no task generator" % (tgt, type))
sys.exit(1)
tgt_list.append(t)
@@ -831,7 +832,7 @@ def check_project_rules(bld):
if load_samba_deps(bld, tgt_list):
return
- print("Checking project rules ...")
+ Logs.info("Checking project rules ...")
debug('deps: project rules checking started')
@@ -850,7 +851,7 @@ def check_project_rules(bld):
#check_orpaned_targets(bld, tgt_list)
if not check_duplicate_sources(bld, tgt_list):
- print("Duplicate sources present - aborting")
+ Logs.error("Duplicate sources present - aborting")
sys.exit(1)
show_final_deps(bld, tgt_list)
@@ -860,7 +861,7 @@ def check_project_rules(bld):
save_samba_deps(bld, tgt_list)
- print("Project rules pass")
+ Logs.info("Project rules pass")
def CHECK_PROJECT_RULES(bld):
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index 0fa8dbee03..aea45c5770 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -33,7 +33,7 @@ def dist(appname='',version=''):
srcdir = os.path.normpath(os.path.join(os.path.dirname(Utils.g_module.root_path), Utils.g_module.srcdir))
if not dist_dirs:
- print('You must use samba_dist.DIST_DIRS() to set which directories to package')
+ Logs.error('You must use samba_dist.DIST_DIRS() to set which directories to package')
sys.exit(1)
dist_base = '%s-%s' % (appname, version)
@@ -52,7 +52,7 @@ def dist(appname='',version=''):
try:
files = Utils.cmd_output(git_cmd).split()
except:
- print('git command failed: %s' % ' '.join(git_cmd))
+ Logs.error('git command failed: %s' % ' '.join(git_cmd))
sys.exit(1)
for f in files:
abspath = os.path.join(srcdir, f)
@@ -65,7 +65,7 @@ def dist(appname='',version=''):
tar.close()
- print('Created %s' % dist_name)
+ Logs.info('Created %s' % dist_name)
return dist_name
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 1df70fdbf5..8016da44bc 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -1,7 +1,7 @@
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
-import Build, os, sys, Options, Utils, Task, re, fnmatch
+import Build, os, sys, Options, Utils, Task, re, fnmatch, Logs
from TaskGen import feature, before
from Configure import conf
from Logs import debug
@@ -102,7 +102,7 @@ def LOCAL_CACHE_SET(ctx, cachename, key, value):
def ASSERT(ctx, expression, msg):
'''a build assert call'''
if not expression:
- sys.stderr.write("ERROR: %s\n" % msg)
+ Logs.error("ERROR: %s\n" % msg)
raise AssertionError
Build.BuildContext.ASSERT = ASSERT
@@ -220,7 +220,7 @@ def subst_vars_error(string, env):
if re.match('\$\{\w+\}', v):
vname = v[2:-1]
if not vname in env:
- print("Failed to find variable %s in %s" % (vname, string))
+ Logs.error("Failed to find variable %s in %s" % (vname, string))
sys.exit(1)
v = env[vname]
out.append(v)
@@ -338,7 +338,7 @@ def EXPAND_VARIABLES(ctx, varstr, vars=None):
# make sure there is nothing left. Also check for the common
# typo of $( instead of ${
if ret.find('${') != -1 or ret.find('$(') != -1:
- print('Failed to substitute all variables in varstr=%s' % ret)
+ Logs.error('Failed to substitute all variables in varstr=%s' % ret)
sys.exit(1)
return ret
Build.BuildContext.EXPAND_VARIABLES = EXPAND_VARIABLES
@@ -356,7 +356,7 @@ def RUN_COMMAND(cmd,
return os.WEXITSTATUS(status)
if os.WIFSIGNALED(status):
return - os.WTERMSIG(status)
- print("Unknown exit reason %d for command: %s" (status, cmd))
+ Logs.error("Unknown exit reason %d for command: %s" (status, cmd))
return -1
@@ -434,7 +434,7 @@ def RECURSE(ctx, directory):
return ctx.sub_config(relpath)
if ctxclass == 'BuildContext':
return ctx.add_subdirs(relpath)
- print('Unknown RECURSE context class', ctxclass)
+ Logs.error('Unknown RECURSE context class', ctxclass)
raise
Options.Handler.RECURSE = RECURSE
Build.BuildContext.RECURSE = RECURSE
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 08d3d20137..e2d8052bc9 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -625,8 +625,8 @@ def subst_at_vars(task):
if not vname in task.env and vname.upper() in task.env:
vname = vname.upper()
if not vname in task.env:
- print("Unknown substitution %s in %s" % (v, task.name))
- raise
+ Logs.error("Unknown substitution %s in %s" % (v, task.name))
+ sys.exit(1)
v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
# now we back substitute the allowed pc vars
for (b, m) in back_sub: