mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-22 14:10:39 +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
|
|
@ -45,7 +45,8 @@ ifeq ($(CVS_RSH),)
|
||||||
export CVS_RSH
|
export CVS_RSH
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PGIT = CLONE_PROJECTS="$(PROJECTS)" PGIT_CLONE_FROM_USER="$(JANWARE_USER)" /bin/bash $(firstword $(wildcard ./ytools/devutil/scripts/pgit.sh /opt/ytools/bin/pgit.sh))
|
PGIT = CLONE_PROJECTS="$(PROJECTS)" PGIT_CLONE_FROM_USER="$(JANWARE_USER)" /bin/bash $(firstword $(wildcard ./ytools/devutil/scripts/pgit.sh /opt/ytools/bin/pgit.sh))
|
||||||
|
BUILD_PY = python ./ytools/devutil/scripts/build.py -b $(shell pwd) $(BUILD_PY_EXTRA_OPTS)
|
||||||
|
|
||||||
EXCLUDE_FROM_BUILD = \
|
EXCLUDE_FROM_BUILD = \
|
||||||
dspider-btools \
|
dspider-btools \
|
||||||
|
|
@ -59,15 +60,15 @@ EXCLUDE_FROM_BUILD = \
|
||||||
all: links.done clone.done cvs-update.done
|
all: links.done clone.done cvs-update.done
|
||||||
|
|
||||||
all clean: config.done
|
all clean: config.done
|
||||||
python ./ytools/devutil/scripts/build.py -b $(shell pwd) $@ $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
$(BUILD_PY) $@ $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
||||||
|
|
||||||
pkg-%:
|
pkg-%:
|
||||||
python ./ytools/devutil/scripts/build.py -b $(shell pwd) $@ $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
$(BUILD_PY) $@ $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
||||||
|
|
||||||
clean: done.clean
|
clean: done.clean
|
||||||
|
|
||||||
clean-dirs:
|
clean-dirs:
|
||||||
ls */dirs-all.done 2>/dev/null | sed 's%/.*%%' | xargs -r build.py -b $(shell pwd) clean
|
ls */dirs-all.done 2>/dev/null | sed 's%/.*%%' | xargs -r $(BUILD_PY) clean
|
||||||
|
|
||||||
cpp:
|
cpp:
|
||||||
@find $(PROJECTS) -name '*.cpp' | grep /worker/ | grep -ve "old\|tmp\|nomake\|new" | \
|
@find $(PROJECTS) -name '*.cpp' | grep /worker/ | grep -ve "old\|tmp\|nomake\|new" | \
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python -u
|
#!/usr/bin/python -u
|
||||||
# -*- coding: iso-8859-15 -*-
|
# -*- coding: iso-8859-15 -*-
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import dircache
|
import dircache
|
||||||
|
|
@ -22,6 +23,10 @@ search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
||||||
glob_prereq_type="BUILD"
|
glob_prereq_type="BUILD"
|
||||||
dep_cache = {}
|
dep_cache = {}
|
||||||
|
|
||||||
|
def debug(*objs):
|
||||||
|
if args.debug:
|
||||||
|
print("DEBUG: ", *objs, file=sys.stderr)
|
||||||
|
|
||||||
def find_proj_path(name):
|
def find_proj_path(name):
|
||||||
name=name.replace("dspider-", "")
|
name=name.replace("dspider-", "")
|
||||||
for sub in search_path:
|
for sub in search_path:
|
||||||
|
|
@ -50,7 +55,7 @@ def read_deps(cur, prereq_type):
|
||||||
r.add(d)
|
r.add(d)
|
||||||
if cur in r:
|
if cur in r:
|
||||||
r.remove(cur)
|
r.remove(cur)
|
||||||
#print 'inserting', prereq_type, cur, r
|
debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
||||||
dep_cache[prereq_type][cur] = r
|
dep_cache[prereq_type][cur] = r
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
@ -72,7 +77,7 @@ def calculate_order(order, modules, prereq_type):
|
||||||
if not len(dep_tree[d]):
|
if not len(dep_tree[d]):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print all_deps
|
print(all_deps)
|
||||||
raise Exception("fatal: the dependencies between these modules are unresolvable")
|
raise Exception("fatal: the dependencies between these modules are unresolvable")
|
||||||
order.append(d)
|
order.append(d)
|
||||||
all_deps.remove(d)
|
all_deps.remove(d)
|
||||||
|
|
@ -83,7 +88,7 @@ def calculate_order(order, modules, prereq_type):
|
||||||
|
|
||||||
def run_make(module, target):
|
def run_make(module, target):
|
||||||
path = find_proj_path(module)
|
path = find_proj_path(module)
|
||||||
print "========= running make " + target + " in " + path
|
print("========= running make " + target + " in " + path)
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
if subprocess.call(["make", target]):
|
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)
|
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:
|
if m in modules:
|
||||||
modules.remove(m)
|
modules.remove(m)
|
||||||
if not len(modules):
|
if not len(modules):
|
||||||
print "all modules cleaned"
|
print("all modules cleaned")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
for m in order:
|
for m in order:
|
||||||
|
|
@ -107,10 +112,15 @@ modules = Set()
|
||||||
parser = argparse.ArgumentParser(description='jannet software project build tool')
|
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('--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('--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('target', default='all', help='Build target')
|
||||||
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
||||||
|
|
||||||
args=parser.parse_args()
|
args=parser.parse_args()
|
||||||
|
|
||||||
|
debug("----------------------------------------- running ", ' '.join(sys.argv))
|
||||||
|
|
||||||
proj_base=args.base
|
proj_base=args.base
|
||||||
exclude=args.exclude
|
exclude=args.exclude
|
||||||
target=args.target
|
target=args.target
|
||||||
|
|
@ -118,21 +128,21 @@ modules=args.modules
|
||||||
|
|
||||||
env_exclude=os.getenv('BUILD_EXCLUDE', '')
|
env_exclude=os.getenv('BUILD_EXCLUDE', '')
|
||||||
if len(env_exclude):
|
if len(env_exclude):
|
||||||
print "exluding modules from environment: " + env_exclude
|
print("exluding modules from environment: " + env_exclude)
|
||||||
exclude += " " + env_exclude
|
exclude += " " + env_exclude
|
||||||
|
|
||||||
# -- build
|
# -- build
|
||||||
if target != 'order':
|
if target != 'order':
|
||||||
print "calculating order for modules: " + ' '.join(modules)
|
print("calculating order for modules: " + ' '.join(modules))
|
||||||
order = []
|
order = []
|
||||||
calculate_order(order, modules, glob_prereq_type)
|
calculate_order(order, modules, glob_prereq_type)
|
||||||
order = [m for m in order if m not in exclude]
|
order = [m for m in order if m not in exclude]
|
||||||
if target == 'order':
|
if target == 'order':
|
||||||
print ' '.join(order)
|
print(' '.join(order))
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
print "order is: " + ' '.join(order)
|
print("order is: " + ' '.join(order))
|
||||||
build(modules, order, target)
|
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