diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2016-05-17 14:00:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-18 13:49:14 (GMT) |
commit | 41199f8c1ea02bacb516ae8bd57d9c9e1d3fd4ee (patch) | |
tree | 07b7d562e9896dc36de8a79dffb5a80290b560ab /Source/CPack/IFW/cmCPackIFWGenerator.cxx | |
parent | 6ca6b0dd7b1f4bb7429cbe039101558c58f3ea27 (diff) | |
download | CMake-41199f8c1ea02bacb516ae8bd57d9c9e1d3fd4ee.zip CMake-41199f8c1ea02bacb516ae8bd57d9c9e1d3fd4ee.tar.gz CMake-41199f8c1ea02bacb516ae8bd57d9c9e1d3fd4ee.tar.bz2 |
CPackIFW: Add support for Promoting Updates
Add support for this feature added by QtIFW 2.0.3:
http://doc.qt.io/qtinstallerframework/ifw-updates.html
Add a `cpack_ifw_update_repository` command as porcelain.
Diffstat (limited to 'Source/CPack/IFW/cmCPackIFWGenerator.cxx')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 2c25f43..c1ff526 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -12,9 +12,6 @@ #include "cmCPackIFWGenerator.h" -#include "cmCPackIFWInstaller.h" -#include "cmCPackIFWPackage.h" - #include <CPack/cmCPackComponentGroup.h> #include <CPack/cmCPackLog.h> @@ -72,7 +69,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwTmpFile += "/IFWOutput.log"; // Run repogen - if (!Installer.Repositories.empty()) { + if (!Installer.RemoteRepositories.empty()) { std::string ifwCmd = RepoGen; if (IsVersionLess("2.0.0")) { @@ -117,6 +114,14 @@ int cmCPackIFWGenerator::PackageFiles() << std::endl); return 0; } + + if (!Repository.RepositoryUpdate.empty() && + !Repository.PatchUpdatesXml()) { + cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" " + << "file: " << this->toplevel + "/repository/Updates.xml" + << std::endl); + } + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: " << this->toplevel << "/repository generated" << std::endl); } @@ -137,7 +142,7 @@ int cmCPackIFWGenerator::PackageFiles() if (OnlineOnly) { ifwCmd += " --online-only"; } else if (!DownloadedPackages.empty() && - !Installer.Repositories.empty()) { + !Installer.RemoteRepositories.empty()) { ifwCmd += " -e "; std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin(); ifwCmd += (*it)->Name; @@ -272,6 +277,24 @@ int cmCPackIFWGenerator::InitializeInternal() Installer.Generator = this; Installer.ConfigureFromOptions(); + // Repository + Repository.Generator = this; + Repository.Name = "Unspecified"; + if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) { + Repository.Url = site; + Installer.RemoteRepositories.push_back(&Repository); + } + + // Repositories + if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) { + std::vector<std::string> RepoAllVector; + cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector); + for (std::vector<std::string>::iterator rit = RepoAllVector.begin(); + rit != RepoAllVector.end(); ++rit) { + GetRepository(*rit); + } + } + if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) { OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll); } else if (const char* cpackDownloadAll = @@ -281,7 +304,7 @@ int cmCPackIFWGenerator::InitializeInternal() OnlineOnly = false; } - if (!Installer.Repositories.empty() && RepoGen.empty()) { + if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find QtIFW repository generator \"repogen\": " "likely it is not installed, or not in your PATH" @@ -507,6 +530,33 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage( return pit != ComponentPackages.end() ? pit->second : 0; } +cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( + const std::string& repositoryName) +{ + RepositoriesMap::iterator rit = Repositories.find(repositoryName); + if (rit != Repositories.end()) + return &(rit->second); + + cmCPackIFWRepository* repository = &Repositories[repositoryName]; + repository->Name = repositoryName; + repository->Generator = this; + if (repository->ConfigureFromOptions()) { + if (repository->Update == cmCPackIFWRepository::None) { + Installer.RemoteRepositories.push_back(repository); + } else { + Repository.RepositoryUpdate.push_back(repository); + } + } else { + Repositories.erase(repositoryName); + repository = 0; + cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \"" + << repositoryName << "\"" + << " configuration. Repository will be skipped." + << std::endl); + } + return repository; +} + void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout) { std::stringstream comment; |