From d3d9aedc25146cbf375958a06e3184e581e675e0 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 13 May 2022 13:26:14 +0200 Subject: [PATCH 1/3] Add ability to disable / enable packages by architecture This allows us to define that a given package can only be built on certain architectures. This is done via the architecture tag, e.g.: architecture: slc7 # build on slc7 only architecture: (?!osx) # Do not build on macOS architecture: (slc7|slc6) # Only slc6 and slc7 This avoids having to specify in every dependent of the package the conditional requirement string. It also has the advantage that when a package is disabled, but still present on the system because --- alibuild_helpers/utilities.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/alibuild_helpers/utilities.py b/alibuild_helpers/utilities.py index b15d45a0..57c8ffee 100644 --- a/alibuild_helpers/utilities.py +++ b/alibuild_helpers/utilities.py @@ -459,6 +459,18 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem, log("Overrides for package %s: %s", spec["package"], overrides[override]) spec.update(overrides.get(override, {}) or {}) + # Architecture is used to determine for which architecture we + # should build a given package. By default everything matches + # The architecture string should NOT go in the has, because in + # any case wether or not a package is build the hash will be different. + architectureRE = spec.get("architecture", ".*") + try: + architectureREMatches = re.match(architectureRE, architecture) + except: + dieOnError(True, "Malformed entry architecture: %s in %s" % (architecture, spec["package"])) + if architectureREMatches == "False": + disable.append(spec["package"]) + # If --always-prefer-system is passed or if prefer_system is set to true # inside the recipe, use the script specified in the prefer_system_check # stanza to see if we can use the system version of the package. From c362489cbab50250450dfd9e913d69df8967296d Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 13 May 2022 13:37:29 +0200 Subject: [PATCH 2/3] Make system_requirement more useful This allows people to define system requirements also for packages which have a recipe. It also falls back to prefer_system_check when system_requirement_check is missing. This will allow us, for example to say: system_requirement: (ubuntu|osx) for packages which want to pick up from the system on those two architectures, e.g. openssl. --- alibuild_helpers/utilities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alibuild_helpers/utilities.py b/alibuild_helpers/utilities.py index 57c8ffee..28333fd5 100644 --- a/alibuild_helpers/utilities.py +++ b/alibuild_helpers/utilities.py @@ -525,10 +525,10 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem, else: systemPackages.add(spec["package"]) - dieOnError(("system_requirement" in spec) and recipe.strip("\n\t "), - "System requirements %s cannot have a recipe" % spec["package"]) if re.match(spec.get("system_requirement", "(?!.*)"), architecture): - cmd = spec.get("system_requirement_check", "false") + # system_requirement fallsback to the prefer_system_check rule + # if the system_requirement_check does not exist. + cmd = spec.get("system_requirement_check", spec.get("prefer_system_check", "false")) if not spec["package"] in requirementsCache: requirementsCache[spec["package"]] = performRequirementCheck(spec, cmd.strip()) From f43ac2ef576bd0bbea7480f4e826b5cc3ab8ecd3 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Tue, 31 May 2022 14:31:29 +0200 Subject: [PATCH 3/3] Fix match evaluation --- alibuild_helpers/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alibuild_helpers/utilities.py b/alibuild_helpers/utilities.py index 28333fd5..a7d55452 100644 --- a/alibuild_helpers/utilities.py +++ b/alibuild_helpers/utilities.py @@ -468,7 +468,7 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem, architectureREMatches = re.match(architectureRE, architecture) except: dieOnError(True, "Malformed entry architecture: %s in %s" % (architecture, spec["package"])) - if architectureREMatches == "False": + if not architectureREMatches: disable.append(spec["package"]) # If --always-prefer-system is passed or if prefer_system is set to true