[Cmake-commits] CMake branch, next, updated. v2.8.4-1097-g44c437e

Eric Noulard eric.noulard at gmail.com
Fri Mar 4 16:18:27 EST 2011


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  44c437ea65b58ed05f9e2ba80c2471dc0f852dbf (commit)
       via  77333a92c215bb796c8df8a889118b32f64e38e4 (commit)
      from  375d9eac7333c3a8f442f24223a8e5e5bca50846 (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=44c437ea65b58ed05f9e2ba80c2471dc0f852dbf
commit 44c437ea65b58ed05f9e2ba80c2471dc0f852dbf
Merge: 375d9ea 77333a9
Author:     Eric Noulard <eric.noulard at gmail.com>
AuthorDate: Fri Mar 4 16:18:26 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 4 16:18:26 2011 -0500

    Merge topic 'CPack-MoreRobustComponentFileList' into next
    
    77333a9 CPack  more robust way to collect files belonging to a component


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77333a92c215bb796c8df8a889118b32f64e38e4
commit 77333a92c215bb796c8df8a889118b32f64e38e4
Author:     Eric NOULARD <eric.noulard at gmail.com>
AuthorDate: Thu Mar 3 22:43:31 2011 +0100
Commit:     Eric NOULARD <eric.noulard at gmail.com>
CommitDate: Thu Mar 3 22:43:31 2011 +0100

    CPack  more robust way to collect files belonging to a component

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 86200c1..2cc2f34 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -810,7 +810,52 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           {
           mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
           }
+        // Remember the list of files before installation
+        // of the current component (if we are in component install)
+        const char* InstallPrefix = tempInstallDirectory.c_str();
+        std::vector<std::string> filesBefore;
+        std::string findExpr(InstallPrefix);
+        if (componentInstall)
+          {
+          cmsys::Glob glB;
+          findExpr += "/*";
+          glB.RecurseOn();
+          glB.FindFiles(findExpr);
+          filesBefore = glB.GetFiles();
+          sort(filesBefore.begin(),filesBefore.end());
+          }
+        // do installation
         int res = mf->ReadListFile(0, installFile.c_str());
+        // Now rebuild the list of files after installation
+        // of the current component (if we are in component install)
+        if (componentInstall)
+          {
+          cmsys::Glob glA;
+          glA.RecurseOn();
+          glA.FindFiles(findExpr);
+          std::vector<std::string> filesAfter = glA.GetFiles();
+          sort(filesAfter.begin(),filesAfter.end());
+          std::vector<std::string>::iterator diff;
+          std::vector<std::string> result(filesAfter.size());
+          diff = set_difference (
+                  filesAfter.begin(),filesAfter.end(),
+                  filesBefore.begin(),filesBefore.end(),
+                  result.begin());
+
+          std::vector<std::string>::iterator fit;
+          std::string localFileName;
+          // Populate the File field of each component
+          for (fit=result.begin();fit!=diff;++fit)
+            {
+            localFileName = cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
+            localFileName = localFileName.substr(localFileName.find('/')+1,std::string::npos);
+            Components[installComponent].Files.push_back(localFileName);
+            cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
+                                <<localFileName<<"> to component <"
+                                <<installComponent<<">"<<std::endl);
+            }
+          }
+
         if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
           if (absoluteDestFiles.length()>0) {
             absoluteDestFiles +=";";
@@ -952,35 +997,6 @@ int cmCPackGenerator::DoPackage()
   // The files to be installed
   files = gl.GetFiles();
 
-  // For component installations, determine which files go into which
-  // components.
-  if (!this->Components.empty())
-    {
-    std::vector<std::string>::const_iterator it;
-    for ( it = files.begin(); it != files.end(); ++ it )
-      {
-      // beware we cannot just use tempDirectory as before
-      // because some generator will "CPACK_INCLUDE_TOPLEVEL_DIRECTORY"
-      // we really want "CPACK_TEMPORARY_DIRECTORY"
-      std::string fileN =
-        cmSystemTools::RelativePath(
-          this->GetOption("CPACK_TEMPORARY_DIRECTORY"), it->c_str());
-
-      // Determine which component we are in.
-      std::string componentName = fileN.substr(0, fileN.find('/'));
-
-      // Strip off the component part of the path.
-      fileN = fileN.substr(fileN.find('/')+1, std::string::npos);
-
-      // Add this file to the list of files for the component.
-      this->Components[componentName].Files.push_back(fileN);
-      cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
-                    <<fileN<<"> to component <"
-                    <<componentName<<">"<<std::endl);
-      }
-    }
-
-
   packageFileNames.clear();
   /* Put at least one file name into the list of
    * wanted packageFileNames. The specific generator

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

Summary of changes:
 Source/CPack/cmCPackGenerator.cxx |   74 ++++++++++++++++++++++--------------
 1 files changed, 45 insertions(+), 29 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list