libkas: Detect and report multiple init scripts
Having more than one them is a sign of serious problems in the configuration. Better catch that early and fail loudly. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
eb284afb8e
commit
2d6b1ce6a0
@ -263,15 +263,20 @@ def get_build_environ(config, build_dir):
|
|||||||
# nasty side effect function: running oe/isar-init-build-env also
|
# nasty side effect function: running oe/isar-init-build-env also
|
||||||
# creates the conf directory
|
# creates the conf directory
|
||||||
|
|
||||||
|
init_repo = None
|
||||||
permutations = \
|
permutations = \
|
||||||
[(repo, script) for repo in config.get_repos()
|
[(repo, script) for repo in config.get_repos()
|
||||||
for script in ['oe-init-build-env', 'isar-init-build-env']]
|
for script in ['oe-init-build-env', 'isar-init-build-env']]
|
||||||
for (repo, script) in permutations:
|
for (repo, script) in permutations:
|
||||||
if os.path.exists(repo.path + '/' + script):
|
if os.path.exists(repo.path + '/' + script):
|
||||||
init_path = repo.path
|
if init_repo:
|
||||||
|
logging.error('Multiple init scripts found (%s vs. %s). ',
|
||||||
|
repo.name, init_repo.name)
|
||||||
|
logging.error('Resolve ambiguity by removing one of the repos')
|
||||||
|
sys.exit(1)
|
||||||
|
init_repo = repo
|
||||||
init_script = script
|
init_script = script
|
||||||
break
|
if not init_repo:
|
||||||
else:
|
|
||||||
logging.error('Did not find any init-build-env script')
|
logging.error('Did not find any init-build-env script')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -289,7 +294,7 @@ def get_build_environ(config, build_dir):
|
|||||||
env['PATH'] = '/bin:/usr/bin'
|
env['PATH'] = '/bin:/usr/bin'
|
||||||
|
|
||||||
(_, output) = run_cmd([get_bb_env_file, build_dir],
|
(_, output) = run_cmd([get_bb_env_file, build_dir],
|
||||||
cwd=init_path, env=env, liveupdate=False)
|
cwd=init_repo.path, env=env, liveupdate=False)
|
||||||
|
|
||||||
os.remove(get_bb_env_file)
|
os.remove(get_bb_env_file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user