summaryrefslogtreecommitdiffstats
path: root/Source/CPack/IFW/cmCPackIFWGenerator.cxx
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2017-05-09 14:02:28 (GMT)
committerKonstantin Podsvirov <konstantin@podsvirov.pro>2017-05-09 21:29:18 (GMT)
commit543cf13406f478557c6ecf2279b6ab1fd3bdde30 (patch)
tree2204d09e3af6ed53f7e66b938ef5320c4dfd6d50 /Source/CPack/IFW/cmCPackIFWGenerator.cxx
parentb69e061b8073efbd2c356f4508ea401c85e8dae3 (diff)
downloadCMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.zip
CMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.tar.gz
CMake-543cf13406f478557c6ecf2279b6ab1fd3bdde30.tar.bz2
CPackIFW: Access refactoring
Changes: - Access members with this->; - Access nested enum values with class name.
Diffstat (limited to 'Source/CPack/IFW/cmCPackIFWGenerator.cxx')
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx225
1 files changed, 117 insertions, 108 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index a9628d6..226ea0a 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -17,7 +17,7 @@
cmCPackIFWGenerator::cmCPackIFWGenerator()
{
- Generator = this;
+ this->Generator = this;
}
cmCPackIFWGenerator::~cmCPackIFWGenerator()
@@ -29,38 +29,40 @@ int cmCPackIFWGenerator::PackageFiles()
cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
// Installer configuragion
- Installer.GenerateInstallerFile();
+ this->Installer.GenerateInstallerFile();
// Packages configuration
- Installer.GeneratePackageFiles();
+ this->Installer.GeneratePackageFiles();
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = ifwTLD;
ifwTmpFile += "/IFWOutput.log";
// Run repogen
- if (!Installer.RemoteRepositories.empty()) {
- std::string ifwCmd = RepoGen;
+ if (!this->Installer.RemoteRepositories.empty()) {
+ std::string ifwCmd = this->RepoGen;
- if (IsVersionLess("2.0.0")) {
+ if (this->IsVersionLess("2.0.0")) {
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
}
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (!OnlineOnly && !DownloadedPackages.empty()) {
+ if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
ifwCmd += " -i ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
@@ -85,8 +87,8 @@ int cmCPackIFWGenerator::PackageFiles()
return 0;
}
- if (!Repository.RepositoryUpdate.empty() &&
- !Repository.PatchUpdatesXml()) {
+ if (!this->Repository.RepositoryUpdate.empty() &&
+ !this->Repository.PatchUpdatesXml()) {
cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" "
<< "file: "
<< this->toplevel + "/repository/Updates.xml"
@@ -100,16 +102,17 @@ int cmCPackIFWGenerator::PackageFiles()
// Run binary creator
{
- std::string ifwCmd = BinCreator;
+ std::string ifwCmd = this->BinCreator;
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
- if (!Installer.Resources.empty()) {
+ if (!this->Installer.Resources.empty()) {
ifwCmd += " -r ";
- std::vector<std::string>::iterator it = Installer.Resources.begin();
+ std::vector<std::string>::iterator it =
+ this->Installer.Resources.begin();
std::string path = this->toplevel + "/resources/";
ifwCmd += path + *it;
++it;
- while (it != Installer.Resources.end()) {
+ while (it != this->Installer.Resources.end()) {
ifwCmd += "," + path + *it;
++it;
}
@@ -117,45 +120,48 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (OnlineOnly) {
+ if (this->OnlineOnly) {
ifwCmd += " --online-only";
- } else if (!DownloadedPackages.empty() &&
- !Installer.RemoteRepositories.empty()) {
+ } else if (!this->DownloadedPackages.empty() &&
+ !this->Installer.RemoteRepositories.empty()) {
ifwCmd += " -e ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
- } else if (!DependentPackages.empty()) {
+ } else if (!this->DependentPackages.empty()) {
ifwCmd += " -i ";
// Binary
- std::set<cmCPackIFWPackage*>::iterator bit = BinaryPackages.begin();
- while (bit != BinaryPackages.end()) {
+ std::set<cmCPackIFWPackage*>::iterator bit =
+ this->BinaryPackages.begin();
+ while (bit != this->BinaryPackages.end()) {
ifwCmd += (*bit)->Name + ",";
++bit;
}
// Depend
- DependenceMap::iterator it = DependentPackages.begin();
+ DependenceMap::iterator it = this->DependentPackages.begin();
ifwCmd += it->second.Name;
++it;
- while (it != DependentPackages.end()) {
+ while (it != this->DependentPackages.end()) {
ifwCmd += "," + it->second.Name;
++it;
}
}
// TODO: set correct name for multipackages
if (!this->packageFileNames.empty()) {
- ifwCmd += " " + packageFileNames[0];
+ ifwCmd += " " + this->packageFileNames[0];
} else {
ifwCmd += " installer";
}
@@ -184,12 +190,12 @@ int cmCPackIFWGenerator::PackageFiles()
const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
{
- const char* defPrefix = cmCPackGenerator::GetPackagingInstallPrefix();
+ const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
std::string tmpPref = defPrefix ? defPrefix : "";
if (this->Components.empty()) {
- tmpPref += "packages/" + GetRootPackageName() + "/data";
+ tmpPref += "packages/" + this->GetRootPackageName() + "/data";
}
this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str());
@@ -199,7 +205,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
const char* cmCPackIFWGenerator::GetOutputExtension()
{
- return ExecutableSuffix.c_str();
+ return this->ExecutableSuffix.c_str();
}
int cmCPackIFWGenerator::InitializeInternal()
@@ -219,12 +225,12 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* BinCreatorStr = this->GetOption(BinCreatorOpt);
if (!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr)) {
- BinCreator = "";
+ this->BinCreator = "";
} else {
- BinCreator = BinCreatorStr;
+ this->BinCreator = BinCreatorStr;
}
- if (BinCreator.empty()) {
+ if (this->BinCreator.empty()) {
cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": "
"likely it is not installed, or not in your PATH"
<< std::endl);
@@ -235,39 +241,40 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* RepoGenStr = this->GetOption(RepoGenOpt);
if (!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr)) {
- RepoGen = "";
+ this->RepoGen = "";
} else {
- RepoGen = RepoGenStr;
+ this->RepoGen = RepoGenStr;
}
// Framework version
if (const char* FrameworkVersionSrt = this->GetOption(FrameworkVersionOpt)) {
- FrameworkVersion = FrameworkVersionSrt;
+ this->FrameworkVersion = FrameworkVersionSrt;
} else {
- FrameworkVersion = "1.9.9";
+ this->FrameworkVersion = "1.9.9";
}
// Variables that Change Behavior
// Resolve duplicate names
- ResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
+ this->ResolveDuplicateNames =
+ this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
// Additional packages dirs
- PkgsDirsVector.clear();
+ this->PkgsDirsVector.clear();
if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(dirs, PkgsDirsVector);
+ cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector);
}
// Installer
- Installer.Generator = this;
- Installer.ConfigureFromOptions();
+ this->Installer.Generator = this;
+ this->Installer.ConfigureFromOptions();
// Repository
- Repository.Generator = this;
- Repository.Name = "Unspecified";
+ this->Repository.Generator = this;
+ this->Repository.Name = "Unspecified";
if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
- Repository.Url = site;
- Installer.RemoteRepositories.push_back(&Repository);
+ this->Repository.Url = site;
+ this->Installer.RemoteRepositories.push_back(&this->Repository);
}
// Repositories
@@ -276,20 +283,20 @@ int cmCPackIFWGenerator::InitializeInternal()
cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
rit != RepoAllVector.end(); ++rit) {
- GetRepository(*rit);
+ this->GetRepository(*rit);
}
}
if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
} else if (const char* cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
} else {
- OnlineOnly = false;
+ this->OnlineOnly = false;
}
- if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
+ 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"
@@ -299,15 +306,15 @@ int cmCPackIFWGenerator::InitializeInternal()
// Executable suffix
if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) {
- ExecutableSuffix = optExeSuffix;
- if (ExecutableSuffix.empty()) {
+ this->ExecutableSuffix = optExeSuffix;
+ if (this->ExecutableSuffix.empty()) {
std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
if (sysName == "Linux") {
- ExecutableSuffix = ".run";
+ this->ExecutableSuffix = ".run";
}
}
} else {
- ExecutableSuffix = cmCPackGenerator::GetOutputExtension();
+ this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension();
}
return this->Superclass::InitializeInternal();
@@ -319,49 +326,50 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
const std::string prefix = "packages/";
const std::string suffix = "/data";
- if (componentPackageMethod == ONE_PACKAGE) {
- return std::string(prefix + GetRootPackageName() + suffix);
+ if (this->componentPackageMethod == this->ONE_PACKAGE) {
+ return std::string(prefix + this->GetRootPackageName() + suffix);
}
- return prefix + GetComponentPackageName(&Components[componentName]) + suffix;
+ return prefix +
+ this->GetComponentPackageName(&this->Components[componentName]) + suffix;
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
- ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end()) {
+ ComponentsMap::iterator cit = this->Components.find(componentName);
+ if (cit != this->Components.end()) {
return &(cit->second);
}
cmCPackComponent* component =
- cmCPackGenerator::GetComponent(projectName, componentName);
+ this->cmCPackGenerator::GetComponent(projectName, componentName);
if (!component) {
return component;
}
- std::string name = GetComponentPackageName(component);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetComponentPackageName(component);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return component;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromComponent(component)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- ComponentPackages.insert(
+ this->ComponentPackages.insert(
std::pair<cmCPackComponent*, cmCPackIFWPackage*>(component, package));
if (component->IsDownloaded) {
- DownloadedPackages.insert(package);
+ this->DownloadedPackages.insert(package);
} else {
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
}
} else {
- Packages.erase(name);
+ this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \""
<< name << "\" for component \"" << component->Name
<< "\"" << std::endl);
@@ -374,29 +382,29 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
const std::string& projectName, const std::string& groupName)
{
cmCPackComponentGroup* group =
- cmCPackGenerator::GetComponentGroup(projectName, groupName);
+ this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
if (!group) {
return group;
}
- std::string name = GetGroupPackageName(group);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetGroupPackageName(group);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return group;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromGroup(group)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- GroupPackages.insert(
+ this->GroupPackages.insert(
std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(group, package));
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
} else {
- Packages.erase(name);
+ this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \""
<< name << "\" for component group \"" << group->Name
<< "\"" << std::endl);
@@ -422,7 +430,7 @@ bool cmCPackIFWGenerator::SupportsComponentInstallation() const
bool cmCPackIFWGenerator::IsOnePackage() const
{
- return componentPackageMethod == ONE_PACKAGE;
+ return this->componentPackageMethod == cmCPackGenerator::ONE_PACKAGE;
}
std::string cmCPackIFWGenerator::GetRootPackageName()
@@ -455,16 +463,16 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
if (!group) {
return name;
}
- if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
+ if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) {
return package->Name;
}
const char* option =
- GetOption("CPACK_IFW_COMPONENT_GROUP_" +
- cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
+ this->GetOption("CPACK_IFW_COMPONENT_GROUP_" +
+ cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
name = option ? option : group->Name;
if (group->ParentGroup) {
- cmCPackIFWPackage* package = GetGroupPackage(group->ParentGroup);
- bool dot = !ResolveDuplicateNames;
+ cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup);
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -482,20 +490,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
if (!component) {
return name;
}
- if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
+ if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) {
return package->Name;
}
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
- const char* option = GetOption(prefix + "NAME");
+ const char* option = this->GetOption(prefix + "NAME");
name = option ? option : component->Name;
if (component->Group) {
- cmCPackIFWPackage* package = GetGroupPackage(component->Group);
- if ((componentPackageMethod == ONE_PACKAGE_PER_GROUP) ||
- IsOn(prefix + "COMMON")) {
+ cmCPackIFWPackage* package = this->GetGroupPackage(component->Group);
+ if ((this->componentPackageMethod ==
+ cmCPackGenerator::ONE_PACKAGE_PER_GROUP) ||
+ this->IsOn(prefix + "COMMON")) {
return package->Name;
}
- bool dot = !ResolveDuplicateNames;
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -510,37 +519,37 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
cmCPackComponentGroup* group) const
{
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
- GroupPackages.find(group);
- return pit != GroupPackages.end() ? pit->second : CM_NULLPTR;
+ this->GroupPackages.find(group);
+ return pit != this->GroupPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
cmCPackComponent* component) const
{
std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
- ComponentPackages.find(component);
- return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR;
+ this->ComponentPackages.find(component);
+ return pit != this->ComponentPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
- RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end()) {
+ RepositoriesMap::iterator rit = this->Repositories.find(repositoryName);
+ if (rit != this->Repositories.end()) {
return &(rit->second);
}
- cmCPackIFWRepository* repository = &Repositories[repositoryName];
+ cmCPackIFWRepository* repository = &this->Repositories[repositoryName];
repository->Name = repositoryName;
repository->Generator = this;
if (repository->ConfigureFromOptions()) {
if (repository->Update == cmCPackIFWRepository::None) {
- Installer.RemoteRepositories.push_back(repository);
+ this->Installer.RemoteRepositories.push_back(repository);
} else {
- Repository.RepositoryUpdate.push_back(repository);
+ this->Repository.RepositoryUpdate.push_back(repository);
}
} else {
- Repositories.erase(repositoryName);
+ this->Repositories.erase(repositoryName);
repository = CM_NULLPTR;
cmCPackIFWLogger(WARNING, "Invalid repository \""
<< repositoryName << "\""