diff options
Diffstat (limited to 'Source/CPack/IFW')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWCommon.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 125 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 3 |
4 files changed, 79 insertions, 59 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx index 5b1ccbd..f9ce822 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.cxx +++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx @@ -78,8 +78,7 @@ bool cmCPackIFWCommon::IsVersionEqual(const char* version) void cmCPackIFWCommon::ExpandListArgument( const std::string& arg, std::map<std::string, std::string>& argsOut) { - std::vector<std::string> args; - cmExpandList(arg, args, false); + std::vector<std::string> args = cmExpandedList(arg, false); if (args.empty()) { return; } @@ -100,8 +99,7 @@ void cmCPackIFWCommon::ExpandListArgument( void cmCPackIFWCommon::ExpandListArgument( const std::string& arg, std::multimap<std::string, std::string>& argsOut) { - std::vector<std::string> args; - cmExpandList(arg, args, false); + std::vector<std::string> args = cmExpandedList(arg, false); if (args.empty()) { return; } diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index f0fb37a..d1ffcef 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -35,29 +35,35 @@ int cmCPackIFWGenerator::PackageFiles() this->Installer.GeneratePackageFiles(); std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - std::string ifwTmpFile = ifwTLD; - ifwTmpFile += "/IFWOutput.log"; + std::string ifwTmpFile = cmStrCat(ifwTLD, "/IFWOutput.log"); // Run repogen if (!this->Installer.RemoteRepositories.empty()) { - std::string ifwCmd = this->RepoGen; + std::vector<std::string> ifwCmd; + std::string ifwArg; + + ifwCmd.emplace_back(this->RepoGen); if (this->IsVersionLess("2.0.0")) { - ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd.emplace_back("-c"); + ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); } - ifwCmd += " -p " + this->toplevel + "/packages"; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(this->toplevel + "/packages"); if (!this->PkgsDirsVector.empty()) { for (std::string const& it : this->PkgsDirsVector) { - ifwCmd += " -p " + it; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(it); } } if (!this->RepoDirsVector.empty()) { if (!this->IsVersionLess("3.1")) { for (std::string const& rd : this->RepoDirsVector) { - ifwCmd += " --repository " + rd; + ifwCmd.emplace_back("--repository"); + ifwCmd.emplace_back(rd); } } else { cmCPackIFWLogger(WARNING, @@ -70,18 +76,21 @@ int cmCPackIFWGenerator::PackageFiles() } if (!this->OnlineOnly && !this->DownloadedPackages.empty()) { - ifwCmd += " -i "; + ifwCmd.emplace_back("-i"); std::set<cmCPackIFWPackage*>::iterator it = this->DownloadedPackages.begin(); - ifwCmd += (*it)->Name; + ifwArg = (*it)->Name; ++it; while (it != this->DownloadedPackages.end()) { - ifwCmd += "," + (*it)->Name; + ifwArg += "," + (*it)->Name; ++it; } + ifwCmd.emplace_back(ifwArg); } - ifwCmd += " " + this->toplevel + "/repository"; - cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl); + ifwCmd.emplace_back(this->toplevel + "/repository"); + cmCPackIFWLogger(VERBOSE, + "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl); std::string output; int retVal = 1; cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl); @@ -90,14 +99,15 @@ int cmCPackIFWGenerator::PackageFiles() cmDuration::zero()); if (!res || retVal) { cmGeneratedFileStream ofs(ifwTmpFile); - ofs << "# Run command: " << ifwCmd << std::endl + ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl << "# Output:" << std::endl << output << std::endl; - cmCPackIFWLogger(ERROR, - "Problem running IFW command: " - << ifwCmd << std::endl - << "Please check " << ifwTmpFile << " for errors" - << std::endl); + cmCPackIFWLogger( + ERROR, + "Problem running IFW command: " + << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl + << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl); return 0; } @@ -105,46 +115,55 @@ int cmCPackIFWGenerator::PackageFiles() !this->Repository.PatchUpdatesXml()) { cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" " - << "file: " - << this->toplevel + "/repository/Updates.xml" - << std::endl); + << "file: \"" << this->toplevel + << "/repository/Updates.xml\"" << std::endl); } cmCPackIFWLogger(OUTPUT, - "- repository: " << this->toplevel - << "/repository generated" << std::endl); + "- repository: \"" << this->toplevel + << "/repository\" generated" + << std::endl); } // Run binary creator { - std::string ifwCmd = this->BinCreator; - ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + std::vector<std::string> ifwCmd; + std::string ifwArg; + + ifwCmd.emplace_back(this->BinCreator); + + ifwCmd.emplace_back("-c"); + ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); if (!this->Installer.Resources.empty()) { - ifwCmd += " -r "; + ifwCmd.emplace_back("-r"); std::vector<std::string>::iterator it = this->Installer.Resources.begin(); std::string path = this->toplevel + "/resources/"; - ifwCmd += path + *it; + ifwArg = path + *it; ++it; while (it != this->Installer.Resources.end()) { - ifwCmd += "," + path + *it; + ifwArg += "," + path + *it; ++it; } + ifwCmd.emplace_back(ifwArg); } - ifwCmd += " -p " + this->toplevel + "/packages"; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(this->toplevel + "/packages"); if (!this->PkgsDirsVector.empty()) { for (std::string const& it : this->PkgsDirsVector) { - ifwCmd += " -p " + it; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(it); } } if (!this->RepoDirsVector.empty()) { if (!this->IsVersionLess("3.1")) { for (std::string const& rd : this->RepoDirsVector) { - ifwCmd += " --repository " + rd; + ifwCmd.emplace_back("--repository"); + ifwCmd.emplace_back(rd); } } else { cmCPackIFWLogger(WARNING, @@ -157,44 +176,48 @@ int cmCPackIFWGenerator::PackageFiles() } if (this->OnlineOnly) { - ifwCmd += " --online-only"; + ifwCmd.emplace_back("--online-only"); } else if (!this->DownloadedPackages.empty() && !this->Installer.RemoteRepositories.empty()) { - ifwCmd += " -e "; + ifwCmd.emplace_back("-e"); std::set<cmCPackIFWPackage*>::iterator it = this->DownloadedPackages.begin(); - ifwCmd += (*it)->Name; + ifwArg = (*it)->Name; ++it; while (it != this->DownloadedPackages.end()) { - ifwCmd += "," + (*it)->Name; + ifwArg += "," + (*it)->Name; ++it; } + ifwCmd.emplace_back(ifwArg); } else if (!this->DependentPackages.empty()) { - ifwCmd += " -i "; + ifwCmd.emplace_back("-i"); + ifwArg.clear(); // Binary std::set<cmCPackIFWPackage*>::iterator bit = this->BinaryPackages.begin(); while (bit != this->BinaryPackages.end()) { - ifwCmd += (*bit)->Name + ","; + ifwArg += (*bit)->Name + ","; ++bit; } // Depend DependenceMap::iterator it = this->DependentPackages.begin(); - ifwCmd += it->second.Name; + ifwArg += it->second.Name; ++it; while (it != this->DependentPackages.end()) { - ifwCmd += "," + it->second.Name; + ifwArg += "," + it->second.Name; ++it; } + ifwCmd.emplace_back(ifwArg); } // TODO: set correct name for multipackages if (!this->packageFileNames.empty()) { - ifwCmd += " " + this->packageFileNames[0]; + ifwCmd.emplace_back(this->packageFileNames[0]); } else { - ifwCmd += " installer"; - ifwCmd += this->OutputExtension; + ifwCmd.emplace_back("installer" + this->OutputExtension); } - cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl); + cmCPackIFWLogger(VERBOSE, + "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl); std::string output; int retVal = 1; cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl); @@ -203,14 +226,15 @@ int cmCPackIFWGenerator::PackageFiles() cmDuration::zero()); if (!res || retVal) { cmGeneratedFileStream ofs(ifwTmpFile); - ofs << "# Run command: " << ifwCmd << std::endl + ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl << "# Output:" << std::endl << output << std::endl; - cmCPackIFWLogger(ERROR, - "Problem running IFW command: " - << ifwCmd << std::endl - << "Please check " << ifwTmpFile << " for errors" - << std::endl); + cmCPackIFWLogger( + ERROR, + "Problem running IFW command: " + << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl + << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl); return 0; } } @@ -317,8 +341,7 @@ int cmCPackIFWGenerator::InitializeInternal() // Repositories if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) { - std::vector<std::string> RepoAllVector; - cmExpandList(RepoAllStr, RepoAllVector); + std::vector<std::string> RepoAllVector = cmExpandedList(RepoAllStr); for (std::string const& r : RepoAllVector) { this->GetRepository(r); } diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 5313dd0..b4bfea7 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -193,8 +193,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->TargetDir = optIFW_TARGET_DIRECTORY; } else if (const char* optPACKAGE_INSTALL_DIRECTORY = this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) { - this->TargetDir = "@ApplicationsDir@/"; - this->TargetDir += optPACKAGE_INSTALL_DIRECTORY; + this->TargetDir = + cmStrCat("@ApplicationsDir@/", optPACKAGE_INSTALL_DIRECTORY); } else { this->TargetDir = "@RootDir@/usr/local"; } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 7407c49..fb75145 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -431,8 +431,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->AlienAutoDependOn.clear(); } else if (const char* value = this->GetOption(option)) { - std::vector<std::string> depsOn; - cmExpandList(value, depsOn); + std::vector<std::string> depsOn = cmExpandedList(value); for (std::string const& d : depsOn) { DependenceStruct dep(d); if (this->Generator->Packages.count(dep.Name)) { |