mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
build.py: Add basic support for --debug argument
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
60c6d770b5
commit
93827e187b
2 changed files with 24 additions and 13 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python -u
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import dircache
|
||||
|
|
@ -22,6 +23,10 @@ search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
|||
glob_prereq_type="BUILD"
|
||||
dep_cache = {}
|
||||
|
||||
def debug(*objs):
|
||||
if args.debug:
|
||||
print("DEBUG: ", *objs, file=sys.stderr)
|
||||
|
||||
def find_proj_path(name):
|
||||
name=name.replace("dspider-", "")
|
||||
for sub in search_path:
|
||||
|
|
@ -50,7 +55,7 @@ def read_deps(cur, prereq_type):
|
|||
r.add(d)
|
||||
if cur in r:
|
||||
r.remove(cur)
|
||||
#print 'inserting', prereq_type, cur, r
|
||||
debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
||||
dep_cache[prereq_type][cur] = r
|
||||
return r
|
||||
|
||||
|
|
@ -72,7 +77,7 @@ def calculate_order(order, modules, prereq_type):
|
|||
if not len(dep_tree[d]):
|
||||
break
|
||||
else:
|
||||
print all_deps
|
||||
print(all_deps)
|
||||
raise Exception("fatal: the dependencies between these modules are unresolvable")
|
||||
order.append(d)
|
||||
all_deps.remove(d)
|
||||
|
|
@ -83,7 +88,7 @@ def calculate_order(order, modules, prereq_type):
|
|||
|
||||
def run_make(module, target):
|
||||
path = find_proj_path(module)
|
||||
print "========= running make " + target + " in " + path
|
||||
print("========= running make " + target + " in " + path)
|
||||
os.chdir(path)
|
||||
if subprocess.call(["make", target]):
|
||||
raise Exception(time.strftime("%Y-%m-%d %H:%M") + ": failed to make target " + target + " in module " + module + " below base " + proj_base)
|
||||
|
|
@ -95,7 +100,7 @@ def build(modules, order, target):
|
|||
if m in modules:
|
||||
modules.remove(m)
|
||||
if not len(modules):
|
||||
print "all modules cleaned"
|
||||
print("all modules cleaned")
|
||||
return
|
||||
else:
|
||||
for m in order:
|
||||
|
|
@ -107,10 +112,15 @@ modules = Set()
|
|||
parser = argparse.ArgumentParser(description='jannet software project build tool')
|
||||
parser.add_argument('--base', '-b', nargs='?', default=proj_base, help='Project base directory')
|
||||
parser.add_argument('--exclude', nargs='?', default='', help='List of modules to be excluded from build')
|
||||
parser.add_argument('--debug', '-d', action='store_true',
|
||||
default=False, help='Output debug information to stderr')
|
||||
parser.add_argument('target', default='all', help='Build target')
|
||||
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
||||
|
||||
args=parser.parse_args()
|
||||
|
||||
debug("----------------------------------------- running ", ' '.join(sys.argv))
|
||||
|
||||
proj_base=args.base
|
||||
exclude=args.exclude
|
||||
target=args.target
|
||||
|
|
@ -118,21 +128,21 @@ modules=args.modules
|
|||
|
||||
env_exclude=os.getenv('BUILD_EXCLUDE', '')
|
||||
if len(env_exclude):
|
||||
print "exluding modules from environment: " + env_exclude
|
||||
print("exluding modules from environment: " + env_exclude)
|
||||
exclude += " " + env_exclude
|
||||
|
||||
# -- build
|
||||
if target != 'order':
|
||||
print "calculating order for modules: " + ' '.join(modules)
|
||||
print("calculating order for modules: " + ' '.join(modules))
|
||||
order = []
|
||||
calculate_order(order, modules, glob_prereq_type)
|
||||
order = [m for m in order if m not in exclude]
|
||||
if target == 'order':
|
||||
print ' '.join(order)
|
||||
print(' '.join(order))
|
||||
exit(0)
|
||||
|
||||
print "order is: " + ' '.join(order)
|
||||
print("order is: " + ' '.join(order))
|
||||
build(modules, order, target)
|
||||
|
||||
print datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue