On Wednesday 07 January 2009 20:12:33 David Cole wrote:
> *Using this technique* would be an acceptable patch to fix the bug. CPack
> is not going to provide a tmp file name API and wanting to mount a *.dmg
> file is not a reasonable thing to do in an arbitrary CMake build tree
> (because of the stupid 90 character limit). Sorry I do not presently have
> time to work on such a patch in the near term.... but if one were to appear
> (that analyzes hdiutil output instead of forcing a -mountroot argument)
> then it would have a higher likelihood of being applied.
Done, find attached to this email and on the bug:
http://public.kitware.com/Bug/view.php?id=7523
Let me know your thoughts.
--
Cheers,
Mike Arthur
http://mikearthur.co.uk/
diff -dur source/Source/CPack/cmCPackBundleGenerator.cxx cmake-patch/Source/CPack/cmCPackBundleGenerator.cxx
--- source/Source/CPack/cmCPackBundleGenerator.cxx 2009-01-08 13:00:31.322952596 +0000
+++ cmake-patch/Source/CPack/cmCPackBundleGenerator.cxx 2009-01-08 12:56:17.458952637 +0000
@@ -19,6 +19,8 @@
#include "cmCPackLog.h"
#include "cmSystemTools.h"
+#include <cmsys/RegularExpression.hxx>
+
//----------------------------------------------------------------------
cmCPackBundleGenerator::cmCPackBundleGenerator()
{
@@ -245,16 +247,14 @@
if(!cpack_package_icon.empty())
{
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))
+ std::string attach_output;
+ if(!this->RunCommand(attach_command, &attach_output))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error attaching temporary disk image."
@@ -263,6 +263,10 @@
return 0;
}
+ cmsys::RegularExpression mountpoint_regex(".*(/Volumes/.*)\n");
+ mountpoint_regex.find(attach_output.c_str());
+ temp_mount << mountpoint_regex.match(1);
+
cmOStringStream setfile_command;
setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
setfile_command << " -a C";
@@ -335,14 +339,14 @@
}
//----------------------------------------------------------------------
-bool cmCPackBundleGenerator::RunCommand(cmOStringStream& command)
+bool cmCPackBundleGenerator::RunCommand(cmOStringStream& command,
+ std::string* output)
{
- std::string output;
int exit_code = 1;
bool result = cmSystemTools::RunSingleCommand(
command.str().c_str(),
- &output,
+ output,
&exit_code,
0,
this->GeneratorVerbose,
diff -dur source/Source/CPack/cmCPackBundleGenerator.h cmake-patch/Source/CPack/cmCPackBundleGenerator.h
--- source/Source/CPack/cmCPackBundleGenerator.h 2009-01-08 13:00:31.322952596 +0000
+++ cmake-patch/Source/CPack/cmCPackBundleGenerator.h 2009-01-08 12:56:17.458952637 +0000
@@ -41,7 +41,7 @@
const std::vector<std::string>& files);
bool CopyFile(cmOStringStream& source, cmOStringStream& target);
- bool RunCommand(cmOStringStream& command);
+ bool RunCommand(cmOStringStream& command, std::string* output = 0);
std::string InstallPrefix;
};
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake