From 5fa5bde5d63c9a5303461d038a4ab55b1bb76b51 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:24 +0200 Subject: cmCryptoHash: Add function which gets the hash type name --- Source/cmCryptoHash.cxx | 33 +++++++++++++++++++++++++++++++++ Source/cmCryptoHash.h | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index ff9ab0f..55e3a5b 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCryptoHash.h" +#include + #include #include @@ -80,6 +82,37 @@ std::unique_ptr cmCryptoHash::New(cm::string_view algo) return std::unique_ptr(nullptr); } +std::string cmCryptoHash::GetHashAlgoName() const +{ +#ifndef CMAKE_USE_SYSTEM_LIBRHASH + static_assert(RHASH_HASH_COUNT == 10, "Update switch statement!"); +#endif + switch (this->Id) { + case RHASH_MD5: + return "MD5"; + case RHASH_SHA1: + return "SHA1"; + case RHASH_SHA224: + return "SHA224"; + case RHASH_SHA256: + return "SHA256"; + case RHASH_SHA384: + return "SHA384"; + case RHASH_SHA512: + return "SHA512"; + case RHASH_SHA3_224: + return "SHA3_224"; + case RHASH_SHA3_256: + return "SHA3_256"; + case RHASH_SHA3_384: + return "SHA3_384"; + case RHASH_SHA3_512: + return "SHA3_512"; + } + assert(false); + return "UNKNOWN"; +} + bool cmCryptoHash::IntFromHexDigit(char input, char& output) { if (input >= '0' && input <= '9') { diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index a2d45e7..bb026a2 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -74,6 +74,10 @@ public: /// An empty string otherwise. std::string HashFile(const std::string& file); + /// @brief Returns the name of the hash type. + /// @return The name of the hash type associated with this hash generator. + std::string GetHashAlgoName() const; + void Initialize(); void Append(void const*, size_t); void Append(cm::string_view input); -- cgit v0.12 From d488efa0b48479e1912f9232fef2f71ce4bd65f4 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Refactor generation of checksum file into own function --- Source/CPack/cmCPackGenerator.cxx | 32 ++++++++++++++++++++------------ Source/CPack/cmCPackGenerator.h | 4 ++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6889656..38aa2ba 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -974,6 +974,25 @@ int cmCPackGenerator::InstallCMakeProject( return 1; } +bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto, + cm::string_view filename) const +{ + std::string packageFileName = + cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename); + std::string hashFile = cmStrCat( + packageFileName, "." + cmSystemTools::LowerCase(crypto.GetHashAlgoName())); + cmsys::ofstream outF(hashFile.c_str()); + if (!outF) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot create checksum file: " << hashFile << std::endl); + return false; + } + outF << crypto.HashFile(packageFileName) << " " << filename << "\n"; + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- checksum file: " << hashFile << " generated." << std::endl); + return true; +} + bool cmCPackGenerator::ReadListFile(const char* moduleName) { bool retval; @@ -1177,20 +1196,9 @@ int cmCPackGenerator::DoPackage() /* Generate checksum file */ if (crypto) { - std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX")); - hashFile += "/" + filename; - hashFile += "." + cmSystemTools::LowerCase(algo); - cmsys::ofstream outF(hashFile.c_str()); - if (!outF) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot create checksum file: " << hashFile - << std::endl); + if (!this->GenerateChecksumFile(*crypto, filename)) { return 0; } - outF << crypto->HashFile(packageFileName) << " " << filename << "\n"; - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- checksum file: " << hashFile << " generated." - << std::endl); } } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 223b720..be945c4 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -19,6 +19,7 @@ #include "cmValue.h" class cmCPackLog; +class cmCryptoHash; class cmGlobalGenerator; class cmInstalledFile; class cmMakefile; @@ -182,6 +183,9 @@ protected: virtual const char* GetInstallPath(); virtual const char* GetPackagingInstallPrefix(); + bool GenerateChecksumFile(cmCryptoHash& crypto, + cm::string_view filename) const; + std::string FindTemplate(cm::string_view name, cm::optional alt = cm::nullopt); virtual bool ConfigureFile(const std::string& inName, -- cgit v0.12 From 12123b5b6bc460b3ec6d88d72a62da31d69ea37b Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Refactor copying of package files into own function --- Source/CPack/cmCPackGenerator.cxx | 43 ++++++++++++++++++++++----------------- Source/CPack/cmCPackGenerator.h | 2 ++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 38aa2ba..8b584ae 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -993,6 +993,29 @@ bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto, return true; } +bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath, + cm::string_view filename) const +{ + std::string destFilePath = + cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Copy final package(s): " + << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to " + << (!destFilePath.empty() ? destFilePath : "(NULL)") + << std::endl); + if (!cmSystemTools::CopyFileIfDifferent(srcFilePath, destFilePath)) { + cmCPackLogger( + cmCPackLog::LOG_ERROR, + "Problem copying the package: " + << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to " + << (!destFilePath.empty() ? destFilePath : "(NULL)") << std::endl); + return false; + } + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- package: " << destFilePath << " generated." << std::endl); + return true; +} + bool cmCPackGenerator::ReadListFile(const char* moduleName) { bool retval; @@ -1172,28 +1195,10 @@ int cmCPackGenerator::DoPackage() << "]:" << std::endl); /* now copy package one by one */ for (std::string const& pkgFileName : this->packageFileNames) { - std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX")); std::string filename(cmSystemTools::GetFilenameName(pkgFileName)); - tempPackageFileName = cmValue(pkgFileName); - tmpPF += "/" + filename; - const char* packageFileName = tmpPF.c_str(); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Copy final package(s): " - << (tempPackageFileName ? *tempPackageFileName : "(NULL)") - << " to " << (packageFileName ? packageFileName : "(NULL)") - << std::endl); - if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Problem copying the package: " - << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << " to " - << (packageFileName ? packageFileName : "(NULL)") << std::endl); + if (!this->CopyPackageFile(pkgFileName, filename)) { return 0; } - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- package: " << packageFileName << " generated." - << std::endl); - /* Generate checksum file */ if (crypto) { if (!this->GenerateChecksumFile(*crypto, filename)) { diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index be945c4..c9af776 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -185,6 +185,8 @@ protected: bool GenerateChecksumFile(cmCryptoHash& crypto, cm::string_view filename) const; + bool CopyPackageFile(const std::string& srcFilePath, + cm::string_view filename) const; std::string FindTemplate(cm::string_view name, cm::optional alt = cm::nullopt); -- cgit v0.12 From d26eed4c7516ddf13d31c0a8e3199a4f70ac8de6 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Clean up and simplify function `PrepareNames` --- Source/CPack/cmCPackGenerator.cxx | 75 ++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 8b584ae..7b42823 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -79,51 +79,60 @@ int cmCPackGenerator::PrepareNames() } } - std::string tempDirectory = - cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/_CPack_Packages/"); - cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG"); - if (toplevelTag) { - tempDirectory += *toplevelTag; - tempDirectory += "/"; - } - tempDirectory += *this->GetOption("CPACK_GENERATOR"); - std::string topDirectory = tempDirectory; - cmValue pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME"); - if (!pfname) { + // Determine package-directory. + cmValue pkgDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY"); + if (!pkgDirectory) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_PACKAGE_DIRECTORY not specified" << std::endl); + return 0; + } + // Determine base-filename of the package. + cmValue pkgBaseFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME"); + if (!pkgBaseFileName) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_PACKAGE_FILE_NAME not specified" << std::endl); return 0; } - std::string outName = *pfname; - tempDirectory += "/" + outName; + // Determine filename of the package. if (!this->GetOutputExtension()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "No output extension specified" << std::endl); return 0; } - outName += this->GetOutputExtension(); - cmValue pdir = this->GetOption("CPACK_PACKAGE_DIRECTORY"); - if (!pdir) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPACK_PACKAGE_DIRECTORY not specified" << std::endl); - return 0; + std::string pkgFileName = + cmStrCat(pkgBaseFileName, this->GetOutputExtension()); + // Determine path to the package. + std::string pkgFilePath = cmStrCat(pkgDirectory, "/", pkgFileName); + // Determine top-level directory for packaging. + std::string topDirectory = cmStrCat(pkgDirectory, "/_CPack_Packages/"); + { + cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG"); + if (toplevelTag) { + topDirectory += cmStrCat(toplevelTag, "/"); + } } + topDirectory += *this->GetOption("CPACK_GENERATOR"); + // Determine temporary packaging-directory. + std::string tmpDirectory = cmStrCat(topDirectory, "/", pkgBaseFileName); + // Determine path to temporary package file. + std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName; - std::string destFile = *pdir; - this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile); - destFile += "/" + outName; - std::string outFile = topDirectory + "/" + outName; + // Set CPack variables which are not set already. + this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1"); this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory); - this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory); - this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName); - this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", destFile); - this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", outFile); + this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tmpDirectory); + this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tmpDirectory); + this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", pkgDirectory); + this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", pkgFileName); + this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", pkgFilePath); + this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", tmpPkgFilePath); this->SetOptionIfNotSet("CPACK_INSTALL_DIRECTORY", this->GetInstallPath()); this->SetOptionIfNotSet( "CPACK_NATIVE_INSTALL_DIRECTORY", cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath())); - this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tempDirectory); + // Determine description of the package and set as CPack variable, + // if not already set. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for: CPACK_PACKAGE_DESCRIPTION_FILE" << std::endl); cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); @@ -143,14 +152,14 @@ int cmCPackGenerator::PrepareNames() << std::endl); return 0; } - std::ostringstream ostr; - std::string line; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Read description file: " << *descFileName << std::endl); + std::ostringstream ostr; + std::string line; while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) { ostr << cmXMLSafe(line) << std::endl; } + this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str()); cmValue defFileName = this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE"); @@ -166,6 +175,8 @@ int cmCPackGenerator::PrepareNames() << std::endl); return 0; } + + // Check algorithm for calculating the checksum of the package. cmValue algoSignature = this->GetOption("CPACK_PACKAGE_CHECKSUM"); if (algoSignature) { if (!cmCryptoHash::New(*algoSignature)) { @@ -176,8 +187,6 @@ int cmCPackGenerator::PrepareNames() } } - this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1"); - return 1; } -- cgit v0.12 From 1350ed96ffbc05c6b00289fc2cafe438e2b7e5fd Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Clean up and simplify function `DoPackage` --- Source/CPack/cmCPackGenerator.cxx | 79 +++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 7b42823..fb3df2e 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1094,6 +1094,7 @@ int cmCPackGenerator::DoPackage() return 0; } + // Possibly remove the top-level packaging-directory. if (this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY").IsOn()) { cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) { @@ -1108,55 +1109,68 @@ int cmCPackGenerator::DoPackage() } } } + + // Install the project (to the temporary install-directory). cmCPackLogger(cmCPackLog::LOG_DEBUG, "About to install project " << std::endl); - if (!this->InstallProject()) { return 0; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Done install project " << std::endl); - cmValue tempPackageFileName = - this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME"); + // Determine the temporary directory whose content shall be packaged. cmValue tempDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); + // Determine and store internally the list of files to be installed. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); - cmsys::Glob gl; - std::string findExpr = cmStrCat(tempDirectory, "/*"); - gl.RecurseOn(); - gl.SetRecurseListDirs(true); - gl.SetRecurseThroughSymlinks(false); - if (!gl.FindFiles(findExpr)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find any files in the packaging tree" << std::endl); - return 0; + { + cmsys::Glob gl; + std::string findExpr = cmStrCat(tempDirectory, "/*"); + gl.RecurseOn(); + gl.SetRecurseListDirs(true); + gl.SetRecurseThroughSymlinks(false); + if (!gl.FindFiles(findExpr)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find any files in the packaging tree" + << std::endl); + return 0; + } + this->files = gl.GetFiles(); } - cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Package files to: " - << (tempPackageFileName ? *tempPackageFileName : "(NULL)") - << std::endl); - if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Remove old package file" << std::endl); - cmSystemTools::RemoveFile(*tempPackageFileName); - } + // Determine and store internally the directory that shall be packaged. if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) { tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); } + this->toplevel = *tempDirectory; - // The files to be installed - this->files = gl.GetFiles(); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl); - this->packageFileNames.clear(); - /* Put at least one file name into the list of - * wanted packageFileNames. The specific generator - * may update this during PackageFiles. - * (either putting several names or updating the provided one) - */ - this->packageFileNames.emplace_back(tempPackageFileName); - this->toplevel = *tempDirectory; + // Determine and store internally the list of packages to create. + // Note: Initially, this only contains a single package. + { + cmValue tempPackageFileName = + this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME"); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Package files to: " + << (tempPackageFileName ? *tempPackageFileName : "(NULL)") + << std::endl); + if (tempPackageFileName && + cmSystemTools::FileExists(*tempPackageFileName)) { + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Remove old package file" << std::endl); + cmSystemTools::RemoveFile(*tempPackageFileName); + } + this->packageFileNames.clear(); + /* Put at least one file name into the list of + * wanted packageFileNames. The specific generator + * may update this during PackageFiles. + * (either putting several names or updating the provided one) + */ + this->packageFileNames.emplace_back(tempPackageFileName); + } + + // Do package the files (using the derived CPack generators. { // scope that enables package generators to run internal scripts with // latest CMake policies enabled cmMakefile::ScopePushPop pp{ this->MakefileMap }; @@ -1169,6 +1183,7 @@ int cmCPackGenerator::DoPackage() return 0; } } + // Run post-build actions cmValue postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS"); if (postBuildScripts) { -- cgit v0.12 From 87cfe9dd918aa9e98ca4e36f3a6ad13ac83144a8 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Slightly simplify function `InstallProject` --- Source/CPack/cmCPackGenerator.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index fb3df2e..576b302 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -197,20 +197,20 @@ int cmCPackGenerator::InstallProject() std::string bareTempInstallDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - std::string tempInstallDirectoryStr = bareTempInstallDirectory; + std::string tempInstallDirectory = bareTempInstallDirectory; bool setDestDir = this->GetOption("CPACK_SET_DESTDIR").IsOn() || cmIsInternallyOn(this->GetOption("CPACK_SET_DESTDIR")); if (!setDestDir) { - tempInstallDirectoryStr += this->GetPackagingInstallPrefix(); + tempInstallDirectory += this->GetPackagingInstallPrefix(); } - const char* tempInstallDirectory = tempInstallDirectoryStr.c_str(); int res = 1; if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " - << (tempInstallDirectory ? tempInstallDirectory : "(NULL)") - << std::endl); + cmCPackLogger( + cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " + << (!tempInstallDirectory.empty() ? tempInstallDirectory : "(NULL)") + << std::endl); return 0; } -- cgit v0.12 From a522abe5c0a771039e1101ba7029745df39b2ed2 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Fix comment in function `InstallCMakeProject` --- Source/CPack/cmCPackGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 576b302..f14d0a5 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -890,7 +890,7 @@ int cmCPackGenerator::InstallCMakeProject( if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); } - // If current CPack generator does support + // If current CPack generator does not support // ABSOLUTE INSTALL DESTINATION or CPack has been asked for // then ask cmake_install.cmake script to error out // as soon as it occurs (before installing file) -- cgit v0.12 From af1d1663874277db3219ecf561e3bca2fe41e44a Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmCPackGenerator: Fix debug message in function `PrepareGroupingKind` --- Source/CPack/cmCPackGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f14d0a5..4a5580c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1532,8 +1532,8 @@ int cmCPackGenerator::PrepareGroupingKind() this->componentPackageMethod = method; } - const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE_GROUPS", - "ONE_PER_GROUP" }; + const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE", + "ONE_PER_GROUP", "UNKNOWN" }; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" << this->Name << "]" -- cgit v0.12 From 48fc711064e13cf6d45659b9711addea7ef2445b Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:25 +0200 Subject: cmLocalGenerator: Fix comments in generated cmake_install.cmake file --- Source/cmLocalGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c943591..7a41113 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -595,7 +595,7 @@ void cmLocalGenerator::GenerateInstallRules() "CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM")) { /* clang-format off */ fout << - "# Set default install directory permissions.\n" + "# Set OS and executable format for runtime-dependencies.\n" "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM)\n" " set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM \"" << *platform << "\")\n" @@ -611,7 +611,7 @@ void cmLocalGenerator::GenerateInstallRules() this->Makefile->GetDefinition("CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL")) { /* clang-format off */ fout << - "# Set default install directory permissions.\n" + "# Set tool for dependency-resolution of runtime-dependencies.\n" "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL)\n" " set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL \"" << *command << "\")\n" @@ -627,7 +627,7 @@ void cmLocalGenerator::GenerateInstallRules() "CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND")) { /* clang-format off */ fout << - "# Set default install directory permissions.\n" + "# Set path to tool for dependency-resolution of runtime-dependencies.\n" "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND)\n" " set(CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND \"" << *command << "\")\n" @@ -644,7 +644,7 @@ void cmLocalGenerator::GenerateInstallRules() if (cmValue command = this->Makefile->GetDefinition("CMAKE_OBJDUMP")) { /* clang-format off */ fout << - "# Set default install directory permissions.\n" + "# Set path to fallback-tool for dependency-resolution.\n" "if(NOT DEFINED CMAKE_OBJDUMP)\n" " set(CMAKE_OBJDUMP \"" << *command << "\")\n" -- cgit v0.12 From 208b3f63acb70c2c145c4f954c6f855270684d35 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 30 Apr 2024 18:36:26 +0200 Subject: CPackDeb.cmake: Fix debug message --- Modules/Internal/CPack/CPackDeb.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 55a621c..5a78e3f 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -487,7 +487,7 @@ function(cpack_deb_prepare_package_vars) if(DEFINED ${_component_var}) set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}") if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} " + message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' ${value_type_} " "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'") endif() endif() -- cgit v0.12