Merge topic 'fix-cpack-hdiutil-retry-loops'

05a76d5 CPack: Fix retry logic when calls to hdiutil fail
This commit is contained in:
Brad King 2012-03-13 11:54:03 -04:00 committed by CMake Topic Stage
commit 88720153a9
2 changed files with 9 additions and 5 deletions

View File

@ -170,23 +170,25 @@ int cmCPackOSXX11Generator::PackageFiles()
<< "\" create -ov -format UDZO -srcfolder \"" << "\" create -ov -format UDZO -srcfolder \""
<< diskImageDirectory.c_str() << diskImageDirectory.c_str()
<< "\" \"" << packageFileNames[0] << "\""; << "\" \"" << packageFileNames[0] << "\"";
int retVal = 1;
cmCPackLogger(cmCPackLog::LOG_VERBOSE, cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Compress disk image using command: " "Compress disk image using command: "
<< dmgCmd.str().c_str() << std::endl); << dmgCmd.str().c_str() << std::endl);
// since we get random dashboard failures with this one // since we get random dashboard failures with this one
// try running it more than once // try running it more than once
int numTries = 4; int retVal = 1;
int numTries = 10;
bool res = false; bool res = false;
while(numTries > 0) while(numTries > 0)
{ {
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0, &retVal, 0,
this->GeneratorVerbose, 0); this->GeneratorVerbose, 0);
if(res && retVal) if ( res && !retVal )
{ {
numTries = -1; numTries = -1;
break;
} }
cmSystemTools::Delay(500);
numTries--; numTries--;
} }
if ( !res || retVal ) if ( !res || retVal )

View File

@ -319,17 +319,19 @@ int cmCPackPackageMakerGenerator::PackageFiles()
<< "\" \"" << packageFileNames[0] << "\""; << "\" \"" << packageFileNames[0] << "\"";
std::string output; std::string output;
int retVal = 1; int retVal = 1;
int numTries = 4; int numTries = 10;
bool res = false; bool res = false;
while(numTries > 0) while(numTries > 0)
{ {
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0, this->GeneratorVerbose, &retVal, 0, this->GeneratorVerbose,
0); 0);
if(res && retVal) if ( res && !retVal )
{ {
numTries = -1; numTries = -1;
break;
} }
cmSystemTools::Delay(500);
numTries--; numTries--;
} }
if ( !res || retVal ) if ( !res || retVal )