[Cmake-commits] [cmake-commits] david.cole committed cmCPackBundleGenerator.cxx 1.6 1.7 cmCPackBundleGenerator.h 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 21 13:39:24 EST 2009


Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv24708/Source/CPack

Modified Files:
	cmCPackBundleGenerator.cxx cmCPackBundleGenerator.h 
Log Message:
BUG: Fix issue #7523: Analyze output of 'hdiutil attach' to get the name of the volume that was mounted. Eliminates the need to use the -mountpoint arg of hdiutil which has a silly 90 character limit on the name of the mount point. Also add a custom volume icon to the BundleGeneratorTest to cover this code.


Index: cmCPackBundleGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackBundleGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCPackBundleGenerator.cxx	4 Dec 2008 14:09:55 -0000	1.6
--- cmCPackBundleGenerator.cxx	21 Jan 2009 18:39:21 -0000	1.7
***************
*** 20,23 ****
--- 20,25 ----
  #include "cmSystemTools.h"
  
+ #include <cmsys/RegularExpression.hxx>
+ 
  //----------------------------------------------------------------------
  cmCPackBundleGenerator::cmCPackBundleGenerator()
***************
*** 246,259 ****
      {
      cmOStringStream temp_mount;
-     temp_mount << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/mnt";
-     cmSystemTools::MakeDirectory(temp_mount.str().c_str());
  
      cmOStringStream attach_command;
      attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
      attach_command << " attach";
-     attach_command << " -mountpoint \"" << temp_mount.str() << "\"";
      attach_command << " \"" << temp_image.str() << "\"";
  
!     if(!this->RunCommand(attach_command))
        {
        cmCPackLogger(cmCPackLog::LOG_ERROR,
--- 248,259 ----
      {
      cmOStringStream temp_mount;
  
      cmOStringStream attach_command;
      attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
      attach_command << " attach";
      attach_command << " \"" << temp_image.str() << "\"";
  
!     std::string attach_output;
!     if(!this->RunCommand(attach_command, &attach_output))
        {
        cmCPackLogger(cmCPackLog::LOG_ERROR,
***************
*** 264,267 ****
--- 264,271 ----
        }
  
+     cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*");
+     mountpoint_regex.find(attach_output.c_str());
+     temp_mount << mountpoint_regex.match(1);
+ 
      cmOStringStream setfile_command;
      setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
***************
*** 336,347 ****
  
  //----------------------------------------------------------------------
! bool cmCPackBundleGenerator::RunCommand(cmOStringStream& command)
  {
-   std::string output;
    int exit_code = 1;
  
    bool result = cmSystemTools::RunSingleCommand(
      command.str().c_str(),
!     &output,
      &exit_code,
      0,
--- 340,351 ----
  
  //----------------------------------------------------------------------
! bool cmCPackBundleGenerator::RunCommand(cmOStringStream& command, 
!   std::string* output)
  {
    int exit_code = 1;
  
    bool result = cmSystemTools::RunSingleCommand(
      command.str().c_str(),
!     output,
      &exit_code,
      0,

Index: cmCPackBundleGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackBundleGenerator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmCPackBundleGenerator.h	18 Jun 2008 13:53:29 -0000	1.1
--- cmCPackBundleGenerator.h	21 Jan 2009 18:39:21 -0000	1.2
***************
*** 42,46 ****
  
    bool CopyFile(cmOStringStream& source, cmOStringStream& target);
!   bool RunCommand(cmOStringStream& command);
  
    std::string InstallPrefix;
--- 42,46 ----
  
    bool CopyFile(cmOStringStream& source, cmOStringStream& target);
!   bool RunCommand(cmOStringStream& command, std::string* output = 0);
  
    std::string InstallPrefix;



More information about the Cmake-commits mailing list