summaryrefslogtreecommitdiff
path: root/Source/CPack
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-03-07 11:06:44 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2008-03-07 11:06:44 -0500
commit497779d4b3be8ac387690bc95fdadab122fa5a3c (patch)
tree1d68b0ccff49fe50877c79fe6b5a349c13562367 /Source/CPack
parent3b7eaad890435cf00bdabbf4ff18288cbd0a1d46 (diff)
downloadcmake-497779d4b3be8ac387690bc95fdadab122fa5a3c.tar.gz
ENH: fix crash in cygwin package stuff
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackGenerator.cxx41
2 files changed, 43 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index e8e1f7f799..f6f51be254 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 6c79af4651..a58953a084 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);
}