From 4c12628ad75ac19d175defda348dd2c39b1aadf8 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Fri, 23 Dec 2022 13:35:40 +0100
Subject: [PATCH] [scripts][build] Check for yum presence rather than rely on
 CI tags

From the looks of it, the CI_RUNNER_TAGS format may have changed to be
'["tag1", "tag2"]' so doing the actual check will not work.

Hence rather than relying on this environment variable content and format, check
whether yum is present on the runner and use it if so.
---
 bob/devtools/scripts/build.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bob/devtools/scripts/build.py b/bob/devtools/scripts/build.py
index a8f674af..13f91d32 100644
--- a/bob/devtools/scripts/build.py
+++ b/bob/devtools/scripts/build.py
@@ -247,11 +247,12 @@ def build(
         if not os.path.exists(d):
             raise RuntimeError("The directory %s does not exist" % d)
 
-        # If in docker, install the packages inside the yum_requirements.txt file if it exists
+        # If using RH based image/runner, install the packages inside the
+        # yum_requirements.txt file if it exists
         yum_requirements_file = os.path.join(d, "yum_requirements.txt")
-        if "docker" in os.environ.get("CI_RUNNER_TAGS", "").split(
-            ", "
-        ) and os.path.exists(yum_requirements_file):
+        if os.path.exists("/usr/bin/yum") and os.path.exists(
+            yum_requirements_file
+        ):
             logger.info(
                 "Installing packages from yum_requirements.txt file using yum"
             )
-- 
GitLab