Skip to content

Commit

Permalink
Correctly report to the user when we compile a "system" package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TimoWilken committed Jul 10, 2023
1 parent 997dc21 commit 3c5e2db
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions alibuild_helpers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<key>.*)$", 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.
Expand All @@ -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"])
Expand Down

0 comments on commit 3c5e2db

Please sign in to comment.