Merge topic 'CPack-APIredesign'

bd510fe CPack: Avoid member shadowing after API refactor (part2)
31a313d CPack: Avoid member shadowing after API refactor
cd7b8a0 CPack: Refactor API in order to handle multi-file packages
This commit is contained in:
Brad King 2010-08-17 15:12:42 -04:00 committed by CMake Topic Stage
commit cc2ba7f9c2
24 changed files with 181 additions and 128 deletions

View File

@ -164,8 +164,7 @@ int cmCPackArchiveGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
int cmCPackArchiveGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackArchiveGenerator::PackageFiles()
{
int res = ARCHIVE_OK;
#define CHECK_ARCHIVE_ERROR(res, msg) \
@ -178,14 +177,15 @@ int cmCPackArchiveGenerator::CompressFiles(const char* outFileName,
<< "\n"); \
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< (toplevel ? toplevel : "(NULL)") << std::endl);
<< toplevel << std::endl);
// create a new archive
struct archive* a = archive_write_new();
// Set the compress and archive types for the archive
SetArchiveType(a, this->Compress, this->Archive);
// Open binary stream
cmGeneratedFileStream* gf = new cmGeneratedFileStream;
gf->Open(outFileName, false, true);
gf->Open(packageFileNames[0].c_str(), false, true);
StreamData data(gf, this);
// pass callbacks to archive_write_open to handle stream
res = archive_write_open(a,
@ -202,13 +202,13 @@ int cmCPackArchiveGenerator::CompressFiles(const char* outFileName,
CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:");
std::vector<std::string>::const_iterator fileIt;
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(toplevel);
cmSystemTools::ChangeDirectory(toplevel.c_str());
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
// create a new entry for each file
struct archive_entry *entry = archive_entry_new();
// Get the relative path to the file
std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str());
// Set the name of the entry to the file name
archive_entry_set_pathname(entry, rp.c_str());
res = archive_read_disk_entry_from_file(disk, entry, -1, 0);

View File

@ -37,8 +37,7 @@ public:
protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetOutputExtension() = 0;
CompressType Compress;
ArchiveType Archive;

View File

@ -53,10 +53,8 @@ const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
}
//----------------------------------------------------------------------
int cmCPackBundleGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackBundleGenerator::PackageFiles()
{
(void) files;
// Get required arguments ...
const std::string cpack_bundle_name = this->GetOption("CPACK_BUNDLE_NAME")
@ -167,5 +165,5 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName,
cmSystemTools::SetPermissions(command_target.str().c_str(), 0777);
}
return this->CreateDMG(toplevel, outFileName);
return this->CreateDMG();
}

View File

@ -31,8 +31,7 @@ public:
protected:
virtual int InitializeInternal();
virtual const char* GetPackagingInstallPrefix();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
std::string InstallPrefix;
};

View File

@ -41,8 +41,7 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackCygwinBinaryGenerator::PackageFiles()
{
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
packageName += "-";
@ -70,12 +69,10 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
ofs << manifest << "\n";
}
// add the manifest file to the list of all files
std::vector<std::string> filesWithManifest = files;
filesWithManifest.push_back(manifestFile);
files.push_back(manifestFile);
// create the bzip2 tar file
return this->Superclass::CompressFiles(outFileName, toplevel,
filesWithManifest);
return this->Superclass::PackageFiles();
}
const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()

View File

@ -30,8 +30,7 @@ public:
virtual ~cmCPackCygwinBinaryGenerator();
protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetOutputExtension();
std::string OutputExtension;
};

View File

@ -48,21 +48,19 @@ int cmCPackCygwinSourceGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackCygwinSourceGenerator::PackageFiles()
{
// Create a tar file of the sources
std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packageDirFileName += ".tar.bz2";
packageFileNames[0] = packageDirFileName;
std::string output;
// skip one parent up to the cmCPackTarBZip2Generator
// to create tar.bz2 file with the list of source
// files
this->Compress = BZIP2;
if ( !this->cmCPackTarBZip2Generator::
CompressFiles(packageDirFileName.c_str(),
toplevel, files) )
if ( !this->cmCPackTarBZip2Generator::PackageFiles() )
{
return 0;
}
@ -135,21 +133,25 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
patchFile += "/";
patchFile += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
std::vector<std::string> outerFiles;
std::string file = cmSystemTools::GetFilenameName(compressOutFile);
std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile);
sourceTar += "/";
sourceTar += file;
/* reset list of file to be packaged */
files.clear();
// a source release in cygwin should have the build script used
// to build the package, the patch file that is different from the
// regular upstream version of the sources, and a bziped tar file
// of the original sources
outerFiles.push_back(buildScript);
outerFiles.push_back(patchFile);
outerFiles.push_back(sourceTar);
if ( !this->cmCPackTarBZip2Generator::
CompressFiles(outerTarFile.c_str(),
tmpDir.c_str(), outerFiles) )
files.push_back(buildScript);
files.push_back(patchFile);
files.push_back(sourceTar);
/* update the name of the produced package */
packageFileNames[0] = outerTarFile;
/* update the toplevel dir */
toplevel = tmpDir;
if ( !this->cmCPackTarBZip2Generator::PackageFiles() )
{
return 0;
}

View File

@ -31,8 +31,7 @@ public:
protected:
const char* GetPackagingInstallPrefix();
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetOutputExtension();
std::string InstallPrefix;
std::string OutputExtension;

View File

@ -48,9 +48,7 @@ int cmCPackDebGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
int cmCPackDebGenerator::CompressFiles(const char* outFileName,
const char* toplevel,
const std::vector<std::string>& files)
int cmCPackDebGenerator::PackageFiles()
{
this->ReadListFile("CPackDeb.cmake");
const char* cmakeExecutable = this->GetOption("CMAKE_COMMAND");
@ -141,7 +139,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
// now add all directories which have to be compressed
// collect all top level install dirs for that
// e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would give /usr and /opt
size_t topLevelLength = strlen(toplevel);
size_t topLevelLength = toplevel.length();
std::set<std::string> installDirs;
for (std::vector<std::string>::const_iterator fileIt = files.begin();
fileIt != files.end(); ++ fileIt )
@ -160,7 +158,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
&retVal, toplevel.c_str(), this->GeneratorVerbose, 0);
if ( !res || retVal )
{
@ -196,7 +194,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
//std::string output;
//int retVal = -1;
res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
&retVal, toplevel.c_str(), this->GeneratorVerbose, 0);
// debian md5sums entries are like this:
// 014f3604694729f3bf19263bac599765 usr/bin/ccmake
// thus strip the full path (with the trailing slash)
@ -237,7 +235,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
}
}
res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
&retVal, toplevel.c_str(), this->GeneratorVerbose, 0);
if ( !res || retVal )
{
@ -263,7 +261,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
arFiles.push_back(topLevelString + "debian-binary");
arFiles.push_back(topLevelString + "control.tar.gz");
arFiles.push_back(topLevelString + "data.tar.gz");
res = ar_append(outFileName, arFiles);
res = ar_append(packageFileNames[0].c_str(), arFiles);
if ( res!=0 )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");

View File

@ -33,8 +33,7 @@ public:
protected:
virtual int InitializeInternal();
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual int PackageFiles();
virtual const char* GetOutputExtension() { return ".deb"; }
};

View File

@ -104,12 +104,10 @@ const char* cmCPackDragNDropGenerator::GetOutputExtension()
}
//----------------------------------------------------------------------
int cmCPackDragNDropGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackDragNDropGenerator::PackageFiles()
{
(void) files;
return this->CreateDMG(toplevel, outFileName);
return this->CreateDMG();
}
//----------------------------------------------------------------------
@ -161,8 +159,7 @@ bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command,
}
//----------------------------------------------------------------------
int cmCPackDragNDropGenerator::CreateDMG(const std::string& toplevel,
const std::string& outFileName)
int cmCPackDragNDropGenerator::CreateDMG()
{
// Get optional arguments ...
const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON")
@ -475,7 +472,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& toplevel,
final_image_command << cpack_dmg_format;
final_image_command << " -imagekey";
final_image_command << " zlib-level=9";
final_image_command << " -o \"" << outFileName << "\"";
final_image_command << " -o \"" << packageFileNames[0] << "\"";
if(!this->RunCommand(final_image_command))
{

View File

@ -29,14 +29,12 @@ public:
protected:
virtual int InitializeInternal();
virtual const char* GetOutputExtension();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
bool CopyFile(cmOStringStream& source, cmOStringStream& target);
bool RunCommand(cmOStringStream& command, std::string* output = 0);
virtual int CreateDMG(const std::string& installdir,
const std::string& outdmg);
int CreateDMG();
std::string InstallPrefix;
};

View File

@ -100,6 +100,7 @@ int cmCPackGenerator::PrepareNames()
}
std::string destFile = pdir;
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile.c_str());
destFile += "/" + outName;
std::string outFile = topDirectory + "/" + outName;
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
@ -330,13 +331,13 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string toplevel = it->c_str();
std::string top = it->c_str();
it ++;
std::string subdir = it->c_str();
std::string findExpr = toplevel;
std::string findExpr = top;
findExpr += "/*";
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install directory: " << toplevel << std::endl);
"- Install directory: " << top << std::endl);
gl.RecurseOn();
if ( !gl.FindFiles(findExpr) )
{
@ -344,7 +345,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
"Cannot find any files in the installed directory" << std::endl);
return 0;
}
std::vector<std::string>& files = gl.GetFiles();
files = gl.GetFiles();
std::vector<std::string>::iterator gfit;
std::vector<cmsys::RegularExpression>::iterator regIt;
for ( gfit = files.begin(); gfit != files.end(); ++ gfit )
@ -368,7 +369,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
std::string filePath = tempDir;
filePath += "/" + subdir + "/"
+ cmSystemTools::RelativePath(toplevel.c_str(), gfit->c_str());
+ cmSystemTools::RelativePath(top.c_str(), gfit->c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
@ -843,7 +844,7 @@ int cmCPackGenerator::DoPackage()
}
// The files to be installed
std::vector<std::string> files = gl.GetFiles();
files = gl.GetFiles();
// For component installations, determine which files go into which
// components.
@ -866,34 +867,59 @@ int cmCPackGenerator::DoPackage()
}
}
if ( !this->CompressFiles(tempPackageFileName,
tempDirectory, files) || cmSystemTools::GetErrorOccuredFlag())
packageFileNames.clear();
/* Put at least one file name into the list of
* wanted packageFileNames. The specific generator
* may update this during PackageFiles.
* (either putting several names or updating the provided one)
*/
packageFileNames.push_back(tempPackageFileName);
toplevel = tempDirectory;
if ( !this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag())
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory"
<< std::endl);
return 0;
}
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Finalize package" << std::endl);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Copy final package: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)" )
<< " to "
<< (packageFileName ? packageFileName : "(NULL)")
<< std::endl);
if ( !cmSystemTools::CopyFileIfDifferent(tempPackageFileName,
packageFileName) )
/*
* Copy the generated packages to final destination
* - there may be several of them
* - the initially provided name may have changed
* (because the specific generator did 'normalize' it)
*/
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Copying final package(s) ["
<<packageFileNames.size()
<<"]:"<<std::endl);
std::vector<std::string>::iterator it;
/* now copy package one by one */
for (it=packageFileNames.begin();it!=packageFileNames.end();++it)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the package: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)" )
<< " to "
<< (packageFileName ? packageFileName : "(NULL)")
<< std::endl);
return 0;
std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
tempPackageFileName = it->c_str();
tmpPF += "/"+cmSystemTools::GetFilenameName(*it);
packageFileName = tmpPF.c_str();
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy final package(s): "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)" )
<< " to "
<< (packageFileName ? packageFileName : "(NULL)")
<< std::endl);
if ( !cmSystemTools::CopyFileIfDifferent(tempPackageFileName,
packageFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the package: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)" )
<< " to "
<< (packageFileName ? packageFileName : "(NULL)")
<< std::endl);
return 0;
}
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- package: "
<< packageFileName
<< " generated." << std::endl);
}
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Package "
<< (packageFileName ? packageFileName : "(NULL)")
<< " generated." << std::endl);
return 1;
}
@ -984,12 +1010,8 @@ int cmCPackGenerator::SetCMakeRoot()
}
//----------------------------------------------------------------------
int cmCPackGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackGenerator::PackageFiles()
{
(void)outFileName;
(void)toplevel;
(void)files;
return 0;
}

View File

@ -55,13 +55,22 @@ class cmCPackGenerator : public cmObject
public:
cmTypeMacro(cmCPackGenerator, cmObject);
/**
* If verbose then more informaiton is printed out
* If verbose then more information is printed out
*/
void SetVerbose(bool val) { this->GeneratorVerbose = val; }
/**
* Do the actual processing. Subclass has to override it.
* Return 0 if error.
* Do the actual whole package processing.
* Subclass may redefine it but its usually enough
* to redefine @ref PackageFiles, because in fact
* this method do call:
* - PrepareName
* - clean-up temp dirs
* - InstallProject (with the appropriate method)
* - prepare list of files and/or components to be package
* - PackageFiles
* - Copy produced packages at the expected place
* @return 0 if error.
*/
virtual int DoPackage();
@ -94,13 +103,32 @@ public:
bool ReadListFile(const char* moduleName);
protected:
/**
* Prepare common used names by inspecting
* several CPACK_xxx var values.
*/
int PrepareNames();
/**
* Install the project using appropriate method.
*/
int InstallProject();
int CleanTemporaryDirectory();
virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return 0; }
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
/**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
* @pre @ref toplevel has been filled-in
* @pre the list of file @ref files has been populated
* @pre packageFileNames contains at least 1 entry
* @post packageFileNames may have been updated and contains
* the list of packages generated by the specific generator.
*/
virtual int PackageFiles();
virtual const char* GetInstallPath();
virtual const char* GetPackagingInstallPrefix();
@ -134,11 +162,42 @@ protected:
std::string InstallPath;
/**
* The list of package file names.
* At beginning of DoPackage the (generic) generator will populate
* the list of desired package file names then it will
* call the redefined method PackageFiles which is may
* either use this set of names (usually on entry there should be
* only a single name) or update the vector with the list
* of created package file names.
*/
std::vector<std::string> packageFileNames;
/**
* The directory where all the files to be packaged reside.
* If the installer support components there will be one
* sub-directory for each component. In those directories
* one will find the file belonging to the specified component.
*/
std::string toplevel;
/**
* The complete list of files to be packaged.
* This list will be populated by DoPackage before
* PackageFiles is called.
*/
std::vector<std::string> files;
std::string CPackSelf;
std::string CMakeSelf;
std::string CMakeRoot;
std::map<std::string, cmCPackInstallationType> InstallationTypes;
/**
* The set of components.
* If component installation is supported then this map
* contains the component specified in CPACK_COMPONENTS_ALL
*/
std::map<std::string, cmCPackComponent> Components;
std::map<std::string, cmCPackComponentGroup> ComponentGroups;

View File

@ -43,11 +43,10 @@ cmCPackNSISGenerator::~cmCPackNSISGenerator()
}
//----------------------------------------------------------------------
int cmCPackNSISGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackNSISGenerator::PackageFiles()
{
(void)outFileName; // TODO: Fix nsis to force out file name
(void)toplevel;
// TODO: Fix nsis to force out file name
std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
if ( nsisInFileName.size() == 0 )
{
@ -74,7 +73,7 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName,
std::vector<std::string>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++ it )
{
std::string fileN = cmSystemTools::RelativePath(toplevel,
std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(),
it->c_str());
if (!this->Components.empty())
{
@ -88,13 +87,13 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName,
<< str.str().c_str() << std::endl);
this->SetOptionIfNotSet("CPACK_NSIS_DELETE_FILES", str.str().c_str());
std::vector<std::string> dirs;
this->GetListOfSubdirectories(toplevel, dirs);
this->GetListOfSubdirectories(toplevel.c_str(), dirs);
std::vector<std::string>::const_iterator sit;
cmOStringStream dstr;
for ( sit = dirs.begin(); sit != dirs.end(); ++ sit )
{
std::string componentName;
std::string fileN = cmSystemTools::RelativePath(toplevel, sit->c_str());
std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(), sit->c_str());
if ( fileN.empty() )
{
continue;

View File

@ -37,8 +37,7 @@ protected:
virtual int InitializeInternal();
void CreateMenuLinks( cmOStringStream& str,
cmOStringStream& deleteStr);
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }

View File

@ -33,12 +33,10 @@ cmCPackOSXX11Generator::~cmCPackOSXX11Generator()
}
//----------------------------------------------------------------------
int cmCPackOSXX11Generator::CompressFiles(const char* outFileName,
const char* toplevel,
const std::vector<std::string>& files)
int cmCPackOSXX11Generator::PackageFiles()
{
(void) files; // TODO: Fix api to not need files.
(void) toplevel; // TODO: Use toplevel
// TODO: Use toplevel ?
// It is used! Is this an obsolete comment?
const char* cpackPackageExecutables
= this->GetOption("CPACK_PACKAGE_EXECUTABLES");
@ -144,7 +142,7 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName,
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
<< "\" create -ov -format UDZO -srcfolder \""
<< diskImageDirectory.c_str()
<< "\" \"" << outFileName << "\"";
<< "\" \"" << packageFileNames[0] << "\"";
int retVal = 1;
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Compress disk image using command: "

View File

@ -33,8 +33,7 @@ public:
protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetPackagingInstallPrefix();
virtual const char* GetOutputExtension() { return ".dmg"; }

View File

@ -59,12 +59,10 @@ int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir,
}
//----------------------------------------------------------------------
int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
const char* toplevel,
const std::vector<std::string>& files)
int cmCPackPackageMakerGenerator::PackageFiles()
{
(void) files; // TODO: Fix api to not need files.
(void) toplevel; // TODO: Use toplevel
// TODO: Use toplevel
// It is used! Is this an obsolete comment?
std::string resDir; // Where this package's resources will go.
std::string packageDirFileName
@ -318,7 +316,7 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
cmOStringStream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
<< "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName
<< "\" \"" << outFileName << "\"";
<< "\" \"" << packageFileNames[0] << "\"";
std::string output;
int retVal = 1;
int numTries = 4;

View File

@ -42,8 +42,7 @@ protected:
const char* script,
const char* name);
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual const char* GetOutputExtension() { return ".dmg"; }
virtual const char* GetOutputPostfix() { return "darwin"; }

View File

@ -31,9 +31,7 @@ int cmCPackRPMGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
int cmCPackRPMGenerator::CompressFiles(const char* /*outFileName*/,
const char* /*toplevel*/,
const std::vector<std::string>& /*files*/)
int cmCPackRPMGenerator::PackageFiles()
{
this->ReadListFile("CPackRPM.cmake");
if (!this->IsSet("RPMBUILD_EXECUTABLE"))

View File

@ -37,8 +37,7 @@ public:
protected:
virtual int InitializeInternal();
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual int PackageFiles();
virtual const char* GetOutputExtension() { return ".rpm"; }
};

View File

@ -52,14 +52,13 @@ int cmCPackSTGZGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
int cmCPackSTGZGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
int cmCPackSTGZGenerator::PackageFiles()
{
if ( !this->Superclass::CompressFiles(outFileName, toplevel, files) )
if ( !this->Superclass::PackageFiles() )
{
return 0;
}
return cmSystemTools::SetPermissions(outFileName,
return cmSystemTools::SetPermissions(packageFileNames[0].c_str(),
#if defined( _MSC_VER ) || defined( __MINGW32__ )
S_IREAD | S_IWRITE | S_IEXEC
#elif defined( __BORLANDC__ )

View File

@ -32,8 +32,7 @@ public:
virtual ~cmCPackSTGZGenerator();
protected:
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
int PackageFiles();
virtual int InitializeInternal();
int GenerateHeader(std::ostream* os);
virtual const char* GetOutputExtension() { return ".sh"; }