From 3c5e2db1a47cfef67491a269bfed0f0730194f24 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Mon, 10 Jul 2023 18:09:07 +0200 Subject: [PATCH] Correctly report to the user when we compile a "system" package System packages can now specify replacement recipes, in which case they aren't really "system" packages, since we still run the potentially-expensive recipe. Report this to the user. --- alibuild_helpers/utilities.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/alibuild_helpers/utilities.py b/alibuild_helpers/utilities.py index 366be53e..c7361355 100644 --- a/alibuild_helpers/utilities.py +++ b/alibuild_helpers/utilities.py @@ -401,19 +401,19 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem, else: # prefer_system_check succeeded; this means we should use the system package. match = re.search(r"^alibuild_system_replace:(?P.*)$", output, re.MULTILINE) - systemPackages.add(spec["package"]) if not match: # No replacement spec name given. Fall back to old system package # behaviour and just disable the package. + systemPackages.add(spec["package"]) disable.append(spec["package"]) else: # The check printed the name of a replacement; use it. key = match.group("key").strip() try: replacement = spec["prefer_system_replacement_specs"][key] - except KeyError as exc: + except KeyError: dieOnError(True, "Could not find named replacement spec for " - "system package: %s (error was: %s)", key, exc) + "%s: %s" % (spec["package"], key)) else: # We must keep the package name the same, since it is used to # specify dependencies. @@ -423,6 +423,14 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem, replacement.setdefault("version", requested_version) spec = replacement recipe = replacement.get("recipe", "") + # If there's an explicitly-specified recipe, we're still building + # the package. If not, aliBuild will still "build" it, but it's + # basically instantaneous, so report to the user that we're taking + # it from the system. + if recipe: + ownPackages.add(spec["package"]) + else: + systemPackages.add(spec["package"]) dieOnError(("system_requirement" in spec) and recipe.strip("\n\t "), "System requirements %s cannot have a recipe" % spec["package"])