[Cmake-commits] CMake branch, next, updated. v3.4.0-1326-gf3deee3

Brad King brad.king at kitware.com
Thu Nov 12 14:45:15 EST 2015


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  f3deee39e482cbc898f78d52c261ff9e1137ee7a (commit)
       via  521b470688cf71f0c798e8fb515f8dcd4d62a60f (commit)
      from  9df32d6e8dc0075d6c80ae344bac6ac7b26d9ee4 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3deee39e482cbc898f78d52c261ff9e1137ee7a
commit f3deee39e482cbc898f78d52c261ff9e1137ee7a
Merge: 9df32d6 521b470
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 12 14:45:14 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Nov 12 14:45:14 2015 -0500

    Merge topic 'revert-better_looking_mac_package' into next
    
    521b4706 Revert topic 'better_looking_mac_package'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=521b470688cf71f0c798e8fb515f8dcd4d62a60f
commit 521b470688cf71f0c798e8fb515f8dcd4d62a60f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 12 14:44:20 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 12 14:44:20 2015 -0500

    Revert topic 'better_looking_mac_package'
    
    Make room for a revised version.

diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index ae00653..b6013ef 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -183,13 +183,6 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
   endif()
 endif()
 
-if("${CPACK_GENERATOR}" STREQUAL "DragNDrop")
-  set(CPACK_DMG_BACKGROUND_IMAGE
-      "@CMake_SOURCE_DIR@/Packaging/CMakeDMGBackground.tif")
-  set(CPACK_DMG_DS_STORE_SETUP_SCRIPT
-      "@CMake_SOURCE_DIR@/Packaging/CMakeDMGSetup.scpt")
-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/Help/release/dev/better-looking-mac-packages.rst b/Help/release/dev/better-looking-mac-packages.rst
deleted file mode 100644
index ef1b8e8..0000000
--- a/Help/release/dev/better-looking-mac-packages.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-better-looking-mac-packages
----------------------------
-
-* The :module:`CPackDMG` module learned new variable to specify AppleScript
-  file run to customize appearance of ``DragNDrop`` installer folder,
-  including background image setting using supplied PNG or multi-resolution
-  TIFF file.  See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and
-  :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
index 6b5af7e..37d7352 100644
--- a/Modules/CPackDMG.cmake
+++ b/Modules/CPackDMG.cmake
@@ -26,25 +26,15 @@
 #  Path to a custom DS_Store file. This .DS_Store file e.g. can be used to
 #  specify the Finder window position/geometry and layout (such as hidden
 #  toolbars, placement of the icons etc.). This file has to be generated by
-#  the Finder (either manually or through AppleScript) using a normal folder
+#  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 AppleScript file.  This AppleScript is used to 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 AppleScript there is no need to use
-#  CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript
-#  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_DMG_SLA_DIR
 #
diff --git a/Packaging/CMakeDMGBackground.tif b/Packaging/CMakeDMGBackground.tif
deleted file mode 100644
index 91c4b13..0000000
Binary files a/Packaging/CMakeDMGBackground.tif and /dev/null differ
diff --git a/Packaging/CMakeDMGSetup.scpt b/Packaging/CMakeDMGSetup.scpt
deleted file mode 100644
index c7ddcfb..0000000
--- a/Packaging/CMakeDMGSetup.scpt
+++ /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
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 6e7093c..208a64c 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>
 
 #include <iomanip>
 
@@ -69,53 +67,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());
-
-      //add extra 4K for each entry, simulating extra file-system space needed
-      //to hold entry.
-      sum += 4096;
-
-      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()
 {
@@ -380,10 +331,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
     this->GetOption("CPACK_DMG_LANGUAGES")
       ? this->GetOption("CPACK_DMG_LANGUAGES") : "";
 
-  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)
@@ -430,26 +377,64 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
       }
     }
 
-  // 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
-
-  //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())
+  // Optionally add a custom .DS_Store file
+  // (e.g. for setting background/layout) ...
+  if(!cpack_dmg_ds_store.empty())
     {
-    dmgSize += 4096; // extra 4k per entry as in compute_folder_content_size
-    dmgSize += cmSystemTools::FileLength(cpack_dmg_background_image.c_str());
+    std::ostringstream package_settings_source;
+    package_settings_source << cpack_dmg_ds_store;
+
+    std::ostringstream package_settings_destination;
+    package_settings_destination << staging.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);
+
+      return 0;
+      }
     }
-  dmgSize += 8569344; //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 + 1023) / 1024;
+  // Optionally add a custom background image ...
+  if(!cpack_dmg_background_image.empty())
+    {
+    std::ostringstream package_background_source;
+    package_background_source << cpack_dmg_background_image;
+
+    std::ostringstream 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;
+      }
+
+    std::ostringstream 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";
 
@@ -457,7 +442,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 << "\"";
@@ -473,16 +457,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;
+    std::ostringstream temp_mount;
 
     std::ostringstream attach_command;
     attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
@@ -498,103 +476,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());
-
-    std::ostringstream 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);
-      std::ostringstream package_background_source;
-      package_background_source << cpack_dmg_background_image;
-
-      std::ostringstream 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;
-        }
-      }
-
-    // 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())
-      {
-      // Optionally add a custom .DS_Store file
-      // (e.g. for setting background/layout) ...
-      std::ostringstream package_settings_source;
-      package_settings_source << cpack_dmg_ds_store;
-
-      std::ostringstream 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
-      std::ostringstream setup_script_command;
-
-      setup_script_command << "osascript"
-                           << " \"" << cpack_dmg_ds_store_setup_script << "\""
-                           << " \"" << cpack_dmg_volume_name << "\"";
-
-      std::string error;
-      if(!this->RunCommand(setup_script_command, &error))
-        {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-          "Error executing custom script on disk image." << std::endl
-          << error
-          << std::endl);
+    std::ostringstream setfile_command;
+    setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
+    setfile_command << " -a C";
+    setfile_command << " \"" << temp_mount.str() << "\"";
 
-        had_error = true;
-        }
-      }
-
-    if(!cpack_package_icon.empty())
+    if(!this->RunCommand(setfile_command))
       {
-      std::ostringstream 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
     std::ostringstream detach_command;
     detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
     detach_command << " detach";
@@ -606,11 +506,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                       |    7 -
 Help/release/dev/better-looking-mac-packages.rst |    8 -
 Modules/CPackDMG.cmake                           |   20 +-
 Packaging/CMakeDMGBackground.tif                 |  Bin 95690 -> 0 bytes
 Packaging/CMakeDMGSetup.scpt                     |   42 ----
 Source/CPack/cmCPackDragNDropGenerator.cxx       |  241 ++++++----------------
 6 files changed, 73 insertions(+), 245 deletions(-)
 delete mode 100644 Help/release/dev/better-looking-mac-packages.rst
 delete mode 100644 Packaging/CMakeDMGBackground.tif
 delete mode 100644 Packaging/CMakeDMGSetup.scpt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list