Skip to content

Commit 6c215b1

Browse files
committed
libkas: Dump output of init-build-env scripts at debug log-level
This allows to inspect the output of the oe/isar-init-build-env scripts when turning on debug log-level which can be helpful for analyzing the proper script behavior. Closes #166 Signed-off-by: Jan Kiszka <[email protected]>
1 parent fdd4db8 commit 6c215b1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kas/libkas.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,13 @@ def get_build_environ(build_system):
292292
raise InitBuildEnvError('Did not find any init-build-env script')
293293

294294
with tempfile.TemporaryDirectory() as temp_dir:
295+
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
296+
init_script_log = pathlib.Path(temp_dir) / '.init_script.log'
297+
else:
298+
init_script_log = '/dev/null'
295299
script = f"""#!/bin/bash
296300
set -e
297-
source {init_script} $1 > /dev/null
301+
source {init_script} $1 > {init_script_log}
298302
env
299303
"""
300304

@@ -307,6 +311,12 @@ def get_build_environ(build_system):
307311

308312
(_, output) = run_cmd([str(get_bb_env_file), get_context().build_dir],
309313
cwd=init_repo.path, env=env)
314+
if init_script_log != '/dev/null':
315+
with open(init_script_log) as log:
316+
msg = f'{init_script} output:\n'
317+
for line in log.readlines():
318+
msg += line
319+
logging.debug(msg.rstrip('\n'))
310320

311321
env = {}
312322
for line in output.splitlines():

0 commit comments

Comments
 (0)