[Cmake-commits] CMake branch, next, updated. v2.8.9-1221-gfab4dc7

Clinton Stimpson clinton at elemtech.com
Sat Oct 27 13:22:00 EDT 2012


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  fab4dc7c79fd72ac1d516dad6cd03dda58c52f1f (commit)
       via  633f67c84fb0276563b186536cbeb6de5cb1d5aa (commit)
       via  4322816b6b15746c191d55fdbffc62778f9d052a (commit)
       via  b2c631c7c84cd7ea77cfd3bdb6a3a42c8553025f (commit)
      from  403da25e38c24a2631425d79f6c74498f56bcabd (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=fab4dc7c79fd72ac1d516dad6cd03dda58c52f1f
commit fab4dc7c79fd72ac1d516dad6cd03dda58c52f1f
Merge: 403da25 633f67c
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Sat Oct 27 13:21:58 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Oct 27 13:21:58 2012 -0400

    Merge topic 'packagemaker-component-postflight' into next
    
    633f67c PackageMaker: Enable postflight script in component mode.
    4322816 CMake Nightly Date Stamp
    b2c631c CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=633f67c84fb0276563b186536cbeb6de5cb1d5aa
commit 633f67c84fb0276563b186536cbeb6de5cb1d5aa
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Sat Oct 27 11:07:31 2012 -0600
Commit:     Clinton Stimpson <clinton at elemtech.com>
CommitDate: Sat Oct 27 11:20:44 2012 -0600

    PackageMaker: Enable postflight script in component mode.
    
    Previously, setting CPACK_POSTFLIGHT_SCRIPT had no effect in
    component mode, when CPACK_COMPONENTS_ALL was set.
    
    In component mode, a .mpkg is created that contains multiple .pkg's.
    Because postflight scripts only work in a .pkg, add another .pkg to the
    .mpkg and put the postflight script in that.
    This is the same approach taken by the PackageMaker GUI when adding
    a postflight script to a  metapackage.
    
    This fixes bug #12375.

diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 48d935c..abae372 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -42,7 +42,9 @@ public:
 class cmCPackComponent
 {
 public:
- cmCPackComponent() : Group(0), TotalSize(0) { }
+ cmCPackComponent() : Group(0), IsRequired(true), IsHidden(false),
+                      IsDisabledByDefault(false), IsDownloaded(false),
+                      TotalSize(0) { }
 
   /// The name of the component (used to reference the component).
   std::string Name;
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index edbe838..ce3d0c9 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -106,56 +106,100 @@ int cmCPackPackageMakerGenerator::PackageFiles()
     resDir += "/en.lproj";
     }
 
-
-  // Create directory structure
-  std::string preflightDirName = resDir + "/PreFlight";
-  std::string postflightDirName = resDir + "/PostFlight";
   const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT");
   const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT");
   const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT");
-  // if preflight or postflight scripts not there create directories
-  // of the same name, I think this makes it work
-  if(!preflight)
+
+  if(this->Components.empty())
     {
-    if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()))
+    // Create directory structure
+    std::string preflightDirName = resDir + "/PreFlight";
+    std::string postflightDirName = resDir + "/PostFlight";
+    // if preflight or postflight scripts not there create directories
+    // of the same name, I think this makes it work
+    if(!preflight)
       {
-      cmCPackLogger(cmCPackLog::LOG_ERROR,
-                    "Problem creating installer directory: "
-                    << preflightDirName.c_str() << std::endl);
-      return 0;
+      if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()))
+        {
+        cmCPackLogger(cmCPackLog::LOG_ERROR,
+                      "Problem creating installer directory: "
+                      << preflightDirName.c_str() << std::endl);
+        return 0;
+        }
+      }
+    if(!postflight)
+      {
+      if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()))
+        {
+        cmCPackLogger(cmCPackLog::LOG_ERROR,
+                      "Problem creating installer directory: "
+                      << postflightDirName.c_str() << std::endl);
+        return 0;
+        }
+      }
+    // if preflight, postflight, or postupgrade are set
+    // then copy them into the resource directory and make
+    // them executable
+    if(preflight)
+      {
+      this->CopyInstallScript(resDir.c_str(),
+                              preflight,
+                              "preflight");
+      }
+    if(postflight)
+      {
+      this->CopyInstallScript(resDir.c_str(),
+                              postflight,
+                              "postflight");
+      }
+    if(postupgrade)
+      {
+      this->CopyInstallScript(resDir.c_str(),
+                              postupgrade,
+                              "postupgrade");
       }
     }
-  if(!postflight)
+  else if(postflight)
     {
-    if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()))
+    // create a postflight component to house the script
+    this->PostFlightComponent.Name = "PostFlight";
+    this->PostFlightComponent.DisplayName = "PostFlight";
+    this->PostFlightComponent.Description = "PostFlight";
+    this->PostFlightComponent.IsHidden = true;
+
+    // empty directory for pkg contents
+    std::string packageDir = toplevel + "/" + PostFlightComponent.Name;
+    if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str()))
       {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
-                    "Problem creating installer directory: "
-                    << postflightDirName.c_str() << std::endl);
+                    "Problem creating component packages directory: "
+                    << packageDir.c_str() << std::endl);
       return 0;
       }
-    }
-  // if preflight, postflight, or postupgrade are set
-  // then copy them into the resource directory and make
-  // them executable
-  if(preflight)
-    {
-    this->CopyInstallScript(resDir.c_str(),
-                            preflight,
-                            "preflight");
-    }
-  if(postflight)
-    {
-    this->CopyInstallScript(resDir.c_str(),
+
+    // create package
+    std::string packageFileDir = packageDirFileName + "/Contents/Packages/";
+    if (!cmsys::SystemTools::MakeDirectory(packageFileDir.c_str()))
+      {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+                    "Problem creating component PostFlight Packages directory: "
+                    << packageFileDir.c_str() << std::endl);
+      return 0;
+      }
+    std::string packageFile = packageFileDir + this->GetPackageName(PostFlightComponent);
+    if (!this->GenerateComponentPackage(packageFile.c_str(),
+                                        packageDir.c_str(),
+                                        PostFlightComponent))
+      {
+      return 0;
+      }
+
+    // copy postflight script into resource directory of .pkg
+    std::string resourceDir = packageFile + "/Contents/Resources";
+    this->CopyInstallScript(resourceDir.c_str(),
                             postflight,
                             "postflight");
     }
-  if(postupgrade)
-    {
-    this->CopyInstallScript(resDir.c_str(),
-                            postupgrade,
-                            "postupgrade");
-    }
 
   if (!this->Components.empty())
     {
@@ -778,6 +822,11 @@ WriteDistributionFile(const char* metapackageFile)
                 << std::endl;
       }
     }
+  if(!this->PostFlightComponent.Name.empty())
+    {
+      choiceOut << "<line choice=\"" << PostFlightComponent.Name << "Choice\"></line>"
+                << std::endl;
+    }
   choiceOut << "</choices-outline>" << std::endl;
 
   // Create the actual choices
@@ -792,6 +841,12 @@ WriteDistributionFile(const char* metapackageFile)
     {
     CreateChoice(compIt->second, choiceOut);
     }
+
+  if(!this->PostFlightComponent.Name.empty())
+    {
+    CreateChoice(PostFlightComponent, choiceOut);
+    }
+
   this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str());
 
   // Create the distribution.dist file in the metapackage to turn it
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index 101813f..ba3d968 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -112,6 +112,9 @@ protected:
   // value.
   std::string EscapeForXML(std::string str);
 
+  // The PostFlight component when creating a metapackage
+  cmCPackComponent PostFlightComponent;
+
   double PackageMakerVersion;
   double PackageCompatibilityVersion;
 };

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

Summary of changes:
 Source/CMakeVersion.cmake                     |    2 +-
 Source/CPack/cmCPackComponentGroup.h          |    4 +-
 Source/CPack/cmCPackPackageMakerGenerator.cxx |  125 ++++++++++++++++++-------
 Source/CPack/cmCPackPackageMakerGenerator.h   |    3 +
 4 files changed, 97 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list