diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-10-30 17:10:56 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-10-30 17:10:56 (GMT) |
commit | fb51d98562a26b6dcde7d3597938a0b707b6b881 (patch) | |
tree | b42fbfb6b27b7a9e2d5068601f61d80e7033dc79 /Source/CPack/cmCPackZIPGenerator.cxx | |
parent | 0615218bdf3e240e44e539f9eed6c1cf9fbff2d4 (diff) | |
download | CMake-fb51d98562a26b6dcde7d3597938a0b707b6b881.zip CMake-fb51d98562a26b6dcde7d3597938a0b707b6b881.tar.gz CMake-fb51d98562a26b6dcde7d3597938a0b707b6b881.tar.bz2 |
Switch to using libarchive from libtar for cpack and cmake -E tar
This allows for a built in bzip and zip capability, so external tools
will not be needed for these packagers. The cmake -E tar xf should be
able to handle all compression types now as well.
Diffstat (limited to 'Source/CPack/cmCPackZIPGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackZIPGenerator.cxx | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 9924497..e195f83 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,14 +12,10 @@ #include "cmCPackZIPGenerator.h" -#include "cmSystemTools.h" -#include "cmGeneratedFileStream.h" -#include "cmCPackLog.h" - -#include <cmsys/SystemTools.hxx> - //---------------------------------------------------------------------- cmCPackZIPGenerator::cmCPackZIPGenerator() + :cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE, + cmCPackArchiveGenerator::ZIP) { } @@ -28,71 +24,3 @@ cmCPackZIPGenerator::~cmCPackZIPGenerator() { } -//---------------------------------------------------------------------- -int cmCPackZIPGenerator::InitializeInternal() -{ - this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); - this->ReadListFile("CPackZIP.cmake"); - if ((!this->IsSet("ZIP_EXECUTABLE")) - || (!this->IsSet("CPACK_ZIP_COMMAND"))) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable ZIP program" - << std::endl); - return 0; - } - return this->Superclass::InitializeInternal(); -} - -//---------------------------------------------------------------------- -int cmCPackZIPGenerator::CompressFiles(const char* outFileName, - const char* toplevel, const std::vector<std::string>& files) -{ - std::string tempFileName; - tempFileName = toplevel; - tempFileName += "/winZip.filelist"; - bool needQuotesInFile = cmSystemTools::IsOn( - this->GetOption("CPACK_ZIP_NEED_QUOTES")); - - std::string cmd = this->GetOption("CPACK_ZIP_COMMAND"); - cmsys::SystemTools::ReplaceString(cmd, "<ARCHIVE>", outFileName); - cmsys::SystemTools::ReplaceString(cmd, "<FILELIST>", "winZip.filelist"); - - { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(tempFileName.c_str()); - std::vector<std::string>::const_iterator fileIt; - for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) - { - if ( needQuotesInFile ) - { - out << "\""; - } - out << cmSystemTools::RelativePath(toplevel, fileIt->c_str()); - if ( needQuotesInFile ) - { - out << "\""; - } - out << std::endl; - } - } - - - std::string output; - int retVal = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, - &retVal, toplevel, this->GeneratorVerbose, 0); - - if ( !res || retVal ) - { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/CompressZip.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl - << "# Output:" << std::endl - << output.c_str() << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); - return 0; - } - return 1; -} |