BUG: Do not copy permissions of files when making the copy in an install rule. If the source file was read-only, this prevents the subsequent set of the destination file's modification time, making the copied file always different in time-stamp than the original and always installing a new file with a new time stamp (but the same content) causing unnecessary downstream incremental rebuilds. As part of this fix, add an optional copyPermissions parameter to the SystemTools routines CopyFileIfDifferent, CopyFileAlways, CopyAFile and CopyADirectory. The copyPermissions parameter defaults to true to preserve the behavior of these routines for existing callers.

This commit is contained in:
David Cole
2008-12-18 10:43:24 -05:00
parent f8c0dc27b5
commit 0fafdb7eb8
3 changed files with 43 additions and 22 deletions
+8 -2
View File
@@ -1049,7 +1049,7 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
this->Makefile->DisplayStatus(message.c_str(), -1);
// Copy the file.
if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true))
if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false))
{
cmOStringStream e;
e << "INSTALL cannot copy file \"" << fromFile
@@ -1064,7 +1064,13 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
// Set the file modification time of the destination file.
if(copy && !always)
{
cmSystemTools::CopyFileTime(fromFile, toFile);
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
{
cmOStringStream e;
e << "Problem setting modification time on file \"" << toFile << "\"";
this->FileCommand->SetError(e.str().c_str());
return false;
}
}
// Set permissions of the destination file.