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  cf660ade3f88a6364dc86a9616da9b9198216e25 (commit)
       via  356068cd2e3c395fa824568613c1de315fa8b05b (commit)
      from  f2d9386c0dcb7ed57297ba1886dab692fc304e4a (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=cf660ade3f88a6364dc86a9616da9b9198216e25
commit cf660ade3f88a6364dc86a9616da9b9198216e25
Merge: f2d9386 356068c
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Feb 23 14:18:13 2017 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Feb 23 14:18:13 2017 -0500

    Merge topic 'dragndrop-format' into next
    
    356068cd cmCPackDragNDropGenerator: Improving handling of temporary dmg 
images


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=356068cd2e3c395fa824568613c1de315fa8b05b
commit 356068cd2e3c395fa824568613c1de315fa8b05b
Author:     Clinton Stimpson <clin...@elemtech.com>
AuthorDate: Thu Feb 23 09:53:09 2017 -0700
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Feb 23 14:12:52 2017 -0500

    cmCPackDragNDropGenerator: Improving handling of temporary dmg images
    
    Adjust the image format to create the initial `dmg`, and convert only
    when necessary.  This eliminates spurious
    
        hdiutil create -format UDRW
    
    failures I'm seeing which may be related to an anti-virus scanner.
    Running
    
        hdiutil create -format UDRW -verbose
    
    indicates a "resource is busy" issue when unmounting an image.

diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx 
b/Source/CPack/cmCPackDragNDropGenerator.cxx
index fd67df9..ec5fc88 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -390,6 +390,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
   bool remount_image =
     !cpack_package_icon.empty() || !cpack_dmg_ds_store_setup_script.empty();
 
+  std::string temp_image_format = "UDZO";
+
   // Create 1 MB dummy padding file in staging area when we need to remount
   // image, so we have enough space for storing changes ...
   if (remount_image) {
@@ -401,6 +403,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
 
       return 0;
     }
+    temp_image_format = "UDRW";
   }
 
   // Create a temporary read-write disk image ...
@@ -413,7 +416,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
   temp_image_command << " -ov";
   temp_image_command << " -srcfolder \"" << staging.str() << "\"";
   temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\"";
-  temp_image_command << " -format UDRW";
+  temp_image_command << " -format " << temp_image_format;
   temp_image_command << " \"" << temp_image << "\"";
 
   if (!this->RunCommand(temp_image_command)) {
@@ -632,29 +635,33 @@ int cmCPackDragNDropGenerator::CreateDMG(const 
std::string& src_dir,
       return 0;
     }
 
-    // convert to UDCO
-    std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
-    temp_udco += "/temp-udco.dmg";
+    if (temp_image_format != "UDZO") {
+      temp_image_format = "UDZO";
+      // convert to UDZO to enable unflatten/flatten
+      std::string temp_udzo = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+      temp_udzo += "/temp-udzo.dmg";
 
-    std::ostringstream udco_image_command;
-    udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
-    udco_image_command << " convert \"" << temp_image << "\"";
-    udco_image_command << " -format UDCO";
-    udco_image_command << " -ov -o \"" << temp_udco << "\"";
+      std::ostringstream udco_image_command;
+      udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
+      udco_image_command << " convert \"" << temp_image << "\"";
+      udco_image_command << " -format UDZO";
+      udco_image_command << " -ov -o \"" << temp_udzo << "\"";
 
-    if (!this->RunCommand(udco_image_command, &error)) {
-      cmCPackLogger(cmCPackLog::LOG_ERROR,
-                    "Error converting to UDCO dmg for adding SLA."
-                      << std::endl
-                      << error << std::endl);
-      return 0;
+      if (!this->RunCommand(udco_image_command, &error)) {
+        cmCPackLogger(cmCPackLog::LOG_ERROR,
+                      "Error converting to UDCO dmg for adding SLA."
+                        << std::endl
+                        << error << std::endl);
+        return 0;
+      }
+      temp_image = temp_udzo;
     }
 
     // unflatten dmg
     std::ostringstream unflatten_command;
     unflatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
     unflatten_command << " unflatten ";
-    unflatten_command << "\"" << temp_udco << "\"";
+    unflatten_command << "\"" << temp_image << "\"";
 
     if (!this->RunCommand(unflatten_command, &error)) {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -673,7 +680,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
     }
     embed_sla_command << " \"" << sla_r << "\"";
     embed_sla_command << " -a -o ";
-    embed_sla_command << "\"" << temp_udco << "\"";
+    embed_sla_command << "\"" << temp_image << "\"";
 
     if (!this->RunCommand(embed_sla_command, &error)) {
       cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding SLA." << std::endl
@@ -686,7 +693,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
     std::ostringstream flatten_command;
     flatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
     flatten_command << " flatten ";
-    flatten_command << "\"" << temp_udco << "\"";
+    flatten_command << "\"" << temp_image << "\"";
 
     if (!this->RunCommand(flatten_command, &error)) {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -695,8 +702,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& 
src_dir,
                                                            << std::endl);
       return 0;
     }
-
-    temp_image = temp_udco;
   }
 
   // Create the final compressed read-only disk image ...

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

Summary of changes:
 Source/CPack/cmCPackDragNDropGenerator.cxx |   45 +++++++++++++++-------------
 1 file changed, 25 insertions(+), 20 deletions(-)


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

Reply via email to