1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-12 03:00:28 +00:00

devel/cmake: fix CPack .pkg support, jump to 3.21.3

Update the patch for FreeBSD .pkg support in CPack to handle
libpkg 1.17 and later's use of .pkg as package-suffix rather
than .tgz. The PR below refers to this fix. I've kept code
for older libpkg in case there are systems with weirdly
mismatched current CMake and last-quarter's libpkg.

The patch is still being upstreamed. The PR mentioned below
is for this fix.

While here, update to 3.21.3.  I've decided to -- unusual,
for sure -- bump CMake without the usual exp-run, because:

A regression in CMake 3.21.2 prompted a quick release of
3.21.3 from upstream. The regression applies to the AMD ROCm
platform, so that's not us. Other fixes in 3.21.3 apply to supported
MSVC versions -- again, not us.

There is new support for Boost 1.77 -- not in our ports yet.

In other words, the git diff on CMake sources does not show
anything that could affect us (famous last words). Release notes are at
	https://cmake.org/cmake/help/v3.21/release/3.21.html#id3

PR:		257615
Reported by:	Peter Laursen
This commit is contained in:
Adriaan de Groot 2021-09-21 11:16:05 +02:00
parent 170cb07fe4
commit aeb5f9cf18
6 changed files with 53 additions and 33 deletions

View File

@ -1,5 +1,5 @@
PORTNAME= cmake
DISTVERSION= 3.21.2
DISTVERSION= 3.21.3
CATEGORIES= devel
MASTER_SITES= https://www.cmake.org/files/v${PORTVERSION:R}/
PKGNAMESUFFIX= -doc

View File

@ -1,5 +1,5 @@
PORTNAME= cmake
DISTVERSION= 3.21.2
DISTVERSION= 3.21.3
CATEGORIES= devel
MASTER_SITES= https://www.cmake.org/files/v${PORTVERSION:R}/
PKGNAMESUFFIX= -gui

View File

@ -2,7 +2,7 @@
PORTNAME= cmake
# Remember to update devel/cmake-doc and devel/cmake-gui as well.
DISTVERSION= 3.21.2
DISTVERSION= 3.21.3
CATEGORIES= devel
MASTER_SITES= https://github.com/Kitware/CMake/releases/download/v${DISTVERSION}/ \
https://www.cmake.org/files/v${PORTVERSION}/

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1631212166
SHA256 (cmake-3.21.2.tar.gz) = 94275e0b61c84bb42710f5320a23c6dcb2c6ee032ae7d2a616f53f68b3d21659
SIZE (cmake-3.21.2.tar.gz) = 9630492
TIMESTAMP = 1632174000
SHA256 (cmake-3.21.3.tar.gz) = d14d06df4265134ee42c4d50f5a60cb8b471b7b6a47da8e5d914d49dd783794f
SIZE (cmake-3.21.3.tar.gz) = 9630442

View File

@ -1,4 +1,6 @@
--- Modules/Internal/CPack/CPackFreeBSD.cmake.orig 2021-03-23 15:43:17 UTC
diff --git Modules/Internal/CPack/CPackFreeBSD.cmake Modules/Internal/CPack/CPackFreeBSD.cmake
index ae40532017..c35089cbcf 100644
--- Modules/Internal/CPack/CPackFreeBSD.cmake
+++ Modules/Internal/CPack/CPackFreeBSD.cmake
@@ -34,7 +34,7 @@ function(_cpack_freebsd_fallback_var OUTPUT_VAR_NAME)
endif()
@ -9,23 +11,28 @@
endif()
endfunction()
--- Source/CPack/cmCPackFreeBSDGenerator.cxx.orig 2021-03-23 15:43:17 UTC
diff --git Source/CPack/cmCPackFreeBSDGenerator.cxx Source/CPack/cmCPackFreeBSDGenerator.cxx
index 39ec3c83ed..c09989ceed 100644
--- Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -21,8 +21,12 @@
@@ -21,8 +21,15 @@
#include <sys/stat.h>
+// Suffix including the '.', used to tell libpkg what compression to use
+static const char FreeBSDPackageSuffix[] = ".txz";
+// Suffix used to tell libpkg what compression to use
+static const char FreeBSDPackageCompression[] = "txz";
+// Resulting package file-suffix, for < 1.17 and >= 1.17 versions of libpkg
+static const char FreeBSDPackageSuffix_10[] = ".txz";
+static const char FreeBSDPackageSuffix_17[] = ".pkg";
+
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr", ".txz")
+ : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr",
+ FreeBSDPackageSuffix)
+ FreeBSDPackageSuffix_17 /* old-style, updated if an old-style package is created */)
{
}
@@ -35,6 +39,56 @@ int cmCPackFreeBSDGenerator::InitializeInternal()
@@ -35,6 +42,56 @@ int cmCPackFreeBSDGenerator::InitializeInternal()
cmCPackFreeBSDGenerator::~cmCPackFreeBSDGenerator() = default;
@ -51,7 +58,7 @@
+
+ {
+ if (d) {
+ pkg_create_set_format(d, FreeBSDPackageSuffix + 1); // Skip over the '.'
+ pkg_create_set_format(d, FreeBSDPackageCompression); // Skip over the '.'
+ pkg_create_set_compression_level(d, 0); // Explicitly set default
+ pkg_create_set_overwrite(d, false);
+ pkg_create_set_rootdir(d, toplevel_dir.c_str());
@ -82,7 +89,7 @@
// This is a wrapper, for use only in stream-based output,
// that will output a string in UCL escaped fashion (in particular,
// quotes and backslashes are escaped). The list of characters
@@ -271,7 +325,7 @@ void write_manifest_files(cmGeneratedFileStream& s,
@@ -271,7 +328,7 @@ void write_manifest_files(cmGeneratedFileStream& s,
s << "\"files\": {\n";
for (std::string const& file : files) {
s << " \"/" << cmSystemTools::RelativePath(toplevel, file) << "\": \""
@ -91,7 +98,7 @@
<< "\",\n";
}
s << " },\n";
@@ -281,11 +335,10 @@ int cmCPackFreeBSDGenerator::PackageFiles()
@@ -281,11 +338,10 @@ int cmCPackFreeBSDGenerator::PackageFiles()
{
if (!this->ReadListFile("Internal/CPack/CPackFreeBSD.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@ -104,7 +111,7 @@
cmWorkingDirectory wd(toplevel);
files.erase(std::remove_if(files.begin(), files.end(), ignore_file),
@@ -317,17 +370,59 @@ int cmCPackFreeBSDGenerator::PackageFiles()
@@ -317,20 +373,79 @@ int cmCPackFreeBSDGenerator::PackageFiles()
ONE_PACKAGE_PER_COMPONENT);
}
@ -125,7 +132,7 @@
+ ? std::string(currentPackage, 0, lastSlash + 1)
+ : std::string()) +
+ var_lookup("CPACK_FREEBSD_PACKAGE_NAME") + '-' +
+ var_lookup("CPACK_FREEBSD_PACKAGE_VERSION") + FreeBSDPackageSuffix;
+ var_lookup("CPACK_FREEBSD_PACKAGE_VERSION") + FreeBSDPackageSuffix_17;
+
+ this->packageFileNames.clear();
+ this->packageFileNames.emplace_back(actualPackage);
@ -156,15 +163,38 @@
+ return 0;
+ }
std::string broken_suffix =
- std::string broken_suffix =
- cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), ".txz");
+ cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), FreeBSDPackageSuffix);
+ // Specifically looking for packages suffixed with the TAG, either extension
+ std::string broken_suffix_10 =
+ cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), FreeBSDPackageSuffix_10);
+ std::string broken_suffix_17 =
+ cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), FreeBSDPackageSuffix_17);
for (std::string& name : packageFileNames) {
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Packagefile " << name << std::endl);
if (cmHasSuffix(name, broken_suffix)) {
name.replace(name.size() - broken_suffix.size(), std::string::npos,
- if (cmHasSuffix(name, broken_suffix)) {
- name.replace(name.size() - broken_suffix.size(), std::string::npos,
- ".txz");
+ FreeBSDPackageSuffix);
+ if (cmHasSuffix(name, broken_suffix_10)) {
+ name.replace(name.size() - broken_suffix_10.size(), std::string::npos,
+ FreeBSDPackageSuffix_10);
+ break;
+ }
+ if (cmHasSuffix(name, broken_suffix_17)) {
+ name.replace(name.size() - broken_suffix_17.size(), std::string::npos,
+ FreeBSDPackageSuffix_17);
break;
}
}
+ // If the name uses a *new* style name, which doesn't exist, but there
+ // is an *old* style name, then use that instead. This indicates we used
+ // an older libpkg, which still creates .txz instead of .pkg files.
+ for (std::string& name : packageFileNames) {
+ if (cmHasSuffix(name, FreeBSDPackageSuffix_17) && !cmSystemTools::FileExists(name)) {
+ const std::string suffix(FreeBSDPackageSuffix_17);
+ name.replace(name.size() - suffix.size(), std::string::npos, suffix);
+ }
+ }
return 1;
}

View File

@ -1933,7 +1933,6 @@ share/bash-completion/completions/ctest
%%DATADIR%%/Modules/CMakeHIPCompilerABI.hip
%%DATADIR%%/Modules/CMakeHIPCompilerId.hip.in
%%DATADIR%%/Modules/CMakeHIPInformation.cmake
%%DATADIR%%/Modules/CMakeHIPRuntime.cmake.in
%%DATADIR%%/Modules/CMakeIOSInstallCombined.cmake
%%DATADIR%%/Modules/CMakeISPCCompiler.cmake.in
%%DATADIR%%/Modules/CMakeISPCCompilerABI.ispc
@ -2201,15 +2200,6 @@ share/bash-completion/completions/ctest
%%DATADIR%%/Modules/Compiler/QCC-CXX-FeatureTests.cmake
%%DATADIR%%/Modules/Compiler/QCC-CXX.cmake
%%DATADIR%%/Modules/Compiler/QCC.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-ASM.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-C.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-CXX.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-DetermineCompiler.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-FindBinUtils.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-HIP.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-OBJC.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang-OBJCXX.cmake
%%DATADIR%%/Modules/Compiler/ROCMClang.cmake
%%DATADIR%%/Modules/Compiler/SCO-C.cmake
%%DATADIR%%/Modules/Compiler/SCO-CXX.cmake
%%DATADIR%%/Modules/Compiler/SCO-DetermineCompiler.cmake