mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-04 04:03:22 +03:00
Source: reduce ostringstream usage for IFW
This commit is contained in:
1 parent
f4bd297d05
commit
6c7dfb3afd
4 files changed
+68
-103
No files matched your search
@@ -69,12 +69,11 @@ protected:
|
||||
void WriteGeneratedByToStrim(cmXMLWriter& xout) const;
|
||||
};
|
||||
|
||||
#define cmCPackIFWLogger(logType, msg) \
|
||||
#define cmCPackIFWLogger(logType, ...) \
|
||||
do { \
|
||||
std::ostringstream cmCPackLog_msg; \
|
||||
cmCPackLog_msg << msg; \
|
||||
if (Generator) { \
|
||||
std::string cmCPackLog_msg = cmStrCat("", __VA_ARGS__); \
|
||||
Generator->Logger->Log(cmCPackLog::LOG_##logType, __FILE__, __LINE__, \
|
||||
cmCPackLog_msg.str().c_str()); \
|
||||
cmCPackLog_msg.c_str(), cmCPackLog_msg.size()); \
|
||||
} \
|
||||
} while (false)
|
||||
@@ -28,7 +28,7 @@ cmCPackIFWGenerator::~cmCPackIFWGenerator() = default;
|
||||
|
||||
int cmCPackIFWGenerator::PackageFiles()
|
||||
{
|
||||
cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
|
||||
cmCPackIFWLogger(OUTPUT, "- Configuration\n");
|
||||
|
||||
// Installer configuragion
|
||||
this->Installer.GenerateInstallerFile();
|
||||
@@ -93,10 +93,9 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
|
||||
} else {
|
||||
cmCPackIFWLogger(WARNING,
|
||||
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
|
||||
<< "variable is set, but content will be skipped, "
|
||||
<< "because this feature available only since "
|
||||
<< "QtIFW 3.1. Please update your QtIFW instance."
|
||||
<< std::endl);
|
||||
"variable is set, but content will be skipped, "
|
||||
"because this feature available only since "
|
||||
"QtIFW 3.1. Please update your QtIFW instance.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,12 +122,11 @@ int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile)
|
||||
}
|
||||
|
||||
std::vector<std::string> ifwCmd = this->BuildRepogenCommand();
|
||||
cmCPackIFWLogger(VERBOSE,
|
||||
"Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
|
||||
<< std::endl);
|
||||
cmCPackIFWLogger(
|
||||
VERBOSE, "Execute: ", cmSystemTools::PrintSingleCommand(ifwCmd), '\n');
|
||||
std::string output;
|
||||
int retVal = 1;
|
||||
cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
|
||||
cmCPackIFWLogger(OUTPUT, "- Generate repository\n");
|
||||
bool res = cmSystemTools::RunSingleCommand(ifwCmd, &output, &output, &retVal,
|
||||
nullptr, this->GeneratorVerbose,
|
||||
cmDuration::zero());
|
||||
@@ -138,11 +136,9 @@ int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile)
|
||||
<< std::endl
|
||||
<< "# Output:" << std::endl
|
||||
<< output << std::endl;
|
||||
cmCPackIFWLogger(
|
||||
ERROR,
|
||||
"Problem running IFW command: "
|
||||
<< cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
|
||||
<< "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
|
||||
cmCPackIFWLogger(ERROR, "Problem running IFW command: ",
|
||||
cmSystemTools::PrintSingleCommand(ifwCmd),
|
||||
"\nPlease check \"", ifwTmpFile, "\" for errors\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,14 +146,12 @@ int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile)
|
||||
!this->Repository.PatchUpdatesXml()) {
|
||||
cmCPackIFWLogger(WARNING,
|
||||
"Problem patch IFW \"Updates\" "
|
||||
<< "file: \"" << this->toplevel
|
||||
<< "/repository/Updates.xml\"" << std::endl);
|
||||
"file: \"",
|
||||
this->toplevel, "/repository/Updates.xml\"\n");
|
||||
}
|
||||
|
||||
cmCPackIFWLogger(OUTPUT,
|
||||
"- repository: \"" << this->toplevel
|
||||
<< "/repository\" generated"
|
||||
<< std::endl);
|
||||
cmCPackIFWLogger(OUTPUT, "- repository: \"", this->toplevel,
|
||||
"/repository\" generated\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -225,10 +219,9 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
|
||||
} else {
|
||||
cmCPackIFWLogger(WARNING,
|
||||
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
|
||||
<< "variable is set, but content will be skipped, "
|
||||
<< "because this feature available only since "
|
||||
<< "QtIFW 3.1. Please update your QtIFW instance."
|
||||
<< std::endl);
|
||||
"variable is set, but content will be skipped, "
|
||||
"because this feature available only since "
|
||||
"QtIFW 3.1. Please update your QtIFW instance.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,12 +270,11 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
|
||||
int cmCPackIFWGenerator::RunBinaryCreator(std::string const& ifwTmpFile)
|
||||
{
|
||||
std::vector<std::string> ifwCmd = this->BuildBinaryCreatorCommand();
|
||||
cmCPackIFWLogger(VERBOSE,
|
||||
"Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
|
||||
<< std::endl);
|
||||
cmCPackIFWLogger(
|
||||
VERBOSE, "Execute: ", cmSystemTools::PrintSingleCommand(ifwCmd), '\n');
|
||||
std::string output;
|
||||
int retVal = 1;
|
||||
cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
|
||||
cmCPackIFWLogger(OUTPUT, "- Generate package\n");
|
||||
bool res = cmSystemTools::RunSingleCommand(ifwCmd, &output, &output, &retVal,
|
||||
nullptr, this->GeneratorVerbose,
|
||||
cmDuration::zero());
|
||||
@@ -292,11 +284,9 @@ int cmCPackIFWGenerator::RunBinaryCreator(std::string const& ifwTmpFile)
|
||||
<< std::endl
|
||||
<< "# Output:" << std::endl
|
||||
<< output << std::endl;
|
||||
cmCPackIFWLogger(
|
||||
ERROR,
|
||||
"Problem running IFW command: "
|
||||
<< cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
|
||||
<< "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
|
||||
cmCPackIFWLogger(ERROR, "Problem running IFW command: ",
|
||||
cmSystemTools::PrintSingleCommand(ifwCmd),
|
||||
"\nPlease check \"", ifwTmpFile, "\" for errors\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -349,8 +339,7 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||
if (this->BinCreator.empty()) {
|
||||
cmCPackIFWLogger(ERROR,
|
||||
"Cannot find QtIFW compiler \"binarycreator\": "
|
||||
"likely it is not installed, or not in your PATH"
|
||||
<< std::endl);
|
||||
"likely it is not installed, or not in your PATH\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -428,8 +417,7 @@ int cmCPackIFWGenerator::InitializeInternal()
|
||||
if (!this->Installer.RemoteRepositories.empty() && this->RepoGen.empty()) {
|
||||
cmCPackIFWLogger(ERROR,
|
||||
"Cannot find QtIFW repository generator \"repogen\": "
|
||||
"likely it is not installed, or not in your PATH"
|
||||
<< std::endl);
|
||||
"likely it is not installed, or not in your PATH\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -530,10 +518,8 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
|
||||
}
|
||||
} else {
|
||||
this->Packages.erase(name);
|
||||
cmCPackIFWLogger(ERROR,
|
||||
"Cannot configure package \""
|
||||
<< name << "\" for component \"" << component->Name
|
||||
<< "\"" << std::endl);
|
||||
cmCPackIFWLogger(ERROR, "Cannot configure package \"", name,
|
||||
"\" for component \"", component->Name, "\"\n");
|
||||
}
|
||||
|
||||
return component;
|
||||
@@ -566,10 +552,8 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
|
||||
this->BinaryPackages.insert(package);
|
||||
} else {
|
||||
this->Packages.erase(name);
|
||||
cmCPackIFWLogger(ERROR,
|
||||
"Cannot configure package \""
|
||||
<< name << "\" for component group \"" << group->Name
|
||||
<< "\"" << std::endl);
|
||||
cmCPackIFWLogger(ERROR, "Cannot configure package \"", name,
|
||||
"\" for component group \"", group->Name, "\"\n");
|
||||
}
|
||||
return group;
|
||||
}
|
||||
@@ -705,11 +689,8 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
|
||||
} else {
|
||||
this->Repositories.erase(repositoryName);
|
||||
repository = nullptr;
|
||||
cmCPackIFWLogger(WARNING,
|
||||
"Invalid repository \""
|
||||
<< repositoryName << "\""
|
||||
<< " configuration. Repository will be skipped."
|
||||
<< std::endl);
|
||||
cmCPackIFWLogger(WARNING, "Invalid repository \"", repositoryName,
|
||||
"\" configuration. Repository will be skipped.\n");
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "cmCPackIFWCommon.h"
|
||||
@@ -26,11 +25,8 @@ void cmCPackIFWInstaller::printSkippedOptionWarning(
|
||||
std::string const& optionName, std::string const& optionValue)
|
||||
{
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"Option "
|
||||
<< optionName << " contains the value \"" << optionValue
|
||||
<< "\" but will be skipped because the specified file does not exist."
|
||||
<< std::endl);
|
||||
WARNING, "Option ", optionName, " contains the value \"", optionValue,
|
||||
"\" but will be skipped because the specified file does not exist.\n");
|
||||
}
|
||||
|
||||
void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||
@@ -149,10 +145,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||
if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" &&
|
||||
this->WizardStyle != "Mac" && this->WizardStyle != "Classic") {
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
|
||||
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
|
||||
<< std::endl);
|
||||
WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"",
|
||||
option, "\". Expected values are: Modern, Aero, Mac, Classic.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,12 +192,11 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||
currentVersionMsg = "an older QtIFW version";
|
||||
}
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to \""
|
||||
<< option
|
||||
<< "\", but it is only supported with QtIFW version 4.0 or later. "
|
||||
"It is being ignored because you are using "
|
||||
<< currentVersionMsg << std::endl);
|
||||
WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to \"",
|
||||
option,
|
||||
"\", but it is only supported with QtIFW version 4.0 or later. "
|
||||
"It is being ignored because you are using ",
|
||||
currentVersionMsg, '\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,11 +325,10 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"Option \"CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS\" will be skipped "
|
||||
"because it contains "
|
||||
<< this->ProductImageUrls.size()
|
||||
<< " elements while \"CPACK_IFW_PACKAGE_PRODUCT_IMAGES\" "
|
||||
"contains "
|
||||
<< this->ProductImages.size() << " elements." << std::endl);
|
||||
"because it contains ",
|
||||
this->ProductImageUrls.size(),
|
||||
" elements while \"CPACK_IFW_PACKAGE_PRODUCT_IMAGES\" contains ",
|
||||
this->ProductImages.size(), " elements.\n");
|
||||
this->ProductImageUrls.clear();
|
||||
}
|
||||
}
|
||||
@@ -667,10 +659,9 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||
cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path);
|
||||
resources.push_back(std::move(name));
|
||||
} else {
|
||||
cmCPackIFWLogger(WARNING,
|
||||
"Can't copy resources from \""
|
||||
<< this->Resources[i]
|
||||
<< "\". Resource will be skipped." << std::endl);
|
||||
cmCPackIFWLogger(WARNING, "Can't copy resources from \"",
|
||||
this->Resources[i],
|
||||
"\". Resource will be skipped.\n");
|
||||
}
|
||||
}
|
||||
this->Resources = resources;
|
||||
|
||||
@@ -239,10 +239,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
|
||||
cmExpandList(option, this->Licenses);
|
||||
if (this->Licenses.size() % 2 != 0) {
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
prefix << "LICENSES"
|
||||
<< " should contain pairs of <display_name> and <file_path>."
|
||||
<< std::endl);
|
||||
WARNING, prefix,
|
||||
"LICENSES"
|
||||
" should contain pairs of <display_name> and <file_path>.\n");
|
||||
this->Licenses.clear();
|
||||
}
|
||||
}
|
||||
@@ -251,11 +250,10 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
|
||||
if (cmValue option = this->GetOption(prefix + "PRIORITY")) {
|
||||
this->SortingPriority = *option;
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"The \"PRIORITY\" option is set "
|
||||
<< "for component \"" << component->Name << "\", but there option is "
|
||||
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
|
||||
<< std::endl);
|
||||
WARNING, "The \"PRIORITY\" option is set for component \"",
|
||||
component->Name,
|
||||
"\", but there option is "
|
||||
"deprecated. Please use \"SORTING_PRIORITY\" option instead.\n");
|
||||
}
|
||||
|
||||
// Default
|
||||
@@ -318,10 +316,9 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
|
||||
cmExpandList(option, this->Licenses);
|
||||
if (this->Licenses.size() % 2 != 0) {
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
prefix << "LICENSES"
|
||||
<< " should contain pairs of <display_name> and <file_path>."
|
||||
<< std::endl);
|
||||
WARNING, prefix,
|
||||
"LICENSES"
|
||||
" should contain pairs of <display_name> and <file_path>.\n");
|
||||
this->Licenses.clear();
|
||||
}
|
||||
}
|
||||
@@ -330,12 +327,10 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
|
||||
if (cmValue option = this->GetOption(prefix + "PRIORITY")) {
|
||||
this->SortingPriority = *option;
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"The \"PRIORITY\" option is set "
|
||||
<< "for component group \"" << group->Name
|
||||
<< "\", but there option is "
|
||||
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
|
||||
<< std::endl);
|
||||
WARNING, "The \"PRIORITY\" option is set for component group \"",
|
||||
group->Name,
|
||||
"\", but there option is "
|
||||
"deprecated. Please use \"SORTING_PRIORITY\" option instead.\n");
|
||||
}
|
||||
|
||||
return this->ConfigureFromPrefix(prefix);
|
||||
@@ -690,11 +685,10 @@ void cmCPackIFWPackage::GeneratePackageFile()
|
||||
|
||||
if (warnUnsupportedNames) {
|
||||
cmCPackIFWLogger(
|
||||
WARNING,
|
||||
"The dependencies for component \""
|
||||
<< this->Name << "\" specify names that contain hyphens. "
|
||||
<< "This requires QtIFW 3.1 or later, but you are using version "
|
||||
<< this->Generator->FrameworkVersion << std::endl);
|
||||
WARNING, "The dependencies for component \"", this->Name,
|
||||
"\" specify names that contain hyphens. "
|
||||
"This requires QtIFW 3.1 or later, but you are using version ",
|
||||
this->Generator->FrameworkVersion, '\n');
|
||||
}
|
||||
|
||||
// Licenses (copy to meta dir)
|
||||
|
||||
Reference in new issue
Block a user