Commit 497779d4 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: fix crash in cygwin package stuff

parent 3b7eaad8
......@@ -98,7 +98,15 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
const char* patchNumber =this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
if(!patchNumber)
{
patchNumber = "1";
cmCPackLogger(cmCPackLog::LOG_WARNING,
"CPACK_CYGWIN_PATCH_NUMBER not specified using 1"
<< std::endl);
}
this->OutputExtension +=
this->OutputExtension += ".tar.bz2";
return this->OutputExtension.c_str();
}
......@@ -59,7 +59,9 @@ void cmCPackGenerator::DisplayVerboseOutput(const char* msg,
//----------------------------------------------------------------------
int cmCPackGenerator::PrepareNames()
{
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Create temp directory." << std::endl);
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
tempDirectory += "/_CPack_Packages/";
......@@ -71,16 +73,34 @@ int cmCPackGenerator::PrepareNames()
}
tempDirectory += this->GetOption("CPACK_GENERATOR");
std::string topDirectory = tempDirectory;
std::string outName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
this->GetOption("CPACK_PACKAGE_FILE_NAME");
const char* pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME");
if(!pfname)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_PACKAGE_FILE_NAME not specified" << std::endl);
return 0;
}
std::string outName = pfname;
tempDirectory += "/" + outName;
if(!this->GetOutputExtension())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"No output extension specified" << std::endl);
return 0;
}
outName += this->GetOutputExtension();
const char* pdir = this->GetOption("CPACK_PACKAGE_DIRECTORY");
if(!pdir)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
return 0;
}
std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
std::string destFile = pdir;
destFile += "/" + outName;
std::string outFile = topDirectory + "/" + outName;
bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"));
std::string installPrefix = tempDirectory;
if (!setDestDir)
......@@ -653,6 +673,7 @@ int cmCPackGenerator::DoPackage()
{
return 0;
}
if ( cmSystemTools::IsOn(
this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY")) )
{
......@@ -672,10 +693,16 @@ int cmCPackGenerator::DoPackage()
}
}
}
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"About to install project " << std::endl);
if ( !this->InstallProject() )
{
return 0;
}
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Done install project " << std::endl);
const char* tempPackageFileName = this->GetOption(
"CPACK_TEMPORARY_PACKAGE_FILE_NAME");
......@@ -789,7 +816,7 @@ bool cmCPackGenerator::IsSet(const char* name) const
//----------------------------------------------------------------------
const char* cmCPackGenerator::GetOption(const char* op)
{
{
return this->MakefileMap->GetDefinition(op);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment