diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-07 16:06:44 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-07 16:06:44 (GMT) |
commit | 497779d4b3be8ac387690bc95fdadab122fa5a3c (patch) | |
tree | 1d68b0ccff49fe50877c79fe6b5a349c13562367 /Source | |
parent | 3b7eaad890435cf00bdabbf4ff18288cbd0a1d46 (diff) | |
download | CMake-497779d4b3be8ac387690bc95fdadab122fa5a3c.zip CMake-497779d4b3be8ac387690bc95fdadab122fa5a3c.tar.gz CMake-497779d4b3be8ac387690bc95fdadab122fa5a3c.tar.bz2 |
ENH: fix crash in cygwin package stuff
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 41 |
2 files changed, 43 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index e8e1f7f..f6f51be 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -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(); } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6c79af4..a58953a 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -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); } |