mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +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 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):
|
||||
if args.debug:
|
||||
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
|
||||
if prereq_type in dep_cache:
|
||||
if cur in dep_cache[prereq_type]:
|
||||
return dep_cache[cur][prereq_type]
|
||||
return dep_cache[prereq_type][cur]
|
||||
else:
|
||||
dep_cache[prereq_type] = {}
|
||||
path = find_proj_path(cur)
|
||||
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 = subprocess.Popen(projects_py + " prereq " + prereq_type + " " + cur, shell=True, stdout=subprocess.PIPE)
|
||||
p.wait()
|
||||
if p.returncode:
|
||||
raise Exception("failed to get " + prereq_type + " prerequisites from " + path)
|
||||
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,''):
|
||||
debug('evaluating line:', line)
|
||||
if not pattern.match(line):
|
||||
continue
|
||||
for d in re.sub(pattern, '', line) .split():
|
||||
for d in line.split():
|
||||
r.add(d)
|
||||
# for d in p.stdout.read().split():
|
||||
# r.add(d)
|
||||
if cur in r:
|
||||
r.remove(cur)
|
||||
debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
||||
|
|
@ -77,9 +63,10 @@ def add_tree(cur, prereq_type):
|
|||
dep_tree[cur] = deps
|
||||
return len(deps)
|
||||
|
||||
def calculate_order(order, modules, prereq_type):
|
||||
for m in modules:
|
||||
add_tree(m, prereq_type)
|
||||
def calculate_order(order, modules, prereq_types):
|
||||
for t in prereq_types:
|
||||
for m in modules:
|
||||
add_tree(m, t)
|
||||
while len(all_deps):
|
||||
for d in all_deps:
|
||||
if not len(dep_tree[d]):
|
||||
|
|
@ -124,6 +111,17 @@ def build(modules, order, target):
|
|||
for m in order:
|
||||
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
|
||||
parser = argparse.ArgumentParser(description='jannet software project build tool')
|
||||
parser.add_argument('--base', '-b', nargs='?', default=proj_base, help='Project base directory')
|
||||
|
|
@ -151,9 +149,14 @@ if len(env_exclude):
|
|||
|
||||
# -- build
|
||||
if target != 'order':
|
||||
print("calculating order for modules: " + ' '.join(modules))
|
||||
print("calculating order for modules ... ")
|
||||
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:
|
||||
order = [m for m in order if m in args.modules]
|
||||
order = [m for m in order if m not in exclude]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue