From d1090edb914be0efaddabd5a254bb2051d74bb59 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 21 Jul 2025 10:31:08 +0200 Subject: Print external project logfile on CI systems --- mesonbuild/scripts/externalproject.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'mesonbuild/scripts/externalproject.py') diff --git a/mesonbuild/scripts/externalproject.py b/mesonbuild/scripts/externalproject.py index 4013b0acf..b782a8551 100644 --- a/mesonbuild/scripts/externalproject.py +++ b/mesonbuild/scripts/externalproject.py @@ -10,6 +10,7 @@ from pathlib import Path import typing as T from ..mesonlib import Popen_safe, split_args, determine_worker_count +from .. import mlog class ExternalProject: def __init__(self, options: argparse.Namespace): @@ -67,10 +68,10 @@ class ExternalProject: def _run(self, step: str, command: T.List[str], env: T.Optional[T.Dict[str, str]] = None) -> int: m = 'Running command ' + str(command) + ' in directory ' + str(self.build_dir) + '\n' - log_filename = Path(self.log_dir, f'{self.name}-{step}.log') + logfile = Path(self.log_dir, f'{self.name}-{step}.log') output = None if not self.verbose: - output = open(log_filename, 'w', encoding='utf-8') + output = open(logfile, 'w', encoding='utf-8') output.write(m + '\n') output.flush() else: @@ -84,8 +85,11 @@ class ExternalProject: if p.returncode != 0: m = f'{step} step returned error code {p.returncode}.' if not self.verbose: - m += '\nSee logs: ' + str(log_filename) + m += '\nSee logs: ' + str(logfile) print(m) + contents = mlog.ci_fold_file(logfile, f'CI platform detected, click here for {os.path.basename(logfile)} contents.') + if contents: + print(contents) return p.returncode def run(args: T.List[str]) -> int: -- cgit v1.2.3