|
@@ -3,8 +3,8 @@
|
|
|
|
|
|
#include "cmFileCopier.h"
|
|
|
|
|
|
+#include "cmExecutionStatus.h"
|
|
|
#include "cmFSPermissions.h"
|
|
|
-#include "cmFileCommand.h"
|
|
|
#include "cmFileTimes.h"
|
|
|
#include "cmMakefile.h"
|
|
|
#include "cmStringAlgorithms.h"
|
|
@@ -21,9 +21,9 @@
|
|
|
|
|
|
using namespace cmFSPermissions;
|
|
|
|
|
|
-cmFileCopier::cmFileCopier(cmFileCommand* command, const char* name)
|
|
|
- : FileCommand(command)
|
|
|
- , Makefile(command->GetMakefile())
|
|
|
+cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name)
|
|
|
+ : Status(status)
|
|
|
+ , Makefile(&status.GetMakefile())
|
|
|
, Name(name)
|
|
|
, Always(false)
|
|
|
, MatchlessFiles(true)
|
|
@@ -92,7 +92,7 @@ bool cmFileCopier::SetPermissions(const std::string& toFile,
|
|
|
if (!cmSystemTools::SetPermissions(toFile, permissions)) {
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot set permissions on \"" << toFile << "\"";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -106,7 +106,7 @@ bool cmFileCopier::CheckPermissions(std::string const& arg,
|
|
|
if (!cmFSPermissions::stringToModeT(arg, permissions)) {
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " given invalid permission \"" << arg << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
@@ -122,7 +122,7 @@ bool cmFileCopier::ReportMissing(const std::string& fromFile)
|
|
|
// The input file does not exist and installation is not optional.
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot find \"" << fromFile << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -130,7 +130,7 @@ void cmFileCopier::NotBeforeMatch(std::string const& arg)
|
|
|
{
|
|
|
std::ostringstream e;
|
|
|
e << "option " << arg << " may not appear before PATTERN or REGEX.";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
this->Doing = DoingError;
|
|
|
}
|
|
|
|
|
@@ -138,7 +138,7 @@ void cmFileCopier::NotAfterMatch(std::string const& arg)
|
|
|
{
|
|
|
std::ostringstream e;
|
|
|
e << "option " << arg << " may not appear after PATTERN or REGEX.";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
this->Doing = DoingError;
|
|
|
}
|
|
|
|
|
@@ -175,7 +175,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
|
|
|
cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
|
|
|
for (const auto& arg : items) {
|
|
|
if (!this->CheckPermissions(arg, **mode)) {
|
|
|
- this->FileCommand->SetError(
|
|
|
+ this->Status.SetError(
|
|
|
" Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable.");
|
|
|
return false;
|
|
|
}
|
|
@@ -195,7 +195,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args)
|
|
|
if (!this->CheckKeyword(args[i]) && !this->CheckValue(args[i])) {
|
|
|
std::ostringstream e;
|
|
|
e << "called with unknown argument \"" << args[i] << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -209,7 +209,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args)
|
|
|
if (this->Destination.empty()) {
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " given no DESTINATION";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -342,7 +342,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
|
|
|
} else {
|
|
|
std::ostringstream e;
|
|
|
e << "could not compile PATTERN \"" << arg << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
this->Doing = DoingError;
|
|
|
}
|
|
|
} break;
|
|
@@ -354,7 +354,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
|
|
|
} else {
|
|
|
std::ostringstream e;
|
|
|
e << "could not compile REGEX \"" << arg << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
this->Doing = DoingError;
|
|
|
}
|
|
|
break;
|
|
@@ -397,8 +397,8 @@ bool cmFileCopier::Run(std::vector<std::string> const& args)
|
|
|
file += "/";
|
|
|
file += f;
|
|
|
} else if (!this->FilesFromDir.empty()) {
|
|
|
- this->FileCommand->SetError("option FILES_FROM_DIR requires all files "
|
|
|
- "to be specified as relative paths.");
|
|
|
+ this->Status.SetError("option FILES_FROM_DIR requires all files "
|
|
|
+ "to be specified as relative paths.");
|
|
|
return false;
|
|
|
} else {
|
|
|
file = f;
|
|
@@ -447,7 +447,7 @@ bool cmFileCopier::Install(const std::string& fromFile,
|
|
|
if (fromFile.empty()) {
|
|
|
std::ostringstream e;
|
|
|
e << "INSTALL encountered an empty string input file name.";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -515,7 +515,7 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile,
|
|
|
if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot create symlink \"" << toFile << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -536,7 +536,7 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot read symlink \"" << fromFile
|
|
|
<< "\" to duplicate at \"" << toFile << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -567,7 +567,7 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot duplicate symlink \"" << fromFile
|
|
|
<< "\" at \"" << toFile << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -596,7 +596,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot copy file \"" << fromFile << "\" to \""
|
|
|
<< toFile << "\".";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -612,7 +612,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot set modification time on \"" << toFile
|
|
|
<< "\"";
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -649,7 +649,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source,
|
|
|
std::ostringstream e;
|
|
|
e << this->Name << " cannot make directory \"" << destination
|
|
|
<< "\": " << cmSystemTools::GetLastSystemError();
|
|
|
- this->FileCommand->SetError(e.str());
|
|
|
+ this->Status.SetError(e.str());
|
|
|
return false;
|
|
|
}
|
|
|
|