From 81628bdd575b5841b4b1efa01ce3a71b79e7b9b2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 30 Mar 2021 07:03:50 -0400 Subject: [PATCH] import scl-utils-2.0.2-13.el8 --- ...1-let-scl_source-behave-with-errexit.patch | 29 +++++++++++++++++++ SPECS/scl-utils.spec | 6 +++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 SOURCES/BZ-1927971-let-scl_source-behave-with-errexit.patch diff --git a/SOURCES/BZ-1927971-let-scl_source-behave-with-errexit.patch b/SOURCES/BZ-1927971-let-scl_source-behave-with-errexit.patch new file mode 100644 index 0000000..a93fecf --- /dev/null +++ b/SOURCES/BZ-1927971-let-scl_source-behave-with-errexit.patch @@ -0,0 +1,29 @@ +From a8113846229a567321ca4347b07263936307b940 Mon Sep 17 00:00:00 2001 +From: "James E. Flemer" +Date: Tue, 16 Feb 2021 02:48:27 -0700 +Subject: [PATCH] Let scl_source behave when "-e"/errexit is set (#35) + +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`.) + +This trivial change to `scl_source` simply changes how the value of `scl_enalbed` is checked to be friendly to `errexit`. +--- + shell/scl_source | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/shell/scl_source b/shell/scl_source +index 5822955..30b8baf 100755 +--- a/shell/scl_source ++++ b/shell/scl_source +@@ -47,8 +47,7 @@ for arg in "$@"; do + done + + # Now check if the collection isn't already enabled +- /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null +- if [ $? -ne 0 ]; then ++ if ! /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null; then + _scls+=($arg) + _scl_prefixes+=($_scl_prefix) + fi; +-- +2.29.2 + diff --git a/SPECS/scl-utils.spec b/SPECS/scl-utils.spec index 44b1ada..81b8ed9 100644 --- a/SPECS/scl-utils.spec +++ b/SPECS/scl-utils.spec @@ -3,7 +3,7 @@ Name: scl-utils Epoch: 1 Version: 2.0.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Utilities for alternative packaging License: GPLv2+ @@ -19,6 +19,7 @@ Requires: %{_bindir}/modulecmd Patch1: 0003-Scl-utils-layout-patch-from-fedora-famillecollet.com.patch Patch2: 0004-define-macro-python-explicitly.patch Patch3: BZ-1618803-adapt-env-parser-to-new-module-output.patch +Patch4: BZ-1927971-let-scl_source-behave-with-errexit.patch %description Run-time utility for alternative packaging. @@ -81,6 +82,9 @@ ln -s prefixes conf %{_rpmconfigdir}/brp-scl-python-bytecompile %changelog +* Tue Feb 16 2021 Michal Domonkos - 1:2.0.2-13 +- Let scl_source behave when -e/errexit is set (#1927971, James E. Flemer) + * Mon Feb 17 2020 Michal Domonkos - 1:2.0.2-12 - Adapt env parser to new module(1) output (#1618803)