mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-24 06:40:39 +01:00
projects.py: Add support for [build.exclude]
Also disable recent switch to in-memory dependency detection, because it is buggy and messes up the order Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
cda8e8e122
commit
775795c8fa
1 changed files with 19 additions and 6 deletions
|
|
@ -55,6 +55,9 @@ class ResultCache(object):
|
||||||
|
|
||||||
class Build(object):
|
class Build(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.__os_cascade = os_cascade()
|
||||||
|
|
||||||
def find_proj_path(self, name):
|
def find_proj_path(self, name):
|
||||||
name=name.replace("dspider-", "")
|
name=name.replace("dspider-", "")
|
||||||
search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
||||||
|
|
@ -75,10 +78,10 @@ class Build(object):
|
||||||
else:
|
else:
|
||||||
dep_cache[prereq_type] = {}
|
dep_cache[prereq_type] = {}
|
||||||
|
|
||||||
if True:
|
if False:
|
||||||
r = get_modules_from_project_txt(cur, 'pkg.requires.jw',
|
r = get_modules_from_project_txt(cur, 'pkg.requires.jw',
|
||||||
prereq_type, scope = 2, add_self=False, names_only=True)
|
prereq_type, scope = 2, add_self=False, names_only=True)
|
||||||
else: # legacy
|
else: # legacy from build.py
|
||||||
projects_py="/usr/bin/python2 " + my_dir + "/projects.py --prefix " + projs_root + " " + os.getenv('PROJECTS_PY_EXTRA_ARGS', "")
|
projects_py="/usr/bin/python2 " + my_dir + "/projects.py --prefix " + projs_root + " " + os.getenv('PROJECTS_PY_EXTRA_ARGS', "")
|
||||||
cmd = projects_py + " prereq " + prereq_type + " " + cur
|
cmd = projects_py + " prereq " + prereq_type + " " + cur
|
||||||
debug('running', cmd)
|
debug('running', cmd)
|
||||||
|
|
@ -119,7 +122,8 @@ class Build(object):
|
||||||
tree[cur] = deps
|
tree[cur] = deps
|
||||||
return len(deps)
|
return len(deps)
|
||||||
|
|
||||||
def calculate_order(self, order, modules, prereq_types, all_deps):
|
def calculate_order(self, order, modules, prereq_types):
|
||||||
|
all_deps = Set()
|
||||||
dep_tree = {}
|
dep_tree = {}
|
||||||
for m in modules:
|
for m in modules:
|
||||||
debug("--- adding dependency tree of module " + m)
|
debug("--- adding dependency tree of module " + m)
|
||||||
|
|
@ -147,6 +151,17 @@ class Build(object):
|
||||||
delim = delim + '-' * (delim_len - len(delim))
|
delim = delim + '-' * (delim_len - len(delim))
|
||||||
|
|
||||||
print(',' + delim + ' >')
|
print(',' + delim + ' >')
|
||||||
|
|
||||||
|
# -- check exclude
|
||||||
|
exclude = get_modules_from_project_txt([ module ], 'build', 'exclude',
|
||||||
|
scope = 1, add_self=False, names_only=True)
|
||||||
|
for p1 in exclude:
|
||||||
|
for p2 in self.__os_cascade + [ 'all' ]:
|
||||||
|
if p1 == p2:
|
||||||
|
print('| Configured to skip build on platform >' + p1 + '<')
|
||||||
|
print('`' + delim + ' <')
|
||||||
|
return
|
||||||
|
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
p = subprocess.Popen(make_cmd, shell=False, stdout=subprocess.PIPE, stderr=None, close_fds=True)
|
p = subprocess.Popen(make_cmd, shell=False, stdout=subprocess.PIPE, stderr=None, close_fds=True)
|
||||||
for line in iter(p.stdout.readline, ''):
|
for line in iter(p.stdout.readline, ''):
|
||||||
|
|
@ -176,14 +191,12 @@ class Build(object):
|
||||||
self.run_make(m, target, cur_project, num_projects)
|
self.run_make(m, target, cur_project, num_projects)
|
||||||
|
|
||||||
def run(self, args_):
|
def run(self, args_):
|
||||||
all_deps = Set()
|
|
||||||
visited = {}
|
visited = {}
|
||||||
glob_order = []
|
glob_order = []
|
||||||
projs_root=pwd.getpwuid(os.getuid()).pw_dir + "/local/src/jw.dev/proj"
|
projs_root=pwd.getpwuid(os.getuid()).pw_dir + "/local/src/jw.dev/proj"
|
||||||
|
|
||||||
# -- parse command line
|
# -- parse command line
|
||||||
parser = argparse.ArgumentParser(description='janware software project build tool')
|
parser = argparse.ArgumentParser(description='janware software project build tool')
|
||||||
parser.add_argument('--base', '-b', nargs='?', default=projs_root, help='Project base directory')
|
|
||||||
parser.add_argument('--exclude', default='', help='Space seperated ist of modules to be excluded from build')
|
parser.add_argument('--exclude', default='', help='Space seperated ist of modules to be excluded from build')
|
||||||
parser.add_argument('--debug', '-d', action='store_true',
|
parser.add_argument('--debug', '-d', action='store_true',
|
||||||
default=False, help='Output debug information to stderr')
|
default=False, help='Output debug information to stderr')
|
||||||
|
|
@ -217,7 +230,7 @@ class Build(object):
|
||||||
glob_prereq_types = [ "build", "run", "release", "devel" ]
|
glob_prereq_types = [ "build", "run", "release", "devel" ]
|
||||||
print("using prerequisite types " + ' '.join(glob_prereq_types))
|
print("using prerequisite types " + ' '.join(glob_prereq_types))
|
||||||
|
|
||||||
self.calculate_order(order, modules, glob_prereq_types, all_deps)
|
self.calculate_order(order, modules, glob_prereq_types)
|
||||||
if args.ignore_deps:
|
if args.ignore_deps:
|
||||||
order = [m for m in order if m in args.modules]
|
order = [m for m in order if m in args.modules]
|
||||||
order = [m for m in order if m not in exclude]
|
order = [m for m in order if m not in exclude]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue