diff options
author | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2021-01-05 12:32:36 (GMT) |
---|---|---|
committer | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2021-01-05 12:32:36 (GMT) |
commit | 209daa20b2bd2ee2a76e70af58e895647f7e284f (patch) | |
tree | 081f3192927b19325f40c0da459a11e5b5a5784b /Source/CPack | |
parent | 764ce15ffbe232347a41e40509a2e485bae226f6 (diff) | |
download | CMake-209daa20b2bd2ee2a76e70af58e895647f7e284f.zip CMake-209daa20b2bd2ee2a76e70af58e895647f7e284f.tar.gz CMake-209daa20b2bd2ee2a76e70af58e895647f7e284f.tar.bz2 |
Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 8 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.h | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWRepository.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 63 | ||||
-rw-r--r-- | Source/CPack/cmCPackComponentGroup.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 183 | ||||
-rw-r--r-- | Source/CPack/cmCPackExternalGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 65 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 32 | ||||
-rw-r--r-- | Source/CPack/cmCPackNuGetGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/CPack/cmCPackRPMGenerator.cxx | 65 | ||||
-rw-r--r-- | Source/CPack/cmCPackSTGZGenerator.cxx | 2 |
13 files changed, 245 insertions, 226 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 8e00ad6..359fc56 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -66,7 +66,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) { this->Publisher = optIFW_PACKAGE_PUBLISHER; } else if (const char* optPACKAGE_VENDOR = - GetOption("CPACK_PACKAGE_VENDOR")) { + this->GetOption("CPACK_PACKAGE_VENDOR")) { this->Publisher = optPACKAGE_VENDOR; } @@ -204,7 +204,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) { this->StartMenuDir = optIFW_START_MENU_DIR; } else { - this->StartMenuDir = Name; + this->StartMenuDir = this->Name; } // Default target directory for installation @@ -303,7 +303,7 @@ protected: void StartElement(const std::string& name, const char** /*atts*/) override { this->file = name == "file"; - if (file) { + if (this->file) { this->hasFiles = true; } } @@ -337,7 +337,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.StartDocument(); - WriteGeneratedByToStrim(xout); + this->WriteGeneratedByToStrim(xout); xout.StartElement("Installer"); @@ -535,7 +535,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles() package.ConfigureFromGroup(option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; - if (!GetOption(forcedOption)) { + if (!this->GetOption(forcedOption)) { package.ForcedInstallation = "true"; } } else { diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 56a74c5..c4bd7f1 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -337,7 +337,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) group.Name = groupName; - if (Generator) { + if (this->Generator) { this->Name = this->Generator->GetGroupPackageName(&group); } else { this->Name = group.Name; @@ -530,7 +530,7 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.StartDocument(); - WriteGeneratedByToStrim(xout); + this->WriteGeneratedByToStrim(xout); xout.StartElement("Package"); @@ -577,7 +577,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // User Interfaces (copy to meta dir) - std::vector<std::string> userInterfaces = UserInterfaces; + std::vector<std::string> userInterfaces = this->UserInterfaces; for (std::string& userInterface : userInterfaces) { std::string name = cmSystemTools::GetFilenameName(userInterface); std::string path = this->Directory + "/meta/" + name; @@ -593,7 +593,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Translations (copy to meta dir) - std::vector<std::string> translations = Translations; + std::vector<std::string> translations = this->Translations; for (std::string& translation : translations) { std::string name = cmSystemTools::GetFilenameName(translation); std::string path = this->Directory + "/meta/" + name; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index dbd5540..0cc6f2f 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -53,7 +53,7 @@ public: bool operator<(const DependenceStruct& other) const { - return Name < other.Name; + return this->Name < other.Name; } }; diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index f5e8744..1287907 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -46,9 +46,9 @@ bool cmCPackIFWRepository::ConfigureFromOptions() // Update if (this->IsOn(prefix + "ADD")) { this->Update = cmCPackIFWRepository::Add; - } else if (IsOn(prefix + "REMOVE")) { + } else if (this->IsOn(prefix + "REMOVE")) { this->Update = cmCPackIFWRepository::Remove; - } else if (IsOn(prefix + "REPLACE")) { + } else if (this->IsOn(prefix + "REPLACE")) { this->Update = cmCPackIFWRepository::Replace; } else { this->Update = cmCPackIFWRepository::None; @@ -247,7 +247,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) if (this->Update == cmCPackIFWRepository::Add || this->Update == cmCPackIFWRepository::Remove) { xout.Attribute("url", this->Url); - } else if (Update == cmCPackIFWRepository::Replace) { + } else if (this->Update == cmCPackIFWRepository::Replace) { xout.Attribute("oldUrl", this->OldUrl); xout.Attribute("newUrl", this->NewUrl); } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 967cc60..5348f86 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -80,10 +80,10 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( packageFileName += this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME"); } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { - packageFileName += GetComponentPackageFileName( + packageFileName += this->GetComponentPackageFileName( this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); } else { - packageFileName += GetComponentPackageFileName( + packageFileName += this->GetComponentPackageFileName( this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); } @@ -181,7 +181,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { - packageFileNames.clear(); + this->packageFileNames.clear(); // The default behavior is to have one package by component group // unless CPACK_COMPONENTS_IGNORE_GROUP is specified. if (!ignoreGroup) { @@ -189,7 +189,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " << compG.first << std::endl); // Begin the archive for this group - std::string packageFileName = std::string(toplevel) + "/" + + std::string packageFileName = std::string(this->toplevel) + "/" + this->GetArchiveComponentFileName(compG.first, true); // open a block in order to automatically close archive @@ -199,11 +199,11 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) // now iterate over the component of this group for (cmCPackComponent* comp : (compG.second).Components) { // Add the files of this component to the archive - addOneComponentToArchive(archive, comp); + this->addOneComponentToArchive(archive, comp); } } // add the generated package to package file names list - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); } // Handle Orphan components (components not belonging to any groups) for (auto& comp : this->Components) { @@ -217,7 +217,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) << std::endl); std::string localToplevel( this->GetOption("CPACK_TEMPORARY_DIRECTORY")); - std::string packageFileName = std::string(toplevel); + std::string packageFileName = std::string(this->toplevel); localToplevel += "/" + comp.first; packageFileName += @@ -226,10 +226,10 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); // Add the files of this component to the archive - addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second)); } // add the generated package to package file names list - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); } } } @@ -238,7 +238,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) else { for (auto& comp : this->Components) { std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); - std::string packageFileName = std::string(toplevel); + std::string packageFileName = std::string(this->toplevel); localToplevel += "/" + comp.first; packageFileName += @@ -247,10 +247,10 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); // Add the files of this component to the archive - addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second)); } // add the generated package to package file names list - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); } } return 1; @@ -259,17 +259,17 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) int cmCPackArchiveGenerator::PackageComponentsAllInOne() { // reset the package file names - packageFileNames.clear(); - packageFileNames.emplace_back(toplevel); - packageFileNames[0] += "/"; + this->packageFileNames.clear(); + this->packageFileNames.emplace_back(this->toplevel); + this->packageFileNames[0] += "/"; if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { - packageFileNames[0] += this->GetOption("CPACK_ARCHIVE_FILE_NAME"); + this->packageFileNames[0] += this->GetOption("CPACK_ARCHIVE_FILE_NAME"); } else { - packageFileNames[0] += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + this->packageFileNames[0] += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } - packageFileNames[0] += this->GetOutputExtension(); + this->packageFileNames[0] += this->GetOutputExtension(); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging all groups in one package..." @@ -280,7 +280,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne() // The ALL COMPONENTS in ONE package case for (auto& comp : this->Components) { // Add the files of this component to the archive - addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second)); } // archive goes out of scope so it will finalized and closed. @@ -289,41 +289,42 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne() int cmCPackArchiveGenerator::PackageFiles() { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Toplevel: " << this->toplevel << std::endl); - if (WantsComponentInstallation()) { + if (this->WantsComponentInstallation()) { // CASE 1 : COMPONENT ALL-IN-ONE package // If ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne(); + if (this->componentPackageMethod == ONE_PACKAGE) { + return this->PackageComponentsAllInOne(); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); + return this->PackageComponents(this->componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive); - cmWorkingDirectory workdir(toplevel); + cmWorkingDirectory workdir(this->toplevel); if (workdir.Failed()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Failed to change working directory to " - << toplevel << " : " + << this->toplevel << " : " << std::strerror(workdir.GetLastResult()) << std::endl); return 0; } - for (std::string const& file : files) { + for (std::string const& file : this->files) { // Get the relative path to the file - std::string rp = cmSystemTools::RelativePath(toplevel, file); + std::string rp = cmSystemTools::RelativePath(this->toplevel, file); archive.Add(rp, 0, nullptr, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file <" - << file << "> to archive <" << packageFileNames[0] + << file << "> to archive <" << this->packageFileNames[0] << ">, ERROR = " << archive.GetError() << std::endl); return 0; } @@ -342,7 +343,7 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const // The Component installation support should only // be activated if explicitly requested by the user // (for backward compatibility reason) - return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"); + return this->IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"); } bool cmCPackArchiveGenerator::SetArchiveOptions(cmArchiveWrite* archive) diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index d40e5fc..4305c7e 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -25,6 +25,6 @@ unsigned long cmCPackComponent::GetInstalledSize( unsigned long cmCPackComponent::GetInstalledSizeInKbytes( const std::string& installDir) const { - unsigned long result = (GetInstalledSize(installDir) + 512) / 1024; + unsigned long result = (this->GetInstalledSize(installDir) + 512) / 1024; return result ? result : 1; } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 6f21d87..43dbdb5 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -96,20 +96,20 @@ DebGenerator::DebGenerator( } if (!strcmp(debianCompressionType, "lzma")) { - CompressionSuffix = ".lzma"; - TarCompressionType = cmArchiveWrite::CompressLZMA; + this->CompressionSuffix = ".lzma"; + this->TarCompressionType = cmArchiveWrite::CompressLZMA; } else if (!strcmp(debianCompressionType, "xz")) { - CompressionSuffix = ".xz"; - TarCompressionType = cmArchiveWrite::CompressXZ; + this->CompressionSuffix = ".xz"; + this->TarCompressionType = cmArchiveWrite::CompressXZ; } else if (!strcmp(debianCompressionType, "bzip2")) { - CompressionSuffix = ".bz2"; - TarCompressionType = cmArchiveWrite::CompressBZip2; + this->CompressionSuffix = ".bz2"; + this->TarCompressionType = cmArchiveWrite::CompressBZip2; } else if (!strcmp(debianCompressionType, "gzip")) { - CompressionSuffix = ".gz"; - TarCompressionType = cmArchiveWrite::CompressGZip; + this->CompressionSuffix = ".gz"; + this->TarCompressionType = cmArchiveWrite::CompressGZip; } else if (!strcmp(debianCompressionType, "none")) { - CompressionSuffix.clear(); - TarCompressionType = cmArchiveWrite::CompressNone; + this->CompressionSuffix.clear(); + this->TarCompressionType = cmArchiveWrite::CompressNone; } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error unrecognized compression type: " @@ -119,22 +119,22 @@ DebGenerator::DebGenerator( bool DebGenerator::generate() const { - generateDebianBinaryFile(); - generateControlFile(); - if (!generateDataTar()) { + this->generateDebianBinaryFile(); + this->generateControlFile(); + if (!this->generateDataTar()) { return false; } - std::string md5Filename = generateMD5File(); - if (!generateControlTar(md5Filename)) { + std::string md5Filename = this->generateMD5File(); + if (!this->generateControlTar(md5Filename)) { return false; } - return generateDeb(); + return this->generateDeb(); } void DebGenerator::generateDebianBinaryFile() const { // debian-binary file - const std::string dbfilename = WorkDir + "/debian-binary"; + const std::string dbfilename = this->WorkDir + "/debian-binary"; cmGeneratedFileStream out; out.Open(dbfilename, false, true); out << "2.0\n"; // required for valid debian package @@ -142,18 +142,18 @@ void DebGenerator::generateDebianBinaryFile() const void DebGenerator::generateControlFile() const { - std::string ctlfilename = WorkDir + "/control"; + std::string ctlfilename = this->WorkDir + "/control"; cmGeneratedFileStream out; out.Open(ctlfilename, false, true); - for (auto const& kv : ControlValues) { + for (auto const& kv : this->ControlValues) { out << kv.first << ": " << kv.second << "\n"; } unsigned long totalSize = 0; { - std::string dirName = cmStrCat(TemporaryDir, '/'); - for (std::string const& file : PackageFiles) { + std::string dirName = cmStrCat(this->TemporaryDir, '/'); + for (std::string const& file : this->PackageFiles) { totalSize += cmSystemTools::FileLength(file); } } @@ -162,7 +162,8 @@ void DebGenerator::generateControlFile() const bool DebGenerator::generateDataTar() const { - std::string filename_data_tar = WorkDir + "/data.tar" + CompressionSuffix; + std::string filename_data_tar = + this->WorkDir + "/data.tar" + this->CompressionSuffix; cmGeneratedFileStream fileStream_data_tar; fileStream_data_tar.Open(filename_data_tar, false, true); if (!fileStream_data_tar) { @@ -171,8 +172,8 @@ bool DebGenerator::generateDataTar() const << filename_data_tar << "\" for writing" << std::endl); return false; } - cmArchiveWrite data_tar(fileStream_data_tar, TarCompressionType, - DebianArchiveType); + cmArchiveWrite data_tar(fileStream_data_tar, this->TarCompressionType, + this->DebianArchiveType); data_tar.Open(); // uid/gid should be the one of the root user, and this root user has @@ -184,16 +185,16 @@ bool DebGenerator::generateDataTar() const // collect all top level install dirs for that // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would // give /usr and /opt - size_t topLevelLength = WorkDir.length(); + size_t topLevelLength = this->WorkDir.length(); cmCPackLogger(cmCPackLog::LOG_DEBUG, - "WDIR: \"" << WorkDir << "\", length = " << topLevelLength - << std::endl); + "WDIR: \"" << this->WorkDir + << "\", length = " << topLevelLength << std::endl); std::set<std::string> orderedFiles; // we have to reconstruct the parent folders as well - for (std::string currentPath : PackageFiles) { - while (currentPath != WorkDir) { + for (std::string currentPath : this->PackageFiles) { + while (currentPath != this->WorkDir) { // the last one IS WorkDir, but we do not want this one: // XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application // should not add XXX/application @@ -235,7 +236,7 @@ bool DebGenerator::generateDataTar() const cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem adding file to tar:" << std::endl - << "#top level directory: " << WorkDir << std::endl + << "#top level directory: " << this->WorkDir << std::endl << "#file: " << file << std::endl << "#error:" << data_tar.GetError() << std::endl); return false; @@ -246,13 +247,13 @@ bool DebGenerator::generateDataTar() const std::string DebGenerator::generateMD5File() const { - std::string md5filename = WorkDir + "/md5sums"; + std::string md5filename = this->WorkDir + "/md5sums"; cmGeneratedFileStream out; out.Open(md5filename, false, true); - std::string topLevelWithTrailingSlash = cmStrCat(TemporaryDir, '/'); - for (std::string const& file : PackageFiles) { + std::string topLevelWithTrailingSlash = cmStrCat(this->TemporaryDir, '/'); + for (std::string const& file : this->PackageFiles) { // hash only regular files if (cmSystemTools::FileIsDirectory(file) || cmSystemTools::FileIsSymlink(file)) { @@ -281,7 +282,7 @@ std::string DebGenerator::generateMD5File() const bool DebGenerator::generateControlTar(std::string const& md5Filename) const { - std::string filename_control_tar = WorkDir + "/control.tar.gz"; + std::string filename_control_tar = this->WorkDir + "/control.tar.gz"; cmGeneratedFileStream fileStream_control_tar; fileStream_control_tar.Open(filename_control_tar, false, true); @@ -292,7 +293,8 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const return false; } cmArchiveWrite control_tar(fileStream_control_tar, - cmArchiveWrite::CompressGZip, DebianArchiveType); + cmArchiveWrite::CompressGZip, + this->DebianArchiveType); control_tar.Open(); // sets permissions and uid/gid for the files @@ -314,24 +316,25 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const control_tar.SetPermissions(permission644); // adds control and md5sums - if (!control_tar.Add(md5Filename, WorkDir.length(), ".") || - !control_tar.Add(WorkDir + "/control", WorkDir.length(), ".")) { + if (!control_tar.Add(md5Filename, this->WorkDir.length(), ".") || + !control_tar.Add(this->WorkDir + "/control", this->WorkDir.length(), + ".")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding file to tar:" << std::endl - << "#top level directory: " << WorkDir << std::endl + << "#top level directory: " << this->WorkDir << std::endl << "#file: \"control\" or \"md5sums\"" << std::endl << "#error:" << control_tar.GetError() << std::endl); return false; } // adds generated shlibs file - if (GenShLibs) { - if (!control_tar.Add(ShLibsFilename, WorkDir.length(), ".")) { + if (this->GenShLibs) { + if (!control_tar.Add(this->ShLibsFilename, this->WorkDir.length(), ".")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding file to tar:" << std::endl - << "#top level directory: " << WorkDir << std::endl + << "#top level directory: " << this->WorkDir << std::endl << "#file: \"shlibs\"" << std::endl << "#error:" << control_tar.GetError() << std::endl); return false; @@ -339,13 +342,13 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const } // adds LDCONFIG related files - if (GenPostInst) { + if (this->GenPostInst) { control_tar.SetPermissions(permission755); - if (!control_tar.Add(PostInst, WorkDir.length(), ".")) { + if (!control_tar.Add(this->PostInst, this->WorkDir.length(), ".")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding file to tar:" << std::endl - << "#top level directory: " << WorkDir << std::endl + << "#top level directory: " << this->WorkDir << std::endl << "#file: \"postinst\"" << std::endl << "#error:" << control_tar.GetError() << std::endl); return false; @@ -353,13 +356,13 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const control_tar.SetPermissions(permission644); } - if (GenPostRm) { + if (this->GenPostRm) { control_tar.SetPermissions(permission755); - if (!control_tar.Add(PostRm, WorkDir.length(), ".")) { + if (!control_tar.Add(this->PostRm, this->WorkDir.length(), ".")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding file to tar:" << std::endl - << "#top level directory: " << WorkDir << std::endl + << "#top level directory: " << this->WorkDir << std::endl << "#file: \"postinst\"" << std::endl << "#error:" << control_tar.GetError() << std::endl); return false; @@ -370,7 +373,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const // for the other files, we use // -either the original permission on the files // -either a permission strictly defined by the Debian policies - if (ControlExtra) { + if (this->ControlExtra) { // permissions are now controlled by the original file permissions static const char* strictFiles[] = { "config", "postinst", "postrm", @@ -381,19 +384,20 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const // default control_tar.ClearPermissions(); - std::vector<std::string> controlExtraList = cmExpandedList(ControlExtra); + std::vector<std::string> controlExtraList = + cmExpandedList(this->ControlExtra); for (std::string const& i : controlExtraList) { std::string filenamename = cmsys::SystemTools::GetFilenameName(i); - std::string localcopy = WorkDir + "/" + filenamename; + std::string localcopy = this->WorkDir + "/" + filenamename; - if (PermissionStrictPolicy) { + if (this->PermissionStrictPolicy) { control_tar.SetPermissions( setStrictFiles.count(filenamename) ? permission755 : permission644); } // if we can copy the file, it means it does exist, let's add it: if (cmsys::SystemTools::CopyFileIfDifferent(i, localcopy)) { - control_tar.Add(localcopy, WorkDir.length(), "."); + control_tar.Add(localcopy, this->WorkDir.length(), "."); } } } @@ -408,8 +412,8 @@ bool DebGenerator::generateDeb() const // difference is that debian uses the BSD ar style archive whereas most // Linux distro have a GNU ar. // See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=161593 for more info - std::string const outputPath = TopLevelDir + "/" + OutputName; - std::string const tlDir = WorkDir + "/"; + std::string const outputPath = this->TopLevelDir + "/" + this->OutputName; + std::string const tlDir = this->WorkDir + "/"; cmGeneratedFileStream debStream; debStream.Open(outputPath, false, true); cmArchiveWrite deb(debStream, cmArchiveWrite::CompressNone, "arbsd"); @@ -422,12 +426,13 @@ bool DebGenerator::generateDeb() const if (!deb.Add(tlDir + "debian-binary", tlDir.length()) || !deb.Add(tlDir + "control.tar.gz", tlDir.length()) || - !deb.Add(tlDir + "data.tar" + CompressionSuffix, tlDir.length())) { + !deb.Add(tlDir + "data.tar" + this->CompressionSuffix, tlDir.length())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error creating debian package:" << std::endl - << "#top level directory: " << TopLevelDir << std::endl - << "#file: " << OutputName << std::endl + << "#top level directory: " << this->TopLevelDir + << std::endl + << "#file: " << this->OutputName << std::endl << "#error:" << deb.GetError() << std::endl); return false; } @@ -455,7 +460,8 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, int retval = 1; // Begin the archive for this pack std::string localToplevel(initialTopLevel); - std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); + std::string packageFileName( + cmSystemTools::GetParentDirectory(this->toplevel)); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + "-" + packageName + this->GetOutputExtension()); @@ -495,17 +501,17 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, << std::endl); return 0; } - packageFiles = gl.GetFiles(); + this->packageFiles = gl.GetFiles(); } - int res = createDeb(); + int res = this->createDeb(); if (res != 1) { retval = 0; } // add the generated package to package file names list packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/', this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME")); - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE") && this->GetOption("GEN_DBGSYMDIR")) { @@ -521,9 +527,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, << std::endl); return 0; } - packageFiles = gl.GetFiles(); + this->packageFiles = gl.GetFiles(); - res = createDbgsymDDeb(); + res = this->createDbgsymDDeb(); if (res != 1) { retval = 0; } @@ -531,7 +537,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/', this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME")); - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); } return retval; @@ -542,7 +548,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) int retval = 1; /* Reset package file name list it will be populated during the * component packaging run*/ - packageFileNames.clear(); + this->packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); // The default behavior is to have one package by component group @@ -552,7 +558,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " << compG.first << std::endl); // Begin the archive for this group - retval &= PackageOnePack(initialTopLevel, compG.first); + retval &= this->PackageOnePack(initialTopLevel, compG.first); } // Handle Orphan components (components not belonging to any groups) for (auto const& comp : this->Components) { @@ -565,7 +571,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) << "> does not belong to any group, package it separately." << std::endl); // Begin the archive for this orphan component - retval &= PackageOnePack(initialTopLevel, comp.first); + retval &= this->PackageOnePack(initialTopLevel, comp.first); } } } @@ -573,7 +579,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) // We build 1 package per component else { for (auto const& comp : this->Components) { - retval &= PackageOnePack(initialTopLevel, comp.first); + retval &= this->PackageOnePack(initialTopLevel, comp.first); } } return retval; @@ -586,7 +592,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( int retval = 1; /* Reset package file name list it will be populated during the * component packaging run*/ - packageFileNames.clear(); + this->packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); cmCPackLogger(cmCPackLog::LOG_VERBOSE, @@ -596,7 +602,8 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( // The ALL GROUPS in ONE package case std::string localToplevel(initialTopLevel); - std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); + std::string packageFileName( + cmSystemTools::GetParentDirectory(this->toplevel)); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + this->GetOutputExtension()); @@ -641,38 +648,38 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( << std::endl); return 0; } - packageFiles = gl.GetFiles(); + this->packageFiles = gl.GetFiles(); - int res = createDeb(); + int res = this->createDeb(); if (res != 1) { retval = 0; } // add the generated package to package file names list packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/', this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME")); - packageFileNames.push_back(std::move(packageFileName)); + this->packageFileNames.push_back(std::move(packageFileName)); return retval; } int cmCPackDebGenerator::PackageFiles() { /* Are we in the component packaging case */ - if (WantsComponentInstallation()) { + if (this->WantsComponentInstallation()) { // CASE 1 : COMPONENT ALL-IN-ONE package // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne("ALL_COMPONENTS_IN_ONE"); + if (this->componentPackageMethod == ONE_PACKAGE) { + return this->PackageComponentsAllInOne("ALL_COMPONENTS_IN_ONE"); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); + return this->PackageComponents(this->componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - return PackageComponentsAllInOne(""); + return this->PackageComponentsAllInOne(""); } int cmCPackDebGenerator::createDeb() @@ -787,7 +794,7 @@ int cmCPackDebGenerator::createDeb() } DebGenerator gen( - Logger, this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"), strGenWDIR, + this->Logger, this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"), strGenWDIR, this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), this->GetOption("CPACK_TEMPORARY_DIRECTORY"), this->GetOption("GEN_CPACK_DEBIAN_COMPRESSION_TYPE"), @@ -796,7 +803,7 @@ int cmCPackDebGenerator::createDeb() this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTRM"), postrm, this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA"), this->IsSet("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION"), - packageFiles); + this->packageFiles); if (!gen.generate()) { return 0; @@ -842,7 +849,7 @@ int cmCPackDebGenerator::createDbgsymDDeb() } DebGenerator gen( - Logger, this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME"), + this->Logger, this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME"), this->GetOption("GEN_DBGSYMDIR"), this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), @@ -851,7 +858,7 @@ int cmCPackDebGenerator::createDbgsymDDeb() this->GetOption("GEN_CPACK_DEBIAN_ARCHIVE_TYPE"), controlValues, false, "", false, "", false, "", nullptr, this->IsSet("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION"), - packageFiles); + this->packageFiles); if (!gen.generate()) { return 0; @@ -861,25 +868,25 @@ int cmCPackDebGenerator::createDbgsymDDeb() bool cmCPackDebGenerator::SupportsComponentInstallation() const { - return IsOn("CPACK_DEB_COMPONENT_INSTALL"); + return this->IsOn("CPACK_DEB_COMPONENT_INSTALL"); } std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( const std::string& componentName) { - if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { + if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; } - if (componentPackageMethod == ONE_PACKAGE) { + if (this->componentPackageMethod == ONE_PACKAGE) { return std::string("ALL_COMPONENTS_IN_ONE"); } // We have to find the name of the COMPONENT GROUP // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (nullptr != GetOption(groupVar)) { - return std::string(GetOption(groupVar)); + if (nullptr != this->GetOption(groupVar)) { + return std::string(this->GetOption(groupVar)); } return componentName; } diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 0bc8456..e3521a0 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -95,7 +95,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstallCommands( bool setDestDir, const std::string& tempInstallDirectory) { if (this->StagingEnabled()) { - return cmCPackGenerator::InstallProjectViaInstallCommands( + return this->cmCPackGenerator::InstallProjectViaInstallCommands( setDestDir, tempInstallDirectory); } @@ -106,7 +106,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstallScript( bool setDestDir, const std::string& tempInstallDirectory) { if (this->StagingEnabled()) { - return cmCPackGenerator::InstallProjectViaInstallScript( + return this->cmCPackGenerator::InstallProjectViaInstallScript( setDestDir, tempInstallDirectory); } @@ -118,7 +118,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories( const mode_t* default_dir_mode) { if (this->StagingEnabled()) { - return cmCPackGenerator::InstallProjectViaInstalledDirectories( + return this->cmCPackGenerator::InstallProjectViaInstalledDirectories( setDestDir, tempInstallDirectory, default_dir_mode); } @@ -130,7 +130,7 @@ int cmCPackExternalGenerator::RunPreinstallTarget( cmGlobalGenerator* globalGenerator, const std::string& buildConfig) { if (this->StagingEnabled()) { - return cmCPackGenerator::RunPreinstallTarget( + return this->cmCPackGenerator::RunPreinstallTarget( installProjectName, installDirectory, globalGenerator, buildConfig); } @@ -145,7 +145,7 @@ int cmCPackExternalGenerator::InstallCMakeProject( std::string& absoluteDestFiles) { if (this->StagingEnabled()) { - return cmCPackGenerator::InstallCMakeProject( + return this->cmCPackGenerator::InstallCMakeProject( setDestDir, installDirectory, baseTempInstallDirectory, default_dir_mode, component, componentInstall, installSubDirectory, buildConfig, absoluteDestFiles); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 8b544b4..3db4162 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -60,18 +60,18 @@ int cmCPackGenerator::PrepareNames() cmCPackLogger(cmCPackLog::LOG_DEBUG, "Create temp directory." << std::endl); // checks CPACK_SET_DESTDIR support - if (IsOn("CPACK_SET_DESTDIR")) { - if (SETDESTDIR_UNSUPPORTED == SupportsSetDestdir()) { + if (this->IsOn("CPACK_SET_DESTDIR")) { + if (SETDESTDIR_UNSUPPORTED == this->SupportsSetDestdir()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_SET_DESTDIR is set to ON but the '" - << Name << "' generator does NOT support it." + << this->Name << "' generator does NOT support it." << std::endl); return 0; } - if (SETDESTDIR_SHOULD_NOT_BE_USED == SupportsSetDestdir()) { + if (SETDESTDIR_SHOULD_NOT_BE_USED == this->SupportsSetDestdir()) { cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_SET_DESTDIR is set to ON but it is " - << "usually a bad idea to do that with '" << Name + << "usually a bad idea to do that with '" << this->Name << "' generator. Use at your own risk." << std::endl); } } @@ -380,8 +380,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( << std::endl); return 0; } - files = gl.GetFiles(); - for (std::string const& gf : files) { + this->files = gl.GetFiles(); + for (std::string const& gf : this->files) { bool skip = false; std::string inFile = gf; if (cmSystemTools::FileIsDirectory(gf)) { @@ -763,7 +763,7 @@ int cmCPackGenerator::InstallCMakeProject( // one install directory for each component **GROUP** // instead of the default // one install directory for each component. - tempInstallDirectory += GetComponentInstallDirNameSuffix(component); + tempInstallDirectory += this->GetComponentInstallDirNameSuffix(component); if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { tempInstallDirectory += "/"; tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); @@ -897,7 +897,7 @@ int cmCPackGenerator::InstallCMakeProject( // 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) - if (!SupportsAbsoluteDestination() || + if (!this->SupportsAbsoluteDestination() || this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); } @@ -933,7 +933,7 @@ int cmCPackGenerator::InstallCMakeProject( localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); localFileName = localFileName.substr(localFileName.find_first_not_of('/')); - Components[component].Files.push_back(localFileName); + this->Components[component].Files.push_back(localFileName); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <" << localFileName << "> to component <" << component << ">" << std::endl); @@ -952,7 +952,7 @@ int cmCPackGenerator::InstallCMakeProject( if (componentInstall) { std::string absoluteDestFileComponent = std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + - GetComponentInstallDirNameSuffix(component); + this->GetComponentInstallDirNameSuffix(component); if (nullptr != this->GetOption(absoluteDestFileComponent)) { std::string absoluteDestFilesListComponent = cmStrCat(this->GetOption(absoluteDestFileComponent), ';', *d); @@ -1073,17 +1073,17 @@ int cmCPackGenerator::DoPackage() } // The files to be installed - files = gl.GetFiles(); + this->files = gl.GetFiles(); - packageFileNames.clear(); + 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) */ - packageFileNames.emplace_back(tempPackageFileName ? tempPackageFileName - : ""); - toplevel = tempDirectory; + this->packageFileNames.emplace_back(tempPackageFileName ? tempPackageFileName + : ""); + this->toplevel = tempDirectory; { // scope that enables package generators to run internal scripts with // latest CMake policies enabled cmMakefile::ScopePushPop pp{ this->MakefileMap }; @@ -1127,10 +1127,10 @@ int cmCPackGenerator::DoPackage() * (because the specific generator did 'normalize' it) */ cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Copying final package(s) [" << packageFileNames.size() + "Copying final package(s) [" << this->packageFileNames.size() << "]:" << std::endl); /* now copy package one by one */ - for (std::string const& pkgFileName : packageFileNames) { + for (std::string const& pkgFileName : this->packageFileNames) { std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX")); std::string filename(cmSystemTools::GetFilenameName(pkgFileName)); tempPackageFileName = pkgFileName.c_str(); @@ -1211,7 +1211,7 @@ bool cmCPackGenerator::IsSet(const std::string& name) const bool cmCPackGenerator::IsOn(const std::string& name) const { - return cmIsOn(GetOption(name)); + return cmIsOn(this->GetOption(name)); } bool cmCPackGenerator::IsSetToOff(const std::string& op) const @@ -1405,7 +1405,7 @@ int cmCPackGenerator::PrepareGroupingKind() // fallback to default if not group based if (method == ONE_PACKAGE_PER_GROUP && this->ComponentGroups.empty() && !this->Components.empty()) { - if (componentPackageMethod == ONE_PACKAGE) { + if (this->componentPackageMethod == ONE_PACKAGE) { method = ONE_PACKAGE; } else { method = ONE_PACKAGE_PER_COMPONENT; @@ -1421,7 +1421,7 @@ int cmCPackGenerator::PrepareGroupingKind() // if user specified packaging method, override the default packaging // method if (method != UNKNOWN_COMPONENT_PACKAGE_METHOD) { - componentPackageMethod = method; + this->componentPackageMethod = method; } const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE_GROUPS", @@ -1430,7 +1430,8 @@ int cmCPackGenerator::PrepareGroupingKind() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" << this->Name << "]" << " requested component grouping = " - << method_names[componentPackageMethod] << std::endl); + << method_names[this->componentPackageMethod] + << std::endl); return 1; } @@ -1451,13 +1452,14 @@ std::string cmCPackGenerator::GetComponentPackageFileName( */ std::string suffix = "-" + groupOrComponentName; /* check if we should use DISPLAY name */ - std::string dispNameVar = "CPACK_" + Name + "_USE_DISPLAY_NAME_IN_FILENAME"; - if (IsOn(dispNameVar)) { + std::string dispNameVar = + "CPACK_" + this->Name + "_USE_DISPLAY_NAME_IN_FILENAME"; + if (this->IsOn(dispNameVar)) { /* the component Group case */ if (isGroupName) { std::string groupDispVar = "CPACK_COMPONENT_GROUP_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* groupDispName = GetOption(groupDispVar); + const char* groupDispName = this->GetOption(groupDispVar); if (groupDispName) { suffix = "-" + std::string(groupDispName); } @@ -1466,7 +1468,7 @@ std::string cmCPackGenerator::GetComponentPackageFileName( else { std::string dispVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* dispName = GetOption(dispVar); + const char* dispName = this->GetOption(dispVar); if (dispName) { suffix = "-" + std::string(dispName); } @@ -1493,8 +1495,8 @@ bool cmCPackGenerator::SupportsComponentInstallation() const bool cmCPackGenerator::WantsComponentInstallation() const { - return (!IsOn("CPACK_MONOLITHIC_INSTALL") && - SupportsComponentInstallation() + return (!this->IsOn("CPACK_MONOLITHIC_INSTALL") && + this->SupportsComponentInstallation() // check that we have at least one group or component && (!this->ComponentGroups.empty() || !this->Components.empty())); } @@ -1557,7 +1559,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( const char* groupName = this->GetOption(macroPrefix + "_GROUP"); if (cmNonempty(groupName)) { - component->Group = GetComponentGroup(projectName, groupName); + component->Group = this->GetComponentGroup(projectName, groupName); component->Group->Components.push_back(component); } else { component->Group = nullptr; @@ -1584,7 +1586,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( if (cmNonempty(depends)) { std::vector<std::string> dependsVector = cmExpandedList(depends); for (std::string const& depend : dependsVector) { - cmCPackComponent* child = GetComponent(projectName, depend); + cmCPackComponent* child = this->GetComponent(projectName, depend); component->Dependencies.push_back(child); child->ReverseDependencies.push_back(component); } @@ -1620,7 +1622,8 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup( const char* parentGroupName = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (cmNonempty(parentGroupName)) { - group->ParentGroup = GetComponentGroup(projectName, parentGroupName); + group->ParentGroup = + this->GetComponentGroup(projectName, parentGroupName); group->ParentGroup->Subgroups.push_back(group); } else { group->ParentGroup = nullptr; diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 2109b4e..435f0ec 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -31,7 +31,7 @@ cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64) { - Nsis64 = nsis64; + this->Nsis64 = nsis64; } cmCPackNSISGenerator::~cmCPackNSISGenerator() = default; @@ -61,18 +61,18 @@ int cmCPackNSISGenerator::PackageFiles() std::string nsisInstallOptions = nsisFileName + "/NSIS.InstallOptions.ini"; nsisFileName += "/project.nsi"; std::ostringstream str; - for (std::string const& file : files) { + for (std::string const& file : this->files) { std::string outputDir = "$INSTDIR"; - std::string fileN = cmSystemTools::RelativePath(toplevel, file); + std::string fileN = cmSystemTools::RelativePath(this->toplevel, file); if (!this->Components.empty()) { const std::string::size_type pos = fileN.find('/'); // Use the custom component install directory if we have one if (pos != std::string::npos) { auto componentName = cm::string_view(fileN).substr(0, pos); - outputDir = CustomComponentInstallDirectory(componentName); + outputDir = this->CustomComponentInstallDirectory(componentName); } else { - outputDir = CustomComponentInstallDirectory(fileN); + outputDir = this->CustomComponentInstallDirectory(fileN); } // Strip off the component part of the path. @@ -86,15 +86,15 @@ int cmCPackNSISGenerator::PackageFiles() "Uninstall Files: " << str.str() << std::endl); this->SetOptionIfNotSet("CPACK_NSIS_DELETE_FILES", str.str().c_str()); std::vector<std::string> dirs; - this->GetListOfSubdirectories(toplevel.c_str(), dirs); + this->GetListOfSubdirectories(this->toplevel.c_str(), dirs); std::ostringstream dstr; for (std::string const& dir : dirs) { std::string componentName; - std::string fileN = cmSystemTools::RelativePath(toplevel, dir); + std::string fileN = cmSystemTools::RelativePath(this->toplevel, dir); if (fileN.empty()) { continue; } - if (!Components.empty()) { + if (!this->Components.empty()) { // If this is a component installation, strip off the component // part of the path. std::string::size_type slash = fileN.find('/'); @@ -110,7 +110,7 @@ int cmCPackNSISGenerator::PackageFiles() std::replace(fileN.begin(), fileN.end(), '/', '\\'); const std::string componentOutputDir = - CustomComponentInstallDirectory(componentName); + this->CustomComponentInstallDirectory(componentName); dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\"" << std::endl; @@ -677,7 +677,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( } const std::string componentOutputDir = - CustomComponentInstallDirectory(component->Name); + this->CustomComponentInstallDirectory(component->Name); componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n"); // Create the actual installation commands @@ -833,14 +833,16 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( // depends on. std::set<cmCPackComponent*> visited; macrosOut << "!macro Select_" << component->Name << "_depends\n"; - macrosOut << CreateSelectionDependenciesDescription(component, visited); + macrosOut << this->CreateSelectionDependenciesDescription(component, + visited); macrosOut << "!macroend\n"; // Macro used to deselect each of the components that depend on this // component. visited.clear(); macrosOut << "!macro Deselect_required_by_" << component->Name << "\n"; - macrosOut << CreateDeselectionDependenciesDescription(component, visited); + macrosOut << this->CreateDeselectionDependenciesDescription(component, + visited); macrosOut << "!macroend\n"; return componentCode; } @@ -862,7 +864,8 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription( out << " SectionSetFlags ${" << depend->Name << "} $0\n"; out << " IntOp $" << depend->Name << "_selected 0 + ${SF_SELECTED}\n"; // Recurse - out << CreateSelectionDependenciesDescription(depend, visited).c_str(); + out + << this->CreateSelectionDependenciesDescription(depend, visited).c_str(); } return out.str(); @@ -887,7 +890,8 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription( out << " IntOp $" << depend->Name << "_selected 0 + 0\n"; // Recurse - out << CreateDeselectionDependenciesDescription(depend, visited).c_str(); + out << this->CreateDeselectionDependenciesDescription(depend, visited) + .c_str(); } return out.str(); diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index 60faecd..98dc890 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -17,32 +17,33 @@ bool cmCPackNuGetGenerator::SupportsComponentInstallation() const { - return IsOn("CPACK_NUGET_COMPONENT_INSTALL"); + return this->IsOn("CPACK_NUGET_COMPONENT_INSTALL"); } int cmCPackNuGetGenerator::PackageFiles() { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Toplevel: " << this->toplevel << std::endl); /* Reset package file name list it will be populated after the * `CPackNuGet.cmake` run */ - packageFileNames.clear(); + this->packageFileNames.clear(); /* Are we in the component packaging case */ - if (WantsComponentInstallation()) { - if (componentPackageMethod == ONE_PACKAGE) { + if (this->WantsComponentInstallation()) { + if (this->componentPackageMethod == ONE_PACKAGE) { // CASE 1 : COMPONENT ALL-IN-ONE package // Meaning that all per-component pre-installed files // goes into the single package. this->SetOption("CPACK_NUGET_ALL_IN_ONE", "TRUE"); - SetupGroupComponentVariables(true); + this->SetupGroupComponentVariables(true); } else { // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - SetupGroupComponentVariables(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); + this->SetupGroupComponentVariables(this->componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } } else { // CASE 3 : NON COMPONENT package. @@ -51,7 +52,7 @@ int cmCPackNuGetGenerator::PackageFiles() auto retval = this->ReadListFile("Internal/CPack/CPackNuGet.cmake"); if (retval) { - AddGeneratedPackageNames(); + this->AddGeneratedPackageNames(); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackNuGet.cmake" << std::endl); @@ -133,9 +134,9 @@ void cmCPackNuGetGenerator::AddGeneratedPackageNames() std::string::size_type pos1 = 0; std::string::size_type pos2 = fileNames.find(sep, pos1 + 1); while (pos2 != std::string::npos) { - packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); + this->packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); pos1 = pos2 + 1; pos2 = fileNames.find(sep, pos1 + 1); } - packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); + this->packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); } diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 0c1cecf..c3f6d59 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -51,11 +51,11 @@ void cmCPackRPMGenerator::AddGeneratedPackageNames() std::string::size_type pos1 = 0; std::string::size_type pos2 = fileNames.find(sep, pos1 + 1); while (pos2 != std::string::npos) { - packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); + this->packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); pos1 = pos2 + 1; pos2 = fileNames.find(sep, pos1 + 1); } - packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); + this->packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1)); } int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel, @@ -64,10 +64,11 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel, int retval = 1; // Begin the archive for this pack std::string localToplevel(initialToplevel); - std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); + std::string packageFileName( + cmSystemTools::GetParentDirectory(this->toplevel)); std::string outputFileName( - GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"), - packageName, true) + + this->GetComponentPackageFileName( + this->GetOption("CPACK_PACKAGE_FILE_NAME"), packageName, true) + this->GetOutputExtension()); localToplevel += "/" + packageName; @@ -99,7 +100,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) int retval = 1; /* Reset package file name list it will be populated during the * component packaging run*/ - packageFileNames.clear(); + this->packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); const char* mainComponent = this->GetOption("CPACK_RPM_MAIN_COMPONENT"); @@ -202,7 +203,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " << compGIt->first << std::endl); - retval &= PackageOnePack(initialTopLevel, compGIt->first); + retval &= this->PackageOnePack(initialTopLevel, compGIt->first); } // Handle Orphan components (components not belonging to any groups) auto mainCompIt = this->Components.end(); @@ -227,7 +228,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) << compIt->second.Name << "> does not belong to any group, package it separately." << std::endl); - retval &= PackageOnePack(initialTopLevel, compIt->first); + retval &= this->PackageOnePack(initialTopLevel, compIt->first); } } @@ -235,9 +236,9 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) this->SetOption("GENERATE_SPEC_PARTS", "OFF"); if (mainCompGIt != this->ComponentGroups.end()) { - retval &= PackageOnePack(initialTopLevel, mainCompGIt->first); + retval &= this->PackageOnePack(initialTopLevel, mainCompGIt->first); } else if (mainCompIt != this->Components.end()) { - retval &= PackageOnePack(initialTopLevel, mainCompIt->first); + retval &= this->PackageOnePack(initialTopLevel, mainCompIt->first); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_RPM_MAIN_COMPONENT set" @@ -264,14 +265,14 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) continue; } - retval &= PackageOnePack(initialTopLevel, compIt->first); + retval &= this->PackageOnePack(initialTopLevel, compIt->first); } if (retval) { this->SetOption("GENERATE_SPEC_PARTS", "OFF"); if (mainCompIt != this->Components.end()) { - retval &= PackageOnePack(initialTopLevel, mainCompIt->first); + retval &= this->PackageOnePack(initialTopLevel, mainCompIt->first); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_RPM_MAIN_COMPONENT set" @@ -291,7 +292,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: " << compGIt->first << std::endl); - retval &= PackageOnePack(initialTopLevel, compGIt->first); + retval &= this->PackageOnePack(initialTopLevel, compGIt->first); } // Handle Orphan components (components not belonging to any groups) std::map<std::string, cmCPackComponent>::iterator compIt; @@ -305,7 +306,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) << compIt->second.Name << "> does not belong to any group, package it separately." << std::endl); - retval &= PackageOnePack(initialTopLevel, compIt->first); + retval &= this->PackageOnePack(initialTopLevel, compIt->first); } } } @@ -315,7 +316,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) std::map<std::string, cmCPackComponent>::iterator compIt; for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { - retval &= PackageOnePack(initialTopLevel, compIt->first); + retval &= this->PackageOnePack(initialTopLevel, compIt->first); } } } else { @@ -328,7 +329,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) } if (retval) { - AddGeneratedPackageNames(); + this->AddGeneratedPackageNames(); } return retval; @@ -340,7 +341,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( int retval = 1; /* Reset package file name list it will be populated during the * component packaging run*/ - packageFileNames.clear(); + this->packageFileNames.clear(); std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); if (this->IsOn("CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE")) { @@ -354,7 +355,8 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( // The ALL GROUPS in ONE package case std::string localToplevel(initialTopLevel); - std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel)); + std::string packageFileName( + cmSystemTools::GetParentDirectory(this->toplevel)); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) + this->GetOutputExtension()); @@ -378,7 +380,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( } if (this->ReadListFile("Internal/CPack/CPackRPM.cmake")) { - AddGeneratedPackageNames(); + this->AddGeneratedPackageNames(); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackRPM.cmake" << std::endl); @@ -390,48 +392,49 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( int cmCPackRPMGenerator::PackageFiles() { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Toplevel: " << this->toplevel << std::endl); /* Are we in the component packaging case */ - if (WantsComponentInstallation()) { + if (this->WantsComponentInstallation()) { // CASE 1 : COMPONENT ALL-IN-ONE package // If ALL COMPONENTS in ONE package has been requested // then the package file is unique and should be open here. - if (componentPackageMethod == ONE_PACKAGE) { - return PackageComponentsAllInOne("ALL_COMPONENTS_IN_ONE"); + if (this->componentPackageMethod == ONE_PACKAGE) { + return this->PackageComponentsAllInOne("ALL_COMPONENTS_IN_ONE"); } // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) // There will be 1 package for each component group // however one may require to ignore component group and // in this case you'll get 1 package for each component. - return PackageComponents(componentPackageMethod == - ONE_PACKAGE_PER_COMPONENT); + return this->PackageComponents(this->componentPackageMethod == + ONE_PACKAGE_PER_COMPONENT); } // CASE 3 : NON COMPONENT package. - return PackageComponentsAllInOne(""); + return this->PackageComponentsAllInOne(""); } bool cmCPackRPMGenerator::SupportsComponentInstallation() const { - return IsOn("CPACK_RPM_COMPONENT_INSTALL"); + return this->IsOn("CPACK_RPM_COMPONENT_INSTALL"); } std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( const std::string& componentName) { - if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { + if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; } - if (componentPackageMethod == ONE_PACKAGE) { + if (this->componentPackageMethod == ONE_PACKAGE) { return std::string("ALL_COMPONENTS_IN_ONE"); } // We have to find the name of the COMPONENT GROUP // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (nullptr != GetOption(groupVar)) { - return std::string(GetOption(groupVar)); + if (nullptr != this->GetOption(groupVar)) { + return std::string(this->GetOption(groupVar)); } return componentName; } diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index a4a5e6f..3e36e8c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -50,7 +50,7 @@ int cmCPackSTGZGenerator::PackageFiles() * have generated several packages (component packaging) * so we must iterate over generated packages. */ - for (std::string const& pfn : packageFileNames) { + for (std::string const& pfn : this->packageFileNames) { retval &= cmSystemTools::SetPermissions(pfn.c_str(), #if defined(_MSC_VER) || defined(__MINGW32__) S_IREAD | S_IWRITE | S_IEXEC |