Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

9 changed files with 63 additions and 185 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/scl-utils-2.0.2.tar.gz
SOURCES/scl-utils-2.0.3.tar.gz

View File

@ -1 +1 @@
25607da2aeb02211be14ff00db41e90b134641e6 SOURCES/scl-utils-2.0.2.tar.gz
db05883cd165823bf3f35cb33624ddc7e0f00d0f SOURCES/scl-utils-2.0.3.tar.gz

View File

@ -1,11 +0,0 @@
--- scl-utils-2.0.2/rpm/macros.scl.old 2019-07-04 09:27:29.887470341 +0200
+++ scl-utils-2.0.2/rpm/macros.scl 2019-07-30 10:24:32.536648421 +0200
@@ -93,7 +93,7 @@
/usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
}
/usr/lib/rpm/brp-strip-static-archive %{__strip}
- /usr/lib/rpm/brp-scl-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} %{_scl_root}
+ /usr/lib/rpm/brp-scl-python-bytecompile %{__python3} %{?_python_bytecompile_errors_terminate_build} %{_scl_root}
/usr/lib/rpm/brp-python-hardlink
%{nil}}
BuildRequires: scl-utils-build

View File

@ -1,76 +0,0 @@
commit 98fe4dcef136eaaa323f1729c11f38b2b19b3a42
Author: Michal Domonkos <mdomonko@redhat.com>
Date: Mon Jan 13 17:04:41 2020 +0100
Adapt env parser to newer module(1) versions. BZ 1618803
With module(1) version 4.x and later (tcl-based), the command
MODULE_CMD sh load <collection>
prints a newline after each export line, breaking our parsing logic in
get_env_vars() which just tokenizes the output by semicolons and does
not anticipate newlines. As a result, we would end up with
"\nKEY=VALUE" pairs and pass them as such to putenv(3) which then has no
effect.
The fix is easy; just strip the leading newline from the KEY=VALUE pairs
if present. This ensures we stay compatible with the older module(1)
versions as well.
A simple reproducer follows:
1) Make scl(1) run in "modulefile" mode by creating a modulefile in
/etc/scl/modulefiles corresponding to a collection, for example:
$ /usr/share/Modules/bin/createmodule.sh /opt/rh/eap7/enable \
> /etc/scl/modulefiles/eap7
2) Run a simple scl(1) command to detect the presence of an env var
that we know should be set in the target collection, for example:
$ scl enable eap7 'echo $LOADEDMODULES'
Previously, there would be no output. With this commit, the output
should be "eap7".
diff --git a/src/scllib.c b/src/scllib.c
index 3c32d65..a182194 100644
--- a/src/scllib.c
+++ b/src/scllib.c
@@ -52,7 +52,7 @@ static scl_rc get_env_vars(const char *colname, char ***_vars)
char *argv[] = {MODULE_CMD, MODULE_CMD, "sh", "add", "", NULL};
char *output = NULL;
int i = 0;
- char **parts, **vars;
+ char **parts, *part, **vars;
scl_rc ret = EOK;
ret = initialize_env();
@@ -73,16 +73,21 @@ static scl_rc get_env_vars(const char *colname, char ***_vars)
* Expected format of string stored in variable output is following:
* var1=value1 ;export value1 ; var2=value2 ;export value2;
* var3=value\ with\ spaces
+ * NOTE: Newer (tcl-based) versions of MODULE_CMD put a newline after each
+ * export command so we need to take that into account.
*/
vars = parts = split(output, ';');
/* Filter out strings without "=" i. e. strings with export. */
- while (*parts != NULL) {
- if (strchr(*parts, '=')) {
- strip_trailing_chars(*parts, ' ');
- unescape_string(*parts);
- vars[i++] = xstrdup(*parts);
+ while (*parts != NULL) {
+ part = *parts;
+ if (part[0] == '\n')
+ part++;
+ if (strchr(part, '=')) {
+ strip_trailing_chars(part, ' ');
+ unescape_string(part);
+ vars[i++] = xstrdup(part);
}
parts++;
}

View File

@ -1,30 +0,0 @@
commit 835ffbb5753036c4b58626869a4f0f5b30945707
Author: Michal Domonkos <mdomonko@redhat.com>
Date: Tue Jul 13 17:01:07 2021 +0200
Print scl_source errors to stderr
Resolves: rhbz#1867135
diff --git a/shell/scl_source b/shell/scl_source
index 30b8baf..c810cb9 100755
--- a/shell/scl_source
+++ b/shell/scl_source
@@ -34,7 +34,7 @@ for arg in "$@"; do
_scl_prefix_file=$_scl_dir/$arg
_scl_prefix=`cat $_scl_prefix_file 2> /dev/null`
if [ $? -ne 0 ]; then
- echo "Can't read $_scl_prefix_file, $arg is probably not installed."
+ echo >&2 "Can't read $_scl_prefix_file, $arg is probably not installed."
return 1
fi
@@ -60,7 +60,7 @@ if [ $_recursion == "false" ]; then
_scl_scriptlet_path="${_scl_prefixes[$_i]}/${_scls[$_i]}/${_scl_scriptlet_name}"
source "$_scl_scriptlet_path"
if [ $? -ne 0 ]; then
- echo "Can't source $_scl_scriptlet_name, skipping."
+ echo >&2 "Can't source $_scl_scriptlet_name, skipping."
else
export X_SCLS="${_scls[$_i]} $X_SCLS"
fi;

View File

@ -1,29 +0,0 @@
From a8113846229a567321ca4347b07263936307b940 Mon Sep 17 00:00:00 2001
From: "James E. Flemer" <james.flemer@ndpgroup.com>
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

View File

@ -102,9 +102,7 @@ mkdir -p %{buildroot}%{_root_sysconfdir}/{rpm,scl/{prefixes,modulefiles}}
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config << EOF
%%%%scl %scl
%{?nfsmountable:%%%%nfsmountable %{nfsmountable}}
%{!?nfsmountable:%%%%undefine nfsmountable}
%{?rh_layout:%%%%rh_layout %{rh_layout}}
%{!?rh_layout:%%%%undefine rh_layout}
EOF
cat >> %{buildroot}%{_root_sysconfdir}/scl/prefixes/%{scl} << EOF
%_scl_prefix

View File

@ -1,35 +1,31 @@
%global __cmake_in_source_build 1
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
Name: scl-utils
Epoch: 1
Version: 2.0.2
Release: 16%{?dist}
Version: 2.0.3
Release: 4%{?dist}
Summary: Utilities for alternative packaging
License: GPLv2+
Group: Applications/File
URL: https://github.com/sclorg/scl-utils
Source0: https://github.com/sclorg/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: macros.scl-filesystem
BuildRequires: gcc make
Buildrequires: cmake
Buildrequires: rpm-devel
BuildRequires: cmake
BuildRequires: rpm-devel
BuildRequires: libcmocka libcmocka-devel environment-modules
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
Patch5: BZ-1867135-print-scl_source-errors-to-stderr.patch
Patch6: BZ-1967686-do-not-error-out-on-SIGINT.patch
Patch7: BZ-2091000-remove-tmp-file.patch
Patch2: BZ-2056462-do-not-error-out-on-SIGINT.patch
Patch3: BZ-2091000-remove-tmp-file.patch
%description
Run-time utility for alternative packaging.
%package build
Summary: RPM build macros for alternative packaging
Group: Applications/File
Requires: iso-codes
Requires: redhat-rpm-config
@ -40,7 +36,7 @@ Essential RPM build macros for alternative packaging.
%autosetup -p1
%build
%cmake
%cmake .
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
@ -59,8 +55,10 @@ mkdir modulefiles
mkdir prefixes
ln -s prefixes conf
%check
make check
%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/scl
%dir %{_sysconfdir}/scl/modulefiles
%dir %{_sysconfdir}/scl/prefixes
@ -76,7 +74,6 @@ ln -s prefixes conf
%doc LICENSE
%files build
%defattr(-,root,root,-)
%{macrosdir}/macros.scl
%{_rpmconfigdir}/scldeps.sh
%{_rpmconfigdir}/fileattrs/scl.attr
@ -85,38 +82,67 @@ ln -s prefixes conf
%{_rpmconfigdir}/brp-scl-python-bytecompile
%changelog
* Tue Dec 13 2022 Florian Festi <ffesti@redhat.com> - 1:2.0.2-16
- Remove tmp file (#2091000)
* Tue Dec 13 2022 Florian Festi <ffesti@redhat.com> - 1:2.0.3-4
- Remove tmp file (#2151261)
* Thu Feb 17 2022 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-15
- Don't error out when command receives SIGINT (#1967686)
* Mon Feb 21 2022 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.3-3
- Don't error out when command receives SIGINT (#2056462)
* Tue Jul 13 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-14
- Print scl_source errors to stderr (#1867135)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1:2.0.3-2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Feb 16 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-13
- Let scl_source behave when -e/errexit is set (#1927971, James E. Flemer)
* Mon Jul 26 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.3-1
- Rebase to 2.0.3 (#1986085)
* Mon Feb 17 2020 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-12
- Adapt env parser to new module(1) output (#1618803)
* Mon Jul 26 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-21
- Own directory /etc/scl (#1986040)
* Fri Aug 16 2019 Pavlina Moravcova Varekova <pmoravco@redhat.com> - 1:2.0.2-11
- reverted sci-utils-build own the pkgconfig directory (#1431962)
* Fri Jul 23 2021 Honza Horak <hhorak@redhat.com> - 1:2.0.2-20
- Fix problem with python version in the byte compilation script (#1984598)
* Tue Jul 30 2019 Pavlina Moravcova Varekova <pmoravco@redhat.com> - 1:2.0.2-10
- use %%__python3 instead of macro %%__python (#1733526)
- corrected unescaped per-cent character in the changelog (#1734103)
* Wed May 12 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-19
- Fix dist tag syntax (#1958982)
* Tue Jul 02 2019 Pavlina Moravcova Varekova <pmoravco@redhat.com> - 1:2.0.2-9
- use %%{?dist} instead of %%{dist} (#1725774)
- scl-utils-build own the pkgconfig directory by %%scl_files (#1431962)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:2.0.2-18
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed May 22 2019 Pavlina Moravcova Varekova <pmoravco@redhat.com> - 1:2.0.2-8
- Own directory /etc/scl (#1616405)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Vitaly Zaitsev <vitaly@easycoding.org> - 1:2.0.2-16
- Backported upstream patches to resolve RHBZ#1728450.
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 24 2020 Jeff Law <law@redhat.com> - 1:2.0.2-14
- Use __cmake_in_source_build
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Aug 22 2019 Remi Collet <remi@remirepo.net> - 1:2.0.2-12
- Fix error: macro %%undefine is a built-in #1744583
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jun 10 22:13:23 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:2.0.2-10
- Rebuild for RPM 4.15
* Mon Jun 10 15:42:05 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:2.0.2-9
- Rebuild for RPM 4.15
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Jul 24 2018 Vít Ondruch <vondruch@redhat.com> - 1:2.0.2-7
- Don't enforce modulefile ownership.
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Feb 19 2018 Panu Matilainen <pmatilai@redhat.com> - 1:2.0.2-5
- Explicitly BuildRequire gcc and make