Blame SOURCES/BZ-1927971-let-scl_source-behave-with-errexit.patch

e38004
From a8113846229a567321ca4347b07263936307b940 Mon Sep 17 00:00:00 2001
e38004
From: "James E. Flemer" <james.flemer@ndpgroup.com>
e38004
Date: Tue, 16 Feb 2021 02:48:27 -0700
e38004
Subject: [PATCH] Let scl_source behave when "-e"/errexit is set (#35)
e38004
e38004
Jenkins pipelines, among other things, use `set -e` (aka bash `errexit`) to abort on "errors". So when `source scl_source` is used in a pipeline, the way the exit code from `scl_enabled` is checked via `$?` causes an unintended abort of the pipeline. (Workaround is to use `set +e; source scl_source ...; set -e`.)
e38004
e38004
This trivial change to `scl_source` simply changes how the value of `scl_enalbed` is checked to be friendly to `errexit`.
e38004
---
e38004
 shell/scl_source | 3 +--
e38004
 1 file changed, 1 insertion(+), 2 deletions(-)
e38004
e38004
diff --git a/shell/scl_source b/shell/scl_source
e38004
index 5822955..30b8baf 100755
e38004
--- a/shell/scl_source
e38004
+++ b/shell/scl_source
e38004
@@ -47,8 +47,7 @@ for arg in "$@"; do
e38004
     done
e38004
 
e38004
     # Now check if the collection isn't already enabled
e38004
-    /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null
e38004
-    if [ $? -ne 0 ]; then
e38004
+    if ! /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null; then
e38004
         _scls+=($arg)
e38004
         _scl_prefixes+=($_scl_prefix)
e38004
     fi;
e38004
-- 
e38004
2.29.2
e38004