Commit 65fa0f02 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'CPackArchiveGenerator-ComponentSupport'

a986dafd CPack fix broken compilation for CygwinSource generator
873e99a2 CPackArchiveGenerator improve usability and robustness
654683ad CPackArchiveGenerator  add component supports
36a550ae CPackArchiveGenerator  use cmArchiveWrite wrapper
parents f95074ba a986dafd
This diff is collapsed.
......@@ -13,34 +13,61 @@
#ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
/** \class cmCPackArchiveGenerator
* \brief A generator base for libarchive generation
* \brief A generator base for libarchive generation.
* The generator itself uses the libarchive wrapper
* \ref cmArchiveWrite.
*
*/
class cmCPackArchiveGenerator : public cmCPackGenerator
{
{
public:
enum CompressType{ GZIP, BZIP2, COMPRESS, LZMA, NONE};
enum ArchiveType{ TAR, ZIP};
cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator);
/**
* Construct generator
*/
cmCPackArchiveGenerator(CompressType, ArchiveType);
cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type);
virtual ~cmCPackArchiveGenerator();
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
// component support
virtual bool SupportsComponentInstallation() const;
protected:
virtual int InitializeInternal();
/**
* Add the files belonging to the specified component
* to the provided (already opened) archive.
* @param[in,out] archive the archive object
* @param[in] component the component whose file will be added to archive
*/
int addOneComponentToArchive(cmArchiveWrite& archive, cmCPackComponent* component);
/**
* The main package file method.
* If component install was required this
* method will call either PackageComponents or
* PackageComponentsAllInOne.
*/
int PackageFiles();
/**
* The method used to package files when component
* install is used. This will create one
* archive for each component group.
*/
int PackageComponents(bool ignoreComponentGroup);
/**
* Special case of component install where all
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(bool allComponentInOne);
virtual const char* GetOutputExtension() = 0;
CompressType Compress;
ArchiveType Archive;
};
cmArchiveWrite::Compress Compress;
cmArchiveWrite::Type Archive;
};
#endif
......@@ -59,7 +59,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// skip one parent up to the cmCPackTarBZip2Generator
// to create tar.bz2 file with the list of source
// files
this->Compress = BZIP2;
this->Compress = cmArchiveWrite::CompressBZip2;
if ( !this->cmCPackTarBZip2Generator::PackageFiles() )
{
return 0;
......
......@@ -851,8 +851,8 @@ int cmCPackGenerator::DoPackage()
return 0;
}
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Compress package" << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress files to: "
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Package files to: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)") << std::endl);
if ( cmSystemTools::FileExists(tempPackageFileName) )
{
......@@ -876,7 +876,10 @@ int cmCPackGenerator::DoPackage()
std::vector<std::string>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++ it )
{
std::string fileN = cmSystemTools::RelativePath(tempDirectory,
// beware we cannot just use tempDirectory as before
// because some generator will "CPACK_INCLUDE_TOPLEVEL_DIRECTORY"
// we really want "CPACK_TEMPORARY_DIRECTORY"
std::string fileN = cmSystemTools::RelativePath(this->GetOption("CPACK_TEMPORARY_DIRECTORY"),
it->c_str());
// Determine which component we are in.
......@@ -887,6 +890,7 @@ int cmCPackGenerator::DoPackage()
// Add this file to the list of files for the component.
this->Components[componentName].Files.push_back(fileN);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <" <<fileN<<"> to component <"<<componentName<<">"<<std::endl);
}
}
......
......@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackTGZGenerator::cmCPackTGZGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::GZIP,
cmCPackArchiveGenerator::TAR)
:cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip,
cmArchiveWrite::TypeTAR)
{
}
......
......@@ -13,8 +13,8 @@
#include "cmCPackTarBZip2Generator.h"
//----------------------------------------------------------------------
cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::BZIP2,
cmCPackArchiveGenerator::TAR)
:cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2,
cmArchiveWrite::TypeTAR)
{
}
......
......@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::COMPRESS,
cmCPackArchiveGenerator::TAR)
:cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress,
cmArchiveWrite::TypeTAR)
{
}
......
......@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackZIPGenerator::cmCPackZIPGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE,
cmCPackArchiveGenerator::ZIP)
:cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
cmArchiveWrite::TypeZIP)
{
}
......
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