Rebase to 2.0.3

add patch to fix brp-python-hardlink path
use SPDX license ID
run upstream tests
This commit is contained in:
Remi Collet 2023-08-23 11:12:04 +02:00
parent 70ca0968e9
commit 605f46cf49
8 changed files with 132 additions and 92 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/scl-utils-2.0.1.tar.bz2 /scl-utils-2.0.1.tar.bz2
/scl-utils-2.0.2.tar.bz2 /scl-utils-2.0.2.tar.bz2
/scl-utils-2.0.2.tar.gz /scl-utils-2.0.2.tar.gz
/scl-utils-2.0.3.tar.gz

View File

@ -0,0 +1,61 @@
From 9147d3b66e0a263c2eb427b7892b34c925363854 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Thu, 17 Feb 2022 17:36:00 +0100
Subject: [PATCH] Don't error out when command receives SIGINT
Interrupting a running command isn't really an execution problem so
don't print an error or return a non-zero exit status.
This is also how it worked in versions older than 2.0.
Resolves: rhbz#1967686
---
src/fallback.c | 3 +++
src/scllib.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/fallback.c b/src/fallback.c
index 4b9c8fd..c907a34 100644
--- a/src/fallback.c
+++ b/src/fallback.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <signal.h>
#include "scllib.h"
#include "sclmalloc.h"
@@ -229,6 +230,8 @@ scl_rc fallback_run_command(char * const colnames[], const char *cmd, bool exec)
xasprintf(&bash_cmd, "/bin/bash %s", tmp);
status = system(bash_cmd);
if (status == -1 || !WIFEXITED(status)) {
+ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
+ goto exit;
debug("Problem with executing command \"%s\"\n", bash_cmd);
ret = ERUN;
goto exit;
diff --git a/src/scllib.c b/src/scllib.c
index a182194..2ba8df8 100644
--- a/src/scllib.c
+++ b/src/scllib.c
@@ -11,6 +11,7 @@
#include <rpm/rpmcli.h>
#include <errno.h>
#include <wordexp.h>
+#include <signal.h>
#include "config.h"
#include "errors.h"
@@ -341,6 +342,8 @@ scl_rc run_command(char * const colnames[], const char *cmd, bool exec)
status = system(cmd);
if (status == -1 || !WIFEXITED(status)) {
+ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
+ goto exit;
debug("Problem with executing program \"%s\"\n", cmd);
ret = ERUN;
goto exit;
--
2.35.1

View File

@ -0,0 +1,21 @@
From 864844ecc11f8cf65cd97bcffdb803211f7edaa4 Mon Sep 17 00:00:00 2001
From: Piotr Wilkosz <piotr.wilkosz@gmail.com>
Date: Mon, 23 May 2022 16:14:13 +0200
Subject: [PATCH] remove tmp file at exit
---
src/fallback.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/fallback.c b/src/fallback.c
index c907a34..e67654a 100644
--- a/src/fallback.c
+++ b/src/fallback.c
@@ -246,6 +246,7 @@ scl_rc fallback_run_command(char * const colnames[], const char *cmd, bool exec)
enable_path = _free(enable_path);
colpath = _free(colpath);
bash_cmd = _free(bash_cmd);
+ unlink(tmp);
return ret;
}

29
brp-python-hardlink.patch Normal file
View File

@ -0,0 +1,29 @@
From e75f3f522f34e1cdd19852763363dd8b503e305e Mon Sep 17 00:00:00 2001
From: Michal Nowak <mnowak@isc.org>
Date: Tue, 7 Dec 2021 17:35:01 +0100
Subject: [PATCH] Update brp-python-hardlink path
Since Fedora 35 "brp-python-hardlink" script is in /usr/lib/rpm/redhat/.
Otherwise RPM build fails with:
+ /usr/lib/rpm/brp-python-hardlink
/var/tmp/rpm-tmp.VsVGRP: line 312: /usr/lib/rpm/brp-python-hardlink: No such file or directory
Fixes #42
---
rpm/macros.scl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpm/macros.scl b/rpm/macros.scl
index f1ee5f2..0d27a6b 100644
--- a/rpm/macros.scl
+++ b/rpm/macros.scl
@@ -91,7 +91,7 @@ package or when debugging this package.
}
/usr/lib/rpm/brp-strip-static-archive %{__strip}
/usr/lib/rpm/brp-scl-python-bytecompile %{__python3} %{?_python_bytecompile_errors_terminate_build} %{_scl_root}
- /usr/lib/rpm/brp-python-hardlink
+ [ -f /usr/lib/rpm/redhat/brp-python-hardlink ] && /usr/lib/rpm/redhat/brp-python-hardlink || /usr/lib/rpm/brp-python-hardlink
%{nil}}
BuildRequires: scl-utils-build
%if "%{?scl}%{!?scl:0}" == "%{pkg_name}"

View File

@ -1,54 +0,0 @@
From 3538686a21279c60c916e82ece02efcd88ae95b9 Mon Sep 17 00:00:00 2001
From: Joe Orton <jorton@redhat.com>
Date: Thu, 8 Aug 2019 09:26:00 +0100
Subject: [PATCH] Fix crashes in "scl list-enabled":
* src/lib_common.c (merge_string_arrays):
Ensure elements of returned array are strdup()ed.
* src/scllib.c (get_enabled_collections):
Ensure all elements of returned array are strdup()ed.
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1728450
---
src/lib_common.c | 5 +++++
src/scllib.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lib_common.c b/src/lib_common.c
index 1aa49a0..2e7d116 100644
--- a/src/lib_common.c
+++ b/src/lib_common.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <wordexp.h>
+#include <assert.h>
#include "errors.h"
#include "scllib.h"
@@ -269,6 +270,10 @@ char **merge_string_arrays(char *const *array1, char *const *array2)
}
merged_array[++prev] = NULL;
+ for (int i = 0; i < prev; i++) {
+ merged_array[i] = xstrdup(merged_array[i]);
+ }
+
return merged_array;
}
diff --git a/src/scllib.c b/src/scllib.c
index ce8df90..3c32d65 100644
--- a/src/scllib.c
+++ b/src/scllib.c
@@ -107,8 +107,8 @@ scl_rc get_enabled_collections(char ***_enabled_collections)
sizeof(SCL_MODULES_PATH - 1))){
enabled_collections[i] += sizeof(SCL_MODULES_PATH);
- enabled_collections[i] = xstrdup(enabled_collections[i]);
}
+ enabled_collections[i] = xstrdup(enabled_collections[i]);
}
}

View File

@ -1,25 +0,0 @@
commit c529964024850038f142f0a93c6c343bb910641f
Author: Michal Nowak <mnowak@isc.org>
Date: Tue Dec 7 17:35:01 2021 +0100
Update brp-python-hardlink path
Since Fedora 35 "brp-python-hardlink" script is in /usr/lib/rpm/redhat/.
Otherwise RPM build fails with:
+ /usr/lib/rpm/brp-python-hardlink
/var/tmp/rpm-tmp.VsVGRP: line 312: /usr/lib/rpm/brp-python-hardlink: No such file or directory
diff --git a/rpm/macros.scl b/rpm/macros.scl
index 550243e..c007cfd 100644
--- a/rpm/macros.scl
+++ b/rpm/macros.scl
@@ -91,7 +91,7 @@ package or when debugging this package.
}
/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-python-hardlink
+ [ -f /usr/lib/rpm/redhat/brp-python-hardlink ] && /usr/lib/rpm/redhat/brp-python-hardlink || /usr/lib/rpm/brp-python-hardlink
%{nil}}
BuildRequires: scl-utils-build
%if "%{?scl}%{!?scl:0}" == "%{pkg_name}"

View File

@ -3,25 +3,24 @@
Name: scl-utils Name: scl-utils
Epoch: 1 Epoch: 1
Version: 2.0.2 Version: 2.0.3
Release: 24%{dist} Release: 1%{dist}
Summary: Utilities for alternative packaging Summary: Utilities for alternative packaging
License: GPLv2+ License: GPL-2.0-or-later
URL: https://github.com/sclorg/scl-utils URL: https://github.com/sclorg/scl-utils
Source0: https://github.com/sclorg/%{name}/archive/%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/sclorg/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: macros.scl-filesystem Source1: macros.scl-filesystem
BuildRequires: gcc make BuildRequires: gcc make
Buildrequires: cmake BuildRequires: cmake
Buildrequires: rpm-devel BuildRequires: rpm-devel
BuildRequires: libcmocka libcmocka-devel environment-modules
Requires: %{_bindir}/modulecmd Requires: %{_bindir}/modulecmd
Patch1: 0003-Scl-utils-layout-patch-from-fedora-famillecollet.com.patch Patch1: 0003-Scl-utils-layout-patch-from-fedora-famillecollet.com.patch
Patch2: BZ-2056462-do-not-error-out-on-SIGINT.patch
# https://github.com/sclorg/scl-utils/pull/25 Patch3: BZ-2091000-remove-tmp-file.patch
Patch100: scl-utils-2.0.2-rhbz-1728450.patch Patch4: brp-python-hardlink.patch
# https://github.com/sclorg/scl-utils/pull/43
Patch101: scl-utils-2.0.2-rhbz-2029959.patch
%description %description
Run-time utility for alternative packaging. Run-time utility for alternative packaging.
@ -41,9 +40,7 @@ Essential RPM build macros for alternative packaging.
%cmake . %cmake .
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
%install %install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
if [ %{macrosdir} != %{_sysconfdir}/rpm ]; then if [ %{macrosdir} != %{_sysconfdir}/rpm ]; then
mkdir -p %{buildroot}%{macrosdir} mkdir -p %{buildroot}%{macrosdir}
@ -57,7 +54,11 @@ mkdir modulefiles
mkdir prefixes mkdir prefixes
ln -s prefixes conf ln -s prefixes conf
%check
make check
%files %files
%dir %{_sysconfdir}/scl
%dir %{_sysconfdir}/scl/modulefiles %dir %{_sysconfdir}/scl/modulefiles
%dir %{_sysconfdir}/scl/prefixes %dir %{_sysconfdir}/scl/prefixes
%{_sysconfdir}/scl/conf %{_sysconfdir}/scl/conf
@ -80,6 +81,12 @@ ln -s prefixes conf
%{_rpmconfigdir}/brp-scl-python-bytecompile %{_rpmconfigdir}/brp-scl-python-bytecompile
%changelog %changelog
* Wed Aug 23 2023 Remi Collet <remi@remirepo/net> - 1:2.0.3-1
- Rebase to 2.0.3
- add upstream patch to fix brp-python-hardlink path
- use SPDX license ID
- run upstream tests
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-24 * Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.2-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (scl-utils-2.0.2.tar.gz) = 87a89942060c7103c5ff5b1c870ce9b8f82538da96849306b9c3ce8ff13754a3a43273fde4830e618b1b6ecdf834cadf8949eab337016092b6a520f23d8babff SHA512 (scl-utils-2.0.3.tar.gz) = 3d18a435003d37264afbbac83c1cbd533b76b44661f613ac9e28f8ed1c08b00cda90e567573711fc8f101174d8937ddab320961b1da4fbdfa137a1f50c3f4486