Kaynağa Gözat

BUG: Bundle installation needs all file permissions to be preserved from the build tree.

Brad King 19 yıl önce
ebeveyn
işleme
0525d8be58
1 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 9 5
      Source/cmFileCommand.cxx

+ 9 - 5
Source/cmFileCommand.cxx

@@ -318,7 +318,8 @@ bool cmFileCommand::HandleMakeDirectoryCommand(
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 struct cmFileInstaller
 struct cmFileInstaller
 {
 {
-  bool InstallFile(const char* fromFile, const char* toFile, bool always);
+  bool InstallFile(const char* fromFile, const char* toFile, bool always,
+                   bool no_permissions);
   bool InstallDirectory(const char* source,
   bool InstallDirectory(const char* source,
                         const char* destination,
                         const char* destination,
                         bool always,
                         bool always,
@@ -334,7 +335,7 @@ struct cmFileInstaller
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
 bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
-                                  bool always)
+                                  bool always, bool no_permissions)
 {
 {
   // Inform the user about this file installation.
   // Inform the user about this file installation.
   std::string message = "Installing ";
   std::string message = "Installing ";
@@ -352,7 +353,10 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
     }
     }
 
 
   // Set permissions of the destination file.
   // Set permissions of the destination file.
-  if(!cmSystemTools::SetPermissions(toFile, this->FilePermissions))
+  // TODO: Take out no_permissions and replace with a user option to
+  // preserve source permissions explicitly.
+  if(!no_permissions &&
+     !cmSystemTools::SetPermissions(toFile, this->FilePermissions))
     {
     {
     cmOStringStream e;
     cmOStringStream e;
     e << "Problem setting permissions on file \"" << toFile << "\"";
     e << "Problem setting permissions on file \"" << toFile << "\"";
@@ -405,7 +409,7 @@ bool cmFileInstaller::InstallDirectory(const char* source,
         std::string toFile = destination;
         std::string toFile = destination;
         toFile += "/";
         toFile += "/";
         toFile += dir.GetFile(fileNum);
         toFile += dir.GetFile(fileNum);
-        if(this->InstallFile(fromPath.c_str(), toFile.c_str(), always))
+        if(this->InstallFile(fromPath.c_str(), toFile.c_str(), always, true))
           {
           {
           smanifest_files += ";";
           smanifest_files += ";";
           smanifest_files += toFile.substr(destDirLength);
           smanifest_files += toFile.substr(destDirLength);
@@ -1081,7 +1085,7 @@ bool cmFileCommand::HandleInstallCommand(
         {
         {
         // Install this file.
         // Install this file.
         if(!installer.InstallFile(fromFile.c_str(), toFile.c_str(),
         if(!installer.InstallFile(fromFile.c_str(), toFile.c_str(),
-                                  copy_always))
+                                  copy_always, false))
           {
           {
           return false;
           return false;
           }
           }