From 6e0cc37e8d773f78a552e36ed4abe7b1f87b2eea Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 30 Oct 2006 11:36:07 -0500 Subject: ENH: merge fix for cpack crash into main tree --- Source/CPack/cmCPackGenericGenerator.cxx | 28 +++++++++++++++++---------- Source/CPack/cmCPackPackageMakerGenerator.cxx | 10 +++++++--- Source/CPack/cmCPackTGZGenerator.cxx | 3 ++- Source/CPack/cmCPackTarBZip2Generator.cxx | 2 +- Source/CPack/cmCPackTarCompressGenerator.cxx | 3 ++- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index e949aa6..0102689 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -99,10 +99,10 @@ int cmCPackGenericGenerator::PrepareNames() "Look for: CPACK_PACKAGE_DESCRIPTION_FILE" << std::endl); const char* descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Look for: " << descFileName << std::endl); if ( descFileName ) { + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Look for: " << descFileName << std::endl); if ( !cmSystemTools::FileExists(descFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -158,7 +158,8 @@ int cmCPackGenericGenerator::InstallProject() if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " << tempInstallDirectory + "Problem creating temporary directory: " + << (tempInstallDirectory ? tempInstallDirectory : "(NULL}") << std::endl); return 0; } @@ -409,10 +410,10 @@ int cmCPackGenericGenerator::InstallProjectViaInstallScript( = this->GetOption("CPACK_INSTALL_SCRIPT"); std::string currentWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install scripts: " << cmakeScripts << std::endl); if ( cmakeScripts && *cmakeScripts ) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install scripts: " << cmakeScripts << std::endl); std::vector cmakeScriptsVector; cmSystemTools::ExpandListArgument(cmakeScripts, cmakeScriptsVector); @@ -667,7 +668,7 @@ int cmCPackGenericGenerator::ProcessGenerator() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Compress package" << std::endl); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress files to: " - << tempPackageFileName << std::endl); + << (tempPackageFileName ? tempPackageFileName : "(NULL)") << std::endl); if ( cmSystemTools::FileExists(tempPackageFileName) ) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove old package file" @@ -689,16 +690,23 @@ int cmCPackGenericGenerator::ProcessGenerator() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Finalize package" << std::endl); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Copy final package: " - << tempPackageFileName << " to " << packageFileName << std::endl); + << (tempPackageFileName ? tempPackageFileName : "(NULL)" ) + << " to " + << (packageFileName ? packageFileName : "(NULL)") + << std::endl); if ( !cmSystemTools::CopyFileIfDifferent(tempPackageFileName, packageFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the package: " - << tempPackageFileName << " to " << packageFileName << std::endl); + << (tempPackageFileName ? tempPackageFileName : "(NULL)" ) + << " to " + << (packageFileName ? packageFileName : "(NULL)") + << std::endl); return 0; } - cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Package " << packageFileName + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Package " + << (packageFileName ? packageFileName : "(NULL)") << " generated." << std::endl); return 1; } @@ -939,7 +947,7 @@ const char* cmCPackGenericGenerator::GetInstallPath() std::string cmCPackGenericGenerator::FindTemplate(const char* name) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: " - << name << std::endl); + << (name ? name : "(NULL)") << std::endl); std::string ffile = this->MakefileMap->GetModulesFile(name); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " << ffile.c_str() << std::endl); diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 2413000..ac2304d 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -236,13 +236,16 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name) if ( !inFileName ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() - << " not specified. It should point to " << name << ".rtf, " << name + << " not specified. It should point to " + << (name ? name : "(NULL)") + << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); return false; } if ( !cmSystemTools::FileExists(inFileName) ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " << name + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " + << (name ? name : "(NULL)") << " resource file: " << inFileName << std::endl); return false; } @@ -260,7 +263,8 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name) destFileName += name + ext; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << inFileName + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + << (inFileName ? inFileName : "(NULL)") << " to " << destFileName.c_str() << std::endl); this->ConfigureFile(inFileName, destFileName.c_str()); return true; diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 133fe0a..cafb0f5 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -208,7 +208,8 @@ int cmCPackTGZGenerator::InitializeInternal() int cmCPackTGZGenerator::CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files) { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " + << (toplevel ? toplevel : "(NULL)") << std::endl); cmCPackTGZ_Data mydata(this, this->Compress); TAR *t; char buf[TAR_MAXPATHLEN]; diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index f58dc0f..17efda5 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -108,7 +108,7 @@ int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \"" << compressOutFile.c_str() << "\" to \"" - << outFileName << std::endl); + << (outFileName ? outFileName : "(NULL)") << std::endl); return 0; } } diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index 65ff6a7..cd8e9da 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -155,7 +155,8 @@ int cmCPackTarCompressGenerator::InitializeInternal() int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files) { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " + << (toplevel ? toplevel : "(NULL)") << std::endl); cmCPackTarCompress_Data mydata(this); TAR *t; char buf[TAR_MAXPATHLEN]; -- cgit v0.12