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  0ea1a975a8c4873be4529c03a6967b9c3e008c9b (commit)
       via  3b59cec219c58289c47311807734cfce2229e112 (commit)
      from  c49d23f531be40047bd28d0cc248aa6ac47ef41c (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=0ea1a975a8c4873be4529c03a6967b9c3e008c9b
commit 0ea1a975a8c4873be4529c03a6967b9c3e008c9b
Merge: c49d23f 3b59cec
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Dec 23 09:00:08 2014 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Dec 23 09:00:08 2014 -0500

    Merge topic 'better_looking_mac_package' into next
    
    3b59cec2 Revert topic 'better_looking_mac_package'


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b59cec219c58289c47311807734cfce2229e112
commit 3b59cec219c58289c47311807734cfce2229e112
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Dec 23 08:59:28 2014 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Dec 23 08:59:35 2014 -0500

    Revert topic 'better_looking_mac_package'
    
    It does not work on OS X <= 10.5 and will need to be revised.

diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index 7488dc7..aba404f 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -45,12 +45,6 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
   endif()
 endif()
 
-if("${CPACK_GENERATOR}" STREQUAL "DragNDrop")
-  set(CPACK_DMG_BACKGROUND_IMAGE "@CMake_SOURCE_DIR@/CMakeDMGBackground.tif")
-  set(CPACK_DMG_DS_STORE_SETUP_SCRIPT
-      "@CMake_SOURCE_DIR@/CMakeDMG_Setup_Script.scrpt")
-endif()
-
 if("${CPACK_GENERATOR}" STREQUAL "WIX")
   # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction.
   # But the file names still use the full CMake_VERSION value:
diff --git a/CMakeDMGBackground.tif b/CMakeDMGBackground.tif
deleted file mode 100644
index 91c4b13..0000000
Binary files a/CMakeDMGBackground.tif and /dev/null differ
diff --git a/CMakeDMG_Setup_Script.scrpt b/CMakeDMG_Setup_Script.scrpt
deleted file mode 100644
index 552c518..0000000
--- a/CMakeDMG_Setup_Script.scrpt
+++ /dev/null
@@ -1,42 +0,0 @@
-on run argv
-  set image_name to item 1 of argv
-
-  tell application "Finder"
-  tell disk image_name
-
-    -- open the image the first time and save a DS_Store with just
-    -- background and icon setup
-    open
-      set current view of container window to icon view
-      set theViewOptions to the icon view options of container window
-      set background picture of theViewOptions to file 
".background:background.tif"
-      set arrangement of theViewOptions to not arranged
-      set icon size of theViewOptions to 128
-      delay 1
-    close
-
-    -- next setup the position of the app and Applications symlink
-    -- plus hide all the window decoration
-    open
-      update without registering applications
-      tell container window
-        set sidebar width to 0
-        set statusbar visible to false
-        set toolbar visible to false
-        set the bounds to { 400, 100, 900, 465 }
-        set position of item "CMake.app" to { 133, 200 }
-        set position of item "Applications" to { 378, 200 }
-      end tell
-      update without registering applications
-      delay 1
-    close
-
-    -- one last open and close so you can see everything looks correct
-    open
-      delay 5
-    close
-
-  end tell
-  delay 1
-end tell
-end run
\ No newline at end of file
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
index b4231e8..b7a6ba5 100644
--- a/Modules/CPackDMG.cmake
+++ b/Modules/CPackDMG.cmake
@@ -29,23 +29,12 @@
 #  the Finder (either manually or through OSA-script) using a normal folder
 #  from which the .DS_Store file can then be extracted.
 #
-# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT
-#
-#  Path to a custom OSA-script file. This apple script is used to
-#  the generate a .DS_Store file which specifies the Finder window
-#  position/geometry and layout (such as hidden toolbars, placement of the
-#  icons etc.). By specifying a custom apple script there is no need to
-#  CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the OSA-script
-#  will be packaged.
-#
 # .. variable:: CPACK_DMG_BACKGROUND_IMAGE
 #
-#  Path to an image file to be used as the background. This file will be copied
-#  to .background/background.<ext>, where ext is the original image file
-#  extension. The background image is installed into the image before
-#  CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is
-#  installed
-#  By default no background image is set.
+#  Path to a background image file. This file will be used as the background
+#  for the Finder Window when the disk image is opened.  By default no
+#  background image is set. The background image is applied after applying the
+#  custom .DS_Store file.
 #
 # .. variable:: CPACK_COMMAND_HDIUTIL
 #
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx 
b/Source/CPack/cmCPackDragNDropGenerator.cxx
index a335946..9f0a77e 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -15,10 +15,8 @@
 #include "cmSystemTools.h"
 #include "cmGeneratedFileStream.h"
 
-#include <cmsys/Directory.hxx>
-#include <cmsys/FStream.hxx>
 #include <cmsys/RegularExpression.hxx>
-#include <cmsys/SystemTools.hxx>
+#include <cmsys/FStream.hxx>
 
 static const char* SLAHeader =
 "data 'LPic' (5000) {\n"
@@ -51,49 +49,6 @@ static const char* SLASTREnglish =
 "};\n"
 "\n";
 
-
-namespace
-{
-  //computes the size of all items in a given folder.
-  //will not traverse symlinked folders
-  unsigned long compute_folder_content_size( const std::string& path )
-  {
-  unsigned long sum = 0; //total size in bytes
-  cmsys::Directory dir;
-  dir.Load(path.c_str());
-  for (unsigned long fileNum = 0; fileNum <  dir.GetNumberOfFiles(); ++fileNum)
-    {
-    const std::string fileName(dir.GetFile(fileNum));
-    const bool is_not_dot_file = fileName != std::string(".") &&
-                                 fileName != std::string("..");
-    if ( is_not_dot_file )
-      {
-      std::string fullPath = path;
-      fullPath += "/";
-      fullPath += fileName;
-
-      const bool is_folder =
-                    cmSystemTools::FileIsDirectory(fullPath.c_str());
-      const bool is_file =
-                    !is_folder;
-      const bool is_symlink =
-                    cmSystemTools::FileIsSymlink(fullPath.c_str());
-
-      if( is_folder && !is_symlink)
-        {
-        sum += cmSystemTools::FileLength(fullPath.c_str());
-        sum += compute_folder_content_size(fullPath);
-        }
-      else if( is_file )
-        {
-        sum += cmSystemTools::FileLength(fullPath.c_str());
-        }
-      }
-    }
-  return sum;
-  }
-}
-
 //----------------------------------------------------------------------
 cmCPackDragNDropGenerator::cmCPackDragNDropGenerator()
 {
@@ -291,11 +246,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
     this->GetOption("CPACK_DMG_DS_STORE")
     ? this->GetOption("CPACK_DMG_DS_STORE") : "";
 
-  const std::string cpack_dmg_ds_store_setup_script =
-    this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT")
-    ? this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") : "";
-
-
   // only put license on dmg if is user provided
   if(!cpack_license_file.empty() &&
       cpack_license_file.find("CPack.GenericLicense.txt") != std::string::npos)
@@ -335,26 +285,64 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
       }
     }
 
+  // Optionally add a custom .DS_Store file
+  // (e.g. for setting background/layout) ...
+  if(!cpack_dmg_ds_store.empty())
+    {
+    cmOStringStream package_settings_source;
+    package_settings_source << cpack_dmg_ds_store;
 
-  // Create a temporary read-write disk image. If we are adding a DS_Store,
-  // Background or running a script we need to allocate some buffer space
-  // in the image, otherwise we won't have enough room
+    cmOStringStream package_settings_destination;
+    package_settings_destination << staging.str() << "/.DS_Store";
 
-  //first compute the size of the staging_path which requires us to
-  //iterate over
-  const std::string staging_path = staging.str();
-  unsigned long dmgSize = compute_folder_content_size( staging_path );
-  if (!cpack_dmg_background_image.empty())
-    {
-    dmgSize += cmSystemTools::FileLength(cpack_dmg_background_image.c_str());
+    if(!this->CopyFile(package_settings_source, package_settings_destination))
+      {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+        "Error copying disk volume settings file.  "
+                    "Check the value of CPACK_DMG_DS_STORE."
+        << std::endl);
+
+      return 0;
+      }
     }
-  dmgSize += 8388608; //add 8MB for the DS_Store and buffer
 
-  //now that we have computed the size of the disk image we need to convert
-  //it to kb. The reason for this is that the hdiutil doesn't have a byte
-  //size specifier.
-  const unsigned long dmgSizeAsKB = dmgSize / 1024;
+  // Optionally add a custom background image ...
+  if(!cpack_dmg_background_image.empty())
+    {
+    cmOStringStream package_background_source;
+    package_background_source << cpack_dmg_background_image;
+
+    cmOStringStream package_background_destination;
+    package_background_destination << staging.str() << "/background.png";
+
+    if(!this->CopyFile(package_background_source,
+        package_background_destination))
+      {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+        "Error copying disk volume background image.  "
+                    "Check the value of CPACK_DMG_BACKGROUND_IMAGE."
+        << std::endl);
+
+      return 0;
+      }
+
+    cmOStringStream temp_background_hiding_command;
+    temp_background_hiding_command << this->GetOption("CPACK_COMMAND_SETFILE");
+    temp_background_hiding_command << " -a V \"";
+    temp_background_hiding_command << package_background_destination.str();
+    temp_background_hiding_command << "\"";
+
+    if(!this->RunCommand(temp_background_hiding_command))
+      {
+        cmCPackLogger(cmCPackLog::LOG_ERROR,
+          "Error setting attributes on disk volume background image."
+          << std::endl);
+
+      return 0;
+      }
+    }
 
+  // Create a temporary read-write disk image ...
   std::string temp_image = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
   temp_image += "/temp.dmg";
 
@@ -362,7 +350,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
   temp_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
   temp_image_command << " create";
   temp_image_command << " -ov";
-  temp_image_command << " -size " << dmgSizeAsKB << "k";
   temp_image_command << " -srcfolder \"" << staging.str() << "\"";
   temp_image_command << " -volname \""
     << cpack_dmg_volume_name << "\"";
@@ -378,16 +365,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
     return 0;
     }
 
-  //mount the image and set the ds_store or custom icon flag
-  const bool remount_image =  !cpack_dmg_background_image.empty() ||
-                              !cpack_dmg_ds_store.empty() ||
-                              !cpack_dmg_ds_store_setup_script.empty() ||
-                              !cpack_package_icon.empty();
-  if(remount_image)
+  // Optionally set the custom icon flag for the image ...
+  if(!cpack_package_icon.empty())
     {
-    //store that we have a failure so that we always unmount the image
-    //before we exit
-    bool had_error = false;
+    cmOStringStream temp_mount;
 
     cmOStringStream attach_command;
     attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
@@ -403,102 +384,25 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
 
       return 0;
       }
+
     cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*");
     mountpoint_regex.find(attach_output.c_str());
-
-    cmOStringStream temp_mount;
     temp_mount << mountpoint_regex.match(1);
 
-    // Optionally add a custom background image ...
-    // Make sure the background file type is the same as the custom image
-    // and that the file is hidden so it doesn't show up.
-    if(!cpack_dmg_background_image.empty())
-      {
-      const std::string extension =
-          cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image);
-      cmOStringStream package_background_source;
-      package_background_source << cpack_dmg_background_image;
-
-      cmOStringStream package_background_destination;
-      package_background_destination << temp_mount.str()
-                                     << "/.background/background" << extension;
-
-      if(!this->CopyFile(package_background_source,
-          package_background_destination))
-        {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-          "Error copying disk volume background image.  "
-                      "Check the value of CPACK_DMG_BACKGROUND_IMAGE."
-          << std::endl);
-
-        had_error = true;
-        }
-      }
+    cmOStringStream setfile_command;
+    setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
+    setfile_command << " -a C";
+    setfile_command << " \"" << temp_mount.str() << "\"";
 
-    // Figure out if we have a .DS_Store to install or if we need to run
-    // an apple-script to generate a .DS_Store
-    if(!cpack_dmg_ds_store.empty())
+    if(!this->RunCommand(setfile_command))
       {
-      // Optionally add a custom .DS_Store file
-      // (e.g. for setting background/layout) ...
-      cmOStringStream package_settings_source;
-      package_settings_source << cpack_dmg_ds_store;
-
-      cmOStringStream package_settings_destination;
-      package_settings_destination << temp_mount.str() << "/.DS_Store";
-
-      if(!this->CopyFile(package_settings_source,
-                         package_settings_destination))
-        {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-          "Error copying disk volume settings file.  "
-                      "Check the value of CPACK_DMG_DS_STORE."
-          << std::endl);
-
-        had_error = true;
-        }
-      }
-    else if(!cpack_dmg_ds_store_setup_script.empty())
-      {
-      //If you don't have a custom .DS_Store file
-      //we can execute a custom apple script to generate the .DS_Store for
-      //the application. We pass in as arguments to the apple script
-      //the location of the disk image
-      cmOStringStream setup_script_command;
-
-      setup_script_command << "osascript "
-                           << cpack_dmg_ds_store_setup_script
-                           << " "
-                           << "\"" << cpack_dmg_volume_name << "\"";
-
-      if(!this->RunCommand(setup_script_command))
-        {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-          "Error executing custom script on disk image."
-          << std::endl);
-
-        had_error = true;
-        }
-      }
-
-    if(!cpack_package_icon.empty())
-      {
-      cmOStringStream setfile_command;
-      setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
-      setfile_command << " -a C";
-      setfile_command << " \"" << temp_mount.str() << "\"";
-
-      if(!this->RunCommand(setfile_command))
-        {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-          "Error assigning custom icon to temporary disk image."
-          << std::endl);
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+        "Error assigning custom icon to temporary disk image."
+        << std::endl);
 
-        had_error = true;
-        }
+      return 0;
       }
 
-    //finish by detaching the package
     cmOStringStream detach_command;
     detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
     detach_command << " detach";
@@ -510,11 +414,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
         "Error detaching temporary disk image."
         << std::endl);
 
-      had_error = true;
-      }
-
-    if(had_error)
-      {
       return 0;
       }
     }

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

Summary of changes:
 CMakeCPackOptions.cmake.in                 |    6 -
 CMakeDMGBackground.tif                     |  Bin 95690 -> 0 bytes
 CMakeDMG_Setup_Script.scrpt                |   42 -----
 Modules/CPackDMG.cmake                     |   19 +--
 Source/CPack/cmCPackDragNDropGenerator.cxx |  235 ++++++++--------------------
 5 files changed, 71 insertions(+), 231 deletions(-)
 delete mode 100644 CMakeDMGBackground.tif
 delete mode 100644 CMakeDMG_Setup_Script.scrpt


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to