[Cmake-commits] CMake branch, next, updated. v2.8.1-1307-g71a863e

Brad King brad.king at kitware.com
Fri Jun 4 14:42:15 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  71a863e41d1917092f0e40c7ef4eb9d4fbc9d622 (commit)
       via  fdb5f78705f1a603d176a0976c931dd197567ff9 (commit)
      from  78ae787e933f295a65875b6a594b57f46a33333f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71a863e41d1917092f0e40c7ef4eb9d4fbc9d622
commit 71a863e41d1917092f0e40c7ef4eb9d4fbc9d622
Merge: 78ae787 fdb5f78
Author: Brad King <brad.king at kitware.com>
Date:   Fri Jun 4 14:41:00 2010 -0400

    Merge branch 'cpack-remove-temp-dir' into next


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdb5f78705f1a603d176a0976c931dd197567ff9
commit fdb5f78705f1a603d176a0976c931dd197567ff9
Author: Brad King <brad.king at kitware.com>
Date:   Fri Jun 4 14:32:08 2010 -0400

    CPack: Try harder to remove temporary dir (#10793)
    
    Windows filesystems sometimes lock files temporarily.  Try removing the
    CPack temp install folder multiple times before giving up.

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 6224b40..4a4b428 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -789,7 +789,7 @@ int cmCPackGenerator::DoPackage()
       cmCPackLogger(cmCPackLog::LOG_VERBOSE, 
                     "Remove toplevel directory: "
         << toplevelDirectory << std::endl);
-      if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) )
+      if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) )
         {
         cmCPackLogger(cmCPackLog::LOG_ERROR,
           "Problem removing toplevel directory: "
@@ -1084,7 +1084,7 @@ int cmCPackGenerator::CleanTemporaryDirectory()
     cmCPackLogger(cmCPackLog::LOG_OUTPUT,
                   "- Clean temporary : "
                   << tempInstallDirectory << std::endl);
-    if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory))
+    if(!cmSystemTools::RepeatedRemoveDirectory(tempInstallDirectory))
       {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
                     "Problem removing temporary directory: " <<
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index d914203..5f7cfa3 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2938,3 +2938,18 @@ bool cmSystemTools::CheckRPath(std::string const& file,
   return false;
 #endif
 }
+
+//----------------------------------------------------------------------------
+bool cmSystemTools::RepeatedRemoveDirectory(const char* dir)
+{
+  // Windows sometimes locks files temporarily so try a few times.
+  for(int i = 0; i < 10; ++i)
+    {
+    if(cmSystemTools::RemoveADirectory(dir))
+      {
+      return true;
+      }
+    cmSystemTools::Delay(100);
+    }
+  return false;
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ed924dd..da5da31 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -436,6 +436,9 @@ public:
   static bool CheckRPath(std::string const& file,
                          std::string const& newRPath);
 
+  /** Remove a directory; repeat a few times in case of locked files.  */
+  static bool RepeatedRemoveDirectory(const char* dir);
+
 private:
   static bool s_ForceUnixPaths;
   static bool s_RunCommandHideConsole;

-----------------------------------------------------------------------

Summary of changes:
 Source/CPack/cmCPackGenerator.cxx |    4 ++--
 Source/cmSystemTools.cxx          |   15 +++++++++++++++
 Source/cmSystemTools.h            |    3 +++
 3 files changed, 20 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list