cmake-3.22.1

Fixes rhbz#2029974
This commit is contained in:
Björn Esser 2021-12-07 19:26:22 +01:00
parent baa8129dbb
commit 7e2cfc8785
No known key found for this signature in database
GPG Key ID: F52E98007594C21D
4 changed files with 7 additions and 264 deletions

View File

@ -1,222 +0,0 @@
From 3883b11edbb983c72f0d1f2f13ad29fd8a630514 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Thu, 2 Dec 2021 16:45:16 +0000
Subject: [PATCH] Merge topic 'rpath-unrecognized-format' into release-3.22
643fc46bdc file(RPATH): Restore tolerance of unknown formats if new RPATH is empty
5596cba7dc cmSystemTools: Remove unnecessary mark-as-used casts to void
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6779
---
Source/cmSystemTools.cxx | 25 +++++++++++++++++++++----
Tests/RunCMake/file-RPATH/RunCMakeTest.cmake | 11 +++++++++++
Tests/RunCMake/file-RPATH/TextChange-result.txt | 1 +
Tests/RunCMake/file-RPATH/TextChange-stderr.txt | 12 ++++++++++++
Tests/RunCMake/file-RPATH/TextChange.cmake | 3 +++
Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake | 3 +++
Tests/RunCMake/file-RPATH/TextCheck.cmake | 6 ++++++
Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake | 6 ++++++
Tests/RunCMake/file-RPATH/TextRemove.cmake | 3 +++
Tests/RunCMake/file-RPATH/TextSet-result.txt | 1 +
Tests/RunCMake/file-RPATH/TextSet-stderr.txt | 12 ++++++++++++
Tests/RunCMake/file-RPATH/TextSet.cmake | 3 +++
Tests/RunCMake/file-RPATH/TextSetEmpty.cmake | 3 +++
13 files changed, 85 insertions(+), 4 deletions(-)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 75a5a8d878..1934393bb0 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2869,6 +2869,14 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
file, oldRPath, newRPath, removeEnvironmentRPath, emsg, changed)) {
return result.value();
}
+ // The file format is not recognized. Assume it has no RPATH.
+ if (newRPath.empty()) {
+ // The caller wanted no RPATH anyway.
+ return true;
+ }
+ if (emsg) {
+ *emsg = "The file format is not recognized.";
+ }
return false;
}
@@ -2883,6 +2891,14 @@ bool cmSystemTools::SetRPath(std::string const& file,
SetRPathXCOFF(file, newRPath, emsg, changed)) {
return result.value();
}
+ // The file format is not recognized. Assume it has no RPATH.
+ if (newRPath.empty()) {
+ // The caller wanted no RPATH anyway.
+ return true;
+ }
+ if (emsg) {
+ *emsg = "The file format is not recognized.";
+ }
return false;
}
@@ -3212,7 +3228,8 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
if (cm::optional<bool> result = RemoveRPathXCOFF(file, emsg, removed)) {
return result.value();
}
- return false;
+ // The file format is not recognized. Assume it has no RPATH.
+ return true;
}
bool cmSystemTools::CheckRPath(std::string const& file,
@@ -3252,9 +3269,9 @@ bool cmSystemTools::CheckRPath(std::string const& file,
return false;
}
#endif
- (void)file;
- (void)newRPath;
- return false;
+ // The file format is not recognized. Assume it has no RPATH.
+ // Therefore we succeed if the new rpath is empty anyway.
+ return newRPath.empty();
}
bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
index 1ca2e757a6..525df09c3e 100644
--- a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
@@ -5,3 +5,14 @@ run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake)
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake)
endif()
+
+run_cmake_command(TextCheck ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheck.cmake)
+run_cmake_command(TextCheckEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheckEmpty.cmake)
+
+run_cmake_command(TextChange ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChange.cmake)
+run_cmake_command(TextChangeEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChangeEmpty.cmake)
+
+run_cmake_command(TextSet ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSet.cmake)
+run_cmake_command(TextSetEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSetEmpty.cmake)
+
+run_cmake_command(TextRemove ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextRemove.cmake)
diff --git a/Tests/RunCMake/file-RPATH/TextChange-result.txt b/Tests/RunCMake/file-RPATH/TextChange-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-RPATH/TextChange-stderr.txt b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt
new file mode 100644
index 0000000000..48a1bf599f
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Tests/RunCMake/file-RPATH/TextChange.cmake:[0-9]+ \(file\):
+ file RPATH_CHANGE could not write new RPATH:
+
+ /new/rpath
+
+ to the file:
+
+ [^
+]*/Tests/RunCMake/file-RPATH/TextChange-build/not_a_binary.txt
+
+ The file format is not recognized\.$
diff --git a/Tests/RunCMake/file-RPATH/TextChange.cmake b/Tests/RunCMake/file-RPATH/TextChange.cmake
new file mode 100644
index 0000000000..5c599eca27
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "/new/rpath")
diff --git a/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake
new file mode 100644
index 0000000000..8f855d9477
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "")
diff --git a/Tests/RunCMake/file-RPATH/TextCheck.cmake b/Tests/RunCMake/file-RPATH/TextCheck.cmake
new file mode 100644
index 0000000000..1f21ba73cd
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextCheck.cmake
@@ -0,0 +1,6 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHECK FILE "${f}" RPATH "/some/rpath")
+if(EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK did not remove\n ${f}\nfor non-empty RPATH")
+endif()
diff --git a/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake
new file mode 100644
index 0000000000..806c73dae7
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake
@@ -0,0 +1,6 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHECK FILE "${f}" RPATH "")
+if(NOT EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK removed\n ${f}\nfor empty RPATH")
+endif()
diff --git a/Tests/RunCMake/file-RPATH/TextRemove.cmake b/Tests/RunCMake/file-RPATH/TextRemove.cmake
new file mode 100644
index 0000000000..aecaf6f436
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextRemove.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_REMOVE FILE "${f}")
diff --git a/Tests/RunCMake/file-RPATH/TextSet-result.txt b/Tests/RunCMake/file-RPATH/TextSet-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-RPATH/TextSet-stderr.txt b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt
new file mode 100644
index 0000000000..811c9a5bfc
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Tests/RunCMake/file-RPATH/TextSet.cmake:[0-9]+ \(file\):
+ file RPATH_SET could not write new RPATH:
+
+ /new/rpath
+
+ to the file:
+
+ [^
+]*/Tests/RunCMake/file-RPATH/TextSet-build/not_a_binary.txt
+
+ The file format is not recognized\.$
diff --git a/Tests/RunCMake/file-RPATH/TextSet.cmake b/Tests/RunCMake/file-RPATH/TextSet.cmake
new file mode 100644
index 0000000000..f4b09d248c
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_SET FILE "${f}" NEW_RPATH "/new/rpath")
diff --git a/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake
new file mode 100644
index 0000000000..d9517e08c6
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_SET FILE "${f}" NEW_RPATH "")

View File

@ -1,34 +0,0 @@
From 7896991af029d66c9e1692ce18027fafaa0e9bd8 Mon Sep 17 00:00:00 2001
From: Robert Maynard <rmaynard@nvidia.com>
Date: Mon, 29 Nov 2021 13:47:16 -0500
Subject: [PATCH] GNUInstallDirs: Prefer system lib64 over conda lib when
ambiguous
Update logic added by commit ecaca8c129 (GNUInstallDirs now aware of
conda lib directory requirements, 2021-09-08, v3.22.0-rc1~142^2).
When it is ambiguous if we are doing a conda install or a system
install prefer using the system library directory.
Fixes: #22962
---
Modules/GNUInstallDirs.cmake | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 6ca424ad5d..01bd63716c 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -253,7 +253,9 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
elseif(DEFINED ENV{CONDA_PREFIX})
set(conda_prefix "$ENV{CONDA_PREFIX}")
cmake_path(ABSOLUTE_PATH conda_prefix NORMALIZE)
- if("${CMAKE_INSTALL_PREFIX}" STREQUAL conda_prefix)
+ if("${CMAKE_INSTALL_PREFIX}" STREQUAL conda_prefix AND
+ NOT ("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$" OR
+ "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$"))
set(__system_type_for_install "conda")
endif()
endif()
--
GitLab

View File

@ -68,14 +68,14 @@
%{?rcsuf:%global versuf -%{rcsuf}}
# For handling bump release by rpmdev-bumpspec and mass rebuild
%global baserelease 4
%global baserelease 1
# Uncomment if building for EPEL
#global name_suffix %%{major_version}
%global orig_name cmake
Name: %{orig_name}%{?name_suffix}
Version: %{major_version}.%{minor_version}.0
Version: %{major_version}.%{minor_version}.1
Release: %{baserelease}%{?relsuf}%{?dist}
Summary: Cross-platform make system
@ -109,11 +109,6 @@ Patch101: %{name}-fedora-flag_release.patch
# Add dl to CMAKE_DL_LIBS on MINGW
# https://gitlab.kitware.com/cmake/cmake/issues/17600
Patch102: %{name}-mingw-dl.patch
# rhbz#2027118
# https://gitlab.kitware.com/cmake/cmake/-/issues/22962
Patch103: https://gitlab.kitware.com/cmake/cmake/-/commit/7896991af029d66c9e1692ce18027fafaa0e9bd8.patch#/%{name}-3.22.0-rhbz2027118.patch
# https://gitlab.kitware.com/cmake/cmake/-/issues/22963
Patch104: 0001-Merge-topic-rpath-unrecognized-format-into-release-3.patch
# Patch for renaming on EPEL
%if 0%{?name_suffix:1}
@ -531,6 +526,10 @@ popd
%changelog
* Tue Dec 07 2021 Björn Esser <besser82@fedoraproject.org> - 3.22.1-1
- cmake-3.22.1
Fixes rhbz#2029974
* Thu Dec 02 2021 Stephan Bergmann <sbergman@redhat.com> - 3.22.0-4
- Fixes RPATH_CHANGE fails when shared object is a GNU ld script

View File

@ -1 +1 @@
SHA512 (cmake-3.22.0.tar.gz) = 72e4e39bfd0a918572228af68391422979f89a0a5020fae7764b5d7ba86a7a56e8174e22f1b0ffeb37b741c0a6118162a2a47655a03939ea0535453186ed385c
SHA512 (cmake-3.22.1.tar.gz) = b1e900fe573cd1cc76d26386f2298d7722737c9ff67930ee108994972b4561ef69caeb537177c9b95b7f17b755e20e034825d3807ea0d2dd4c391310b03adc11