Fix couple of unrelated regressions (#2229984, #2233454)

- a regression on uncompressing 7zip compressed sources (#2229984)
- a conflict with pre-existing scl-utils %_root_prefix macro (#2233454)
This commit is contained in:
Panu Matilainen 2023-08-22 14:24:34 +03:00
parent 88f6201129
commit 033b63dfde
5 changed files with 253 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 24f974cff9e9559f3ab308661572740ea432f2a3 Mon Sep 17 00:00:00 2001
Message-ID: <24f974cff9e9559f3ab308661572740ea432f2a3.1692703067.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 22 Aug 2023 13:42:27 +0300
Subject: [PATCH] Revert recent %_root_prefix macro addition (RhBug:2233454)
Commit cececfb6851234aca3e8d102de1c192c6bdf3e67 introduced %_root_prefix
macro but this clashes with pre-existing use in scl-utils:
https://bugzilla.redhat.com/show_bug.cgi?id=223345:
Just query the value from pkg-config if available and otherwise use
hardcoded value pointing to /usr instead. We don't need an intermediate
global macro for this.
---
CMakeLists.txt | 6 +++++-
macros.in | 3 +--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e40e889f6..9ff85fa99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,11 @@ function(makemacros)
set(infodir "\${prefix}/${CMAKE_INSTALL_INFODIR}")
set(mandir "\${prefix}/${CMAKE_INSTALL_MANDIR}")
set(rundir /run)
- set(root_prefix /usr)
+
+ pkg_get_variable(sysusersdir systemd sysusersdir)
+ if (NOT sysusersdir)
+ set(sysusersdir /usr/lib/sysusers.d)
+ endif()
findutil(__7ZIP "7za;7z")
findutil(__BZIP2 bzip2)
diff --git a/macros.in b/macros.in
index 070aa8348..175e475e7 100644
--- a/macros.in
+++ b/macros.in
@@ -957,7 +957,6 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
# Macro(s) slavishly copied from autoconf's config.status.
#
%_prefix @prefix@
-%_root_prefix @root_prefix@
%_exec_prefix %{_prefix}
%_bindir %{_exec_prefix}/bin
%_sbindir %{_exec_prefix}/sbin
@@ -971,7 +970,7 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
%_includedir %{_prefix}/include
%_infodir %{_datadir}/info
%_mandir %{_datadir}/man
-%_sysusersdir %{_root_prefix}/lib/sysusers.d
+%_sysusersdir @sysusersdir@
#==============================================================================
# ---- config.guess platform macros.
--
2.41.0

View File

@ -0,0 +1,114 @@
From bbb289e303d8c72b9e35410e593b8d92b006bec1 Mon Sep 17 00:00:00 2001
Message-ID: <bbb289e303d8c72b9e35410e593b8d92b006bec1.1692703597.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 14 Aug 2023 12:29:11 +0300
Subject: [PATCH 1/3] Unroll the utility finding loop in cmake for flexibility
+ readability
We need more flexibility than a simple array can provide, and with
all the name munging, it's not particularly obvious as to what
values are set and how. Supposedly no functional changes here.
---
CMakeLists.txt | 79 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 57 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1de88245c..30f413028 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,22 @@ include(GNUInstallDirs)
add_compile_definitions(_GNU_SOURCE)
add_definitions(-D_FILE_OFFSET_BITS=64)
+function(findutil UTIL TRY)
+ list(GET TRY 0 util)
+ find_program(${UTIL}
+ NAMES ${TRY}
+ PATHS ENV MYPATH
+ PATHS /usr/local/bin /usr/bin /bin
+ PATHS /usr/local/sbin /usr/sbin /sbin
+ NO_DEFAULT_PATH
+ )
+ if (NOT ${UTIL})
+ list(GET TRY 0 util)
+ message(DEBUG "${util} not found, assuming /usr/bin/${util}")
+ set(${UTIL} /usr/bin/${util} PARENT_SCOPE)
+ endif()
+endfunction()
+
function(makemacros)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
@@ -72,28 +88,47 @@ function(makemacros)
set(rundir /run)
set(root_prefix /usr)
- set(extutils
- 7zip bzip2 cat chmod chown cp curl file gpg grep gzip id cc ln
- install lrzip lzip xz make mkdir mv patch rm sed tar unzip
- zstd gem git hg bzr quilt ld objdump strip systemd-sysusers
- awk ar as cpp c++
- )
- foreach (util ${extutils})
- string(TOUPPER ${util} UTIL)
- string(REPLACE "-" "_" UTIL ${UTIL})
- string(REPLACE "+" "X" UTIL ${UTIL})
- find_program(__${UTIL} ${util}
- PATHS ENV MYPATH
- PATHS /usr/local/bin /usr/bin /bin
- PATHS /usr/local/sbin /usr/sbin /sbin
- NO_DEFAULT_PATH
- )
- message(INFO ${util} " got " ${UTIL} ": " ${__${UTIL}})
- if (NOT EXISTS ${__${UTIL}})
- message(DEBUG "${util} not found, assuming /usr/bin")
- set(__${UTIL} /usr/bin/${util})
- endif()
- endforeach()
+ findutil(__7ZIP 7zip)
+ findutil(__BZIP2 bzip2)
+ findutil(__CAT cat)
+ findutil(__CHMOD chmod)
+ findutil(__CHOWN chown)
+ findutil(__CP cp)
+ findutil(__CURL curl)
+ findutil(__FILE file)
+ findutil(__GPG gpg)
+ findutil(__GREP grep)
+ findutil(__GZIP gzip)
+ findutil(__ID id)
+ findutil(__CC cc)
+ findutil(__LN ln)
+ findutil(__INSTALL install)
+ findutil(__LRZIP lrzip)
+ findutil(__LZIP lzip)
+ findutil(__XZ xz)
+ findutil(__MAKE make)
+ findutil(__MKDIR mkdir)
+ findutil(__MV mv)
+ findutil(__PATCH patch)
+ findutil(__RM rm)
+ findutil(__SED sed)
+ findutil(__TAR tar)
+ findutil(__UNZIP unzip)
+ findutil(__ZSTD zstd)
+ findutil(__GEM gem)
+ findutil(__GIT git)
+ findutil(__HG hg)
+ findutil(__BZR bzr)
+ findutil(__QUILT quilt)
+ findutil(__LD ld)
+ findutil(__OBJDUMP objdump)
+ findutil(__STRIP strip)
+ findutil(__SYSTEMD_SYSUSERS systemd-sysusers)
+ findutil(__AWK awk)
+ findutil(__AR ar)
+ findutil(__AS as)
+ findutil(__CPP cpp)
+ findutil(__CXX c++)
list(GET db_backends 0 DB_BACKEND)
--
2.41.0

View File

@ -0,0 +1,34 @@
From f9775b454e1969a8d5c8d8b7435817876ed79482 Mon Sep 17 00:00:00 2001
Message-ID: <f9775b454e1969a8d5c8d8b7435817876ed79482.1692703597.git.pmatilai@redhat.com>
In-Reply-To: <bbb289e303d8c72b9e35410e593b8d92b006bec1.1692703597.git.pmatilai@redhat.com>
References: <bbb289e303d8c72b9e35410e593b8d92b006bec1.1692703597.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 14 Aug 2023 12:31:06 +0300
Subject: [PATCH 2/3] Look for alternative implementations of 7zip, like
autoconf did
Fixes a regression from the cmake transition where we'd just assume 7zip
as the name of the executable when previously we looked through 7zip,
7za and 7a. Resume the former behavior.
Fixes: #2608
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30f413028..55c1d2169 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,7 @@ function(makemacros)
set(rundir /run)
set(root_prefix /usr)
- findutil(__7ZIP 7zip)
+ findutil(__7ZIP "7zip;7za;7z")
findutil(__BZIP2 bzip2)
findutil(__CAT cat)
findutil(__CHMOD chmod)
--
2.41.0

View File

@ -0,0 +1,37 @@
From 095502dc0933731eb5a8e877e1c383b8c5e7af44 Mon Sep 17 00:00:00 2001
Message-ID: <095502dc0933731eb5a8e877e1c383b8c5e7af44.1692703597.git.pmatilai@redhat.com>
In-Reply-To: <bbb289e303d8c72b9e35410e593b8d92b006bec1.1692703597.git.pmatilai@redhat.com>
References: <bbb289e303d8c72b9e35410e593b8d92b006bec1.1692703597.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 16 Aug 2023 10:18:20 +0300
Subject: [PATCH 3/3] Stop looking for apparently non-existent 7zip command
Since the initial commit 185596818f763af1249f19161f38134ee93092d2, we've
primarily looked for a command named "7zip" but defaulted to 7za when
not found. Looking closer it seems that there never was any command
called 7zip at all, at least in the OSS landscape. So don't default to
something that doesn't even exist, which also means we'll land on an
actually working value if/when 7z[a] doesn't happen to be present at
build-time (there's no other reason for it to be there).
Related to #2608
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55c1d2169..e40e889f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,7 @@ function(makemacros)
set(rundir /run)
set(root_prefix /usr)
- findutil(__7ZIP "7zip;7za;7z")
+ findutil(__7ZIP "7za;7z")
findutil(__BZIP2 bzip2)
findutil(__CAT cat)
findutil(__CHMOD chmod)
--
2.41.0

View File

@ -27,7 +27,7 @@
%global rpmver 4.18.92 %global rpmver 4.18.92
#global snapver rc1 #global snapver rc1
%global baserelease 2 %global baserelease 3
%global sover 10 %global sover 10
%global srcver %{rpmver}%{?snapver:-%{snapver}} %global srcver %{rpmver}%{?snapver:-%{snapver}}
@ -140,6 +140,10 @@ rpm-4.18.90-weak-user-group.patch
# Patches already upstream: # Patches already upstream:
0001-Behave-more-consistently-when-target-arch-optflags-a.patch 0001-Behave-more-consistently-when-target-arch-optflags-a.patch
0001-Unroll-the-utility-finding-loop-in-cmake-for-flexibi.patch
0002-Look-for-alternative-implementations-of-7zip-like-au.patch
0003-Stop-looking-for-apparently-non-existent-7zip-comman.patch
0001-Revert-recent-_root_prefix-macro-addition-RhBug-2233.patch
# ... # ...
# These are not yet upstream # These are not yet upstream
@ -613,6 +617,10 @@ fi
%doc %{_defaultdocdir}/rpm/API/ %doc %{_defaultdocdir}/rpm/API/
%changelog %changelog
* Tue Aug 22 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.92-3
- Fix regression on uncompressing 7zip compressed sources (#2229984)
- Fix a conflict with pre-existing scl-utils %_root_prefix macro (#2233454)
* Mon Aug 21 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.92-2 * Mon Aug 21 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.92-2
- Behave more consistently when target %%optflags are not defined (#2231727) - Behave more consistently when target %%optflags are not defined (#2231727)