mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-22 22:20:39 +01:00
build.py: Honour flavour argument of prereq command
This commit also abandons make echo-prereq in the project's directories, which is too unspecific to achieve the point of this commit. It has the following consequences: - All PREREQ_XXX definitions in makefiles become meaningless - Build order can break, because it now solely relies on project.conf Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
bab76cd9f4
commit
2332f79001
1 changed files with 27 additions and 24 deletions
|
|
@ -16,14 +16,6 @@ import time
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
all_deps = Set()
|
|
||||||
dep_tree = {}
|
|
||||||
glob_order = []
|
|
||||||
proj_base=pwd.getpwuid(os.getuid()).pw_dir + "/local/src/jw.dev/proj"
|
|
||||||
search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
|
||||||
glob_prereq_type="BUILD"
|
|
||||||
dep_cache = {}
|
|
||||||
|
|
||||||
def debug(*objs):
|
def debug(*objs):
|
||||||
if args.debug:
|
if args.debug:
|
||||||
print("DEBUG: ", *objs, file=sys.stderr)
|
print("DEBUG: ", *objs, file=sys.stderr)
|
||||||
|
|
@ -40,27 +32,21 @@ def read_deps(cur, prereq_type):
|
||||||
# dep cache doesn't make a difference at all
|
# dep cache doesn't make a difference at all
|
||||||
if prereq_type in dep_cache:
|
if prereq_type in dep_cache:
|
||||||
if cur in dep_cache[prereq_type]:
|
if cur in dep_cache[prereq_type]:
|
||||||
return dep_cache[cur][prereq_type]
|
return dep_cache[prereq_type][cur]
|
||||||
else:
|
else:
|
||||||
dep_cache[prereq_type] = {}
|
dep_cache[prereq_type] = {}
|
||||||
path = find_proj_path(cur)
|
p = subprocess.Popen(projects_py + " prereq " + prereq_type + " " + cur, shell=True, stdout=subprocess.PIPE)
|
||||||
os.chdir(path)
|
|
||||||
# ignoring prereq_type, as it has never been anything but BUILD, now
|
|
||||||
# only looking for PREREQ without anything
|
|
||||||
# p = subprocess.Popen("LD_LIBRARY_PATH= make echo-prereq | sed '/PREREQ " + " *=/ !d; s/.*=//'", shell=True, stdout=subprocess.PIPE)
|
|
||||||
p = subprocess.Popen("LD_LIBRARY_PATH= make echo-prereq", shell=True, stdout=subprocess.PIPE)
|
|
||||||
p.wait()
|
p.wait()
|
||||||
if p.returncode:
|
if p.returncode:
|
||||||
raise Exception("failed to get " + prereq_type + " prerequisites from " + path)
|
raise Exception("failed to get " + prereq_type + " prerequisites from " + path)
|
||||||
r = Set()
|
r = Set()
|
||||||
pattern = re.compile(r'^ *PREREQ.*=')
|
pattern = re.compile(r'.*') # might be useful at a later point, currently pointless
|
||||||
for line in iter(p.stdout.readline,''):
|
for line in iter(p.stdout.readline,''):
|
||||||
|
debug('evaluating line:', line)
|
||||||
if not pattern.match(line):
|
if not pattern.match(line):
|
||||||
continue
|
continue
|
||||||
for d in re.sub(pattern, '', line) .split():
|
for d in line.split():
|
||||||
r.add(d)
|
r.add(d)
|
||||||
# for d in p.stdout.read().split():
|
|
||||||
# r.add(d)
|
|
||||||
if cur in r:
|
if cur in r:
|
||||||
r.remove(cur)
|
r.remove(cur)
|
||||||
debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
||||||
|
|
@ -77,9 +63,10 @@ def add_tree(cur, prereq_type):
|
||||||
dep_tree[cur] = deps
|
dep_tree[cur] = deps
|
||||||
return len(deps)
|
return len(deps)
|
||||||
|
|
||||||
def calculate_order(order, modules, prereq_type):
|
def calculate_order(order, modules, prereq_types):
|
||||||
for m in modules:
|
for t in prereq_types:
|
||||||
add_tree(m, prereq_type)
|
for m in modules:
|
||||||
|
add_tree(m, t)
|
||||||
while len(all_deps):
|
while len(all_deps):
|
||||||
for d in all_deps:
|
for d in all_deps:
|
||||||
if not len(dep_tree[d]):
|
if not len(dep_tree[d]):
|
||||||
|
|
@ -124,6 +111,17 @@ def build(modules, order, target):
|
||||||
for m in order:
|
for m in order:
|
||||||
run_make(m, target)
|
run_make(m, target)
|
||||||
|
|
||||||
|
# ------------ here we go
|
||||||
|
|
||||||
|
all_deps = Set()
|
||||||
|
dep_tree = {}
|
||||||
|
glob_order = []
|
||||||
|
proj_base=pwd.getpwuid(os.getuid()).pw_dir + "/local/src/jw.dev/proj"
|
||||||
|
search_path=[".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
||||||
|
dep_cache = {}
|
||||||
|
my_dir=os.path.dirname(os.path.realpath(__file__))
|
||||||
|
projects_py="/usr/bin/python " + my_dir + "/projects.py"
|
||||||
|
|
||||||
# -- parse command line
|
# -- parse command line
|
||||||
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')
|
||||||
|
|
@ -151,9 +149,14 @@ if len(env_exclude):
|
||||||
|
|
||||||
# -- build
|
# -- build
|
||||||
if target != 'order':
|
if target != 'order':
|
||||||
print("calculating order for modules: " + ' '.join(modules))
|
print("calculating order for modules ... ")
|
||||||
order = []
|
order = []
|
||||||
calculate_order(order, modules, glob_prereq_type)
|
|
||||||
|
glob_prereq_types = [ "build" ]
|
||||||
|
if target == 'pkg-rebuild-reinstall':
|
||||||
|
glob_prereq_types == [ "build", "run", "release" ]
|
||||||
|
|
||||||
|
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