From 2b93a1fdd1c59dfdef651bd1d95a73a22d37da13 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 25 Sep 2025 15:33:48 +0200 Subject: [PATCH 1/2] fix: remove warning about missing hostname command Partly revert e9bd42478e9e158059bc21d17d10cc95d2d307b1. The warning about missing `hostname` command is causing issues and breaks `get_dependencies` call. Signed-off-by: Christian Heimes --- src/fromager/run_network_isolation.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fromager/run_network_isolation.sh b/src/fromager/run_network_isolation.sh index dd6011da..6d3543a2 100755 --- a/src/fromager/run_network_isolation.sh +++ b/src/fromager/run_network_isolation.sh @@ -32,8 +32,6 @@ fi # set hostname to "localhost" if command -v hostname 2>&1 >/dev/null; then hostname localhost -else - echo "'hostname' command is missing, cannot set host name to 'localhost' for $@" >&2 fi # replace with command From 4e0bc170342c4f742576e56e90854ea09bd32417 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 25 Sep 2025 15:38:11 +0200 Subject: [PATCH 2/2] fix: log better error in get_distributions Log a better error message when JSON de-serialization fails in `BuildEnvironment.get_distribution()` call. Do not fail when debug log call with installed distributions is failing. The error is not fatal. Signed-off-by: Christian Heimes --- src/fromager/build_environment.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/fromager/build_environment.py b/src/fromager/build_environment.py index 6698aa69..f4719063 100644 --- a/src/fromager/build_environment.py +++ b/src/fromager/build_environment.py @@ -237,7 +237,10 @@ def get_distributions(self) -> typing.Mapping[str, Version]: "json.dump({d.name: d.version for d in distributions()}, sys.stdout)", ] result = self.run([str(self.python), "-c", "; ".join(lines)]) - mapping = json.loads(result.strip()) + try: + mapping = json.loads(result.strip()) + except Exception: + logger.exception("failed to de-serialize JSON: %s", result) return {name: Version(version) for name, version in sorted(mapping.items())} @@ -296,9 +299,13 @@ def prepare_build_environment( dep_req_type=RequirementType.BUILD_SDIST, ) - logger.debug( - "build env %r has packages %r", build_env.path, build_env.get_distributions() - ) + try: + distributions = build_env.get_distributions() + except Exception: + # ignore error for debug call, error reason is logged in get_distributions() + pass + else: + logger.debug("build env %r has packages %r", build_env.path, distributions) return build_env