2010-11-12 05:24:46 -08:00
|
|
|
#!/usr/bin/python
|
2010-11-21 02:08:05 -08:00
|
|
|
import sys, os
|
2010-12-11 18:32:40 -08:00
|
|
|
import options
|
|
|
|
|
from helpers import atoi
|
2010-11-12 05:24:46 -08:00
|
|
|
|
|
|
|
|
optspec = """
|
|
|
|
|
redo [targets...]
|
|
|
|
|
--
|
2010-11-13 04:36:44 -08:00
|
|
|
j,jobs= maximum number of jobs to build at once
|
2010-11-12 07:03:06 -08:00
|
|
|
d,debug print dependency checks as they happen
|
2010-11-21 06:35:52 -08:00
|
|
|
v,verbose print commands as they are read from .do files (variables intact)
|
|
|
|
|
x,xtrace print commands as they are executed (variables expanded)
|
2010-11-21 07:10:48 -08:00
|
|
|
k,keep-going keep going as long as possible even if some targets fail
|
2010-11-16 00:14:57 -08:00
|
|
|
shuffle randomize the build order to find dependency bugs
|
2010-11-21 06:23:41 -08:00
|
|
|
debug-locks print messages about file locking (useful for debugging)
|
2010-11-22 01:50:46 -08:00
|
|
|
debug-pids print process ids as part of log messages (useful for debugging)
|
2010-11-12 05:24:46 -08:00
|
|
|
"""
|
|
|
|
|
o = options.Options('redo', optspec)
|
|
|
|
|
(opt, flags, extra) = o.parse(sys.argv[1:])
|
|
|
|
|
|
2010-11-13 01:40:37 -08:00
|
|
|
targets = extra or ['all']
|
2010-11-12 05:24:46 -08:00
|
|
|
|
2010-11-13 00:53:55 -08:00
|
|
|
if opt.debug:
|
2010-11-16 04:13:17 -08:00
|
|
|
os.environ['REDO_DEBUG'] = str(opt.debug or 0)
|
2010-11-13 00:53:55 -08:00
|
|
|
if opt.verbose:
|
|
|
|
|
os.environ['REDO_VERBOSE'] = '1'
|
2010-11-21 06:35:52 -08:00
|
|
|
if opt.xtrace:
|
|
|
|
|
os.environ['REDO_XTRACE'] = '1'
|
2010-11-21 07:10:48 -08:00
|
|
|
if opt.keep_going:
|
|
|
|
|
os.environ['REDO_KEEP_GOING'] = '1'
|
2010-11-16 00:14:57 -08:00
|
|
|
if opt.shuffle:
|
|
|
|
|
os.environ['REDO_SHUFFLE'] = '1'
|
2010-11-21 06:23:41 -08:00
|
|
|
if opt.debug_locks:
|
|
|
|
|
os.environ['REDO_DEBUG_LOCKS'] = '1'
|
2010-11-22 01:50:46 -08:00
|
|
|
if opt.debug_pids:
|
|
|
|
|
os.environ['REDO_DEBUG_PIDS'] = '1'
|
2010-11-13 00:53:55 -08:00
|
|
|
|
2010-12-11 19:08:53 -08:00
|
|
|
import vars_init
|
|
|
|
|
vars_init.init(targets)
|
2010-11-19 03:13:40 -08:00
|
|
|
|
2010-12-11 18:32:40 -08:00
|
|
|
import vars, state, builder, jwack
|
|
|
|
|
from log import err
|
2010-11-19 03:13:40 -08:00
|
|
|
|
2010-11-13 04:36:44 -08:00
|
|
|
try:
|
2010-12-11 18:32:40 -08:00
|
|
|
j = atoi(opt.jobs or 1)
|
2010-11-13 04:36:44 -08:00
|
|
|
if j < 1 or j > 1000:
|
|
|
|
|
err('invalid --jobs value: %r\n' % opt.jobs)
|
|
|
|
|
jwack.setup(j)
|
|
|
|
|
try:
|
2010-11-21 23:33:11 -08:00
|
|
|
retcode = builder.main(targets, lambda t: True)
|
2010-11-13 04:36:44 -08:00
|
|
|
finally:
|
|
|
|
|
jwack.force_return_tokens()
|
2010-11-13 02:09:42 -08:00
|
|
|
sys.exit(retcode)
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
sys.exit(200)
|