mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
wafsamba: fix CHECK_MAKEFLAGS() with waf 2.0.8
Changing Options.options.jobs in the build() hook is too late in waf 2. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
1dc06aaa2d
commit
5bb48cb650
@ -440,14 +440,14 @@ Options.OptionsContext.RECURSE = RECURSE
|
|||||||
Build.BuildContext.RECURSE = RECURSE
|
Build.BuildContext.RECURSE = RECURSE
|
||||||
|
|
||||||
|
|
||||||
def CHECK_MAKEFLAGS(bld):
|
def CHECK_MAKEFLAGS(options):
|
||||||
'''check for MAKEFLAGS environment variable in case we are being
|
'''check for MAKEFLAGS environment variable in case we are being
|
||||||
called from a Makefile try to honor a few make command line flags'''
|
called from a Makefile try to honor a few make command line flags'''
|
||||||
if not 'WAF_MAKE' in os.environ:
|
if not 'WAF_MAKE' in os.environ:
|
||||||
return
|
return
|
||||||
makeflags = os.environ.get('MAKEFLAGS')
|
makeflags = os.environ.get('MAKEFLAGS')
|
||||||
if makeflags is None:
|
if makeflags is None:
|
||||||
return
|
makeflags = ""
|
||||||
jobs_set = False
|
jobs_set = False
|
||||||
jobs = None
|
jobs = None
|
||||||
# we need to use shlex.split to cope with the escaping of spaces
|
# we need to use shlex.split to cope with the escaping of spaces
|
||||||
@ -455,7 +455,7 @@ def CHECK_MAKEFLAGS(bld):
|
|||||||
for opt in shlex.split(makeflags):
|
for opt in shlex.split(makeflags):
|
||||||
# options can come either as -x or as x
|
# options can come either as -x or as x
|
||||||
if opt[0:2] == 'V=':
|
if opt[0:2] == 'V=':
|
||||||
Options.options.verbose = Logs.verbose = int(opt[2:])
|
options.verbose = Logs.verbose = int(opt[2:])
|
||||||
if Logs.verbose > 0:
|
if Logs.verbose > 0:
|
||||||
Logs.zones = ['runner']
|
Logs.zones = ['runner']
|
||||||
if Logs.verbose > 2:
|
if Logs.verbose > 2:
|
||||||
@ -469,26 +469,35 @@ def CHECK_MAKEFLAGS(bld):
|
|||||||
# this is also how "make test TESTS=testpattern" works, and
|
# this is also how "make test TESTS=testpattern" works, and
|
||||||
# "make VERBOSE=1" as well as things like "make SYMBOLCHECK=1"
|
# "make VERBOSE=1" as well as things like "make SYMBOLCHECK=1"
|
||||||
loc = opt.find('=')
|
loc = opt.find('=')
|
||||||
setattr(Options.options, opt[0:loc], opt[loc+1:])
|
setattr(options, opt[0:loc], opt[loc+1:])
|
||||||
elif opt[0] != '-':
|
elif opt[0] != '-':
|
||||||
for v in opt:
|
for v in opt:
|
||||||
if re.search(r'j[0-9]*$', v):
|
if re.search(r'j[0-9]*$', v):
|
||||||
jobs_set = True
|
jobs_set = True
|
||||||
jobs = opt.strip('j')
|
jobs = opt.strip('j')
|
||||||
elif v == 'k':
|
elif v == 'k':
|
||||||
Options.options.keep = True
|
options.keep = True
|
||||||
elif re.search(r'-j[0-9]*$', opt):
|
elif re.search(r'-j[0-9]*$', opt):
|
||||||
jobs_set = True
|
jobs_set = True
|
||||||
jobs = opt.strip('-j')
|
jobs = opt.strip('-j')
|
||||||
elif opt == '-k':
|
elif opt == '-k':
|
||||||
Options.options.keep = True
|
options.keep = True
|
||||||
if not jobs_set:
|
if not jobs_set:
|
||||||
# default to one job
|
# default to one job
|
||||||
Options.options.jobs = 1
|
options.jobs = 1
|
||||||
elif jobs_set and jobs:
|
elif jobs_set and jobs:
|
||||||
Options.options.jobs = int(jobs)
|
options.jobs = int(jobs)
|
||||||
|
|
||||||
Build.BuildContext.CHECK_MAKEFLAGS = CHECK_MAKEFLAGS
|
waflib_options_parse_cmd_args = Options.OptionsContext.parse_cmd_args
|
||||||
|
def wafsamba_options_parse_cmd_args(self, _args=None, cwd=None, allow_unknown=False):
|
||||||
|
(options, commands, envvars) = \
|
||||||
|
waflib_options_parse_cmd_args(self,
|
||||||
|
_args=_args,
|
||||||
|
cwd=cwd,
|
||||||
|
allow_unknown=allow_unknown)
|
||||||
|
CHECK_MAKEFLAGS(options)
|
||||||
|
return options, commands, envvars
|
||||||
|
Options.OptionsContext.parse_cmd_args = wafsamba_options_parse_cmd_args
|
||||||
|
|
||||||
option_groups = {}
|
option_groups = {}
|
||||||
|
|
||||||
|
@ -598,7 +598,6 @@ def build(bld):
|
|||||||
Logs.error('bld.path %s is not a child of %s' % (curdir, srcdir))
|
Logs.error('bld.path %s is not a child of %s' % (curdir, srcdir))
|
||||||
raise Errors.WafError('''The top source directory has moved. Please run distclean and reconfigure''')
|
raise Errors.WafError('''The top source directory has moved. Please run distclean and reconfigure''')
|
||||||
|
|
||||||
bld.CHECK_MAKEFLAGS()
|
|
||||||
bld.SETUP_BUILD_GROUPS()
|
bld.SETUP_BUILD_GROUPS()
|
||||||
bld.ENFORCE_GROUP_ORDERING()
|
bld.ENFORCE_GROUP_ORDERING()
|
||||||
bld.CHECK_PROJECT_RULES()
|
bld.CHECK_PROJECT_RULES()
|
||||||
|
Loading…
Reference in New Issue
Block a user