summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cmCPackDebGenerator.cxx
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-04-20 18:48:24 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-21 12:47:18 (GMT)
commitc8375e15eb9338d79b9decb55f1ebbf1d68fad71 (patch)
tree73cabe5b22fab57a32ee854c2545fe1d26458f6c /Source/CPack/cmCPackDebGenerator.cxx
parentb2289ff6542b79772e874c6dba157f72bb17c8be (diff)
downloadCMake-c8375e15eb9338d79b9decb55f1ebbf1d68fad71.zip
CMake-c8375e15eb9338d79b9decb55f1ebbf1d68fad71.tar.gz
CMake-c8375e15eb9338d79b9decb55f1ebbf1d68fad71.tar.bz2
CPackDeb: Refactor package variable lookup by generator
Preparation for per component variables. Patch makes sure we know which variables will be set for per component generator and also prevents accidental overflows of variable values between components.
Diffstat (limited to 'Source/CPack/cmCPackDebGenerator.cxx')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx75
1 files changed, 36 insertions, 39 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index fa02a3b..18597e8 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -90,7 +90,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
}
cmsys::Glob gl;
- std::string findExpr(this->GetOption("WDIR"));
+ std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*";
gl.RecurseOn();
if ( !gl.FindFiles(findExpr) )
@@ -217,7 +217,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne()
}
cmsys::Glob gl;
- std::string findExpr(this->GetOption("WDIR"));
+ std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*";
gl.RecurseOn();
if ( !gl.FindFiles(findExpr) )
@@ -286,7 +286,7 @@ int cmCPackDebGenerator::createDeb()
// debian-binary file
std::string dbfilename;
- dbfilename += this->GetOption("WDIR");
+ dbfilename += this->GetOption("GEN_WDIR");
dbfilename += "/debian-binary";
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(dbfilename.c_str());
@@ -296,44 +296,47 @@ int cmCPackDebGenerator::createDeb()
// control file
std::string ctlfilename;
- ctlfilename = this->GetOption("WDIR");
+ ctlfilename = this->GetOption("GEN_WDIR");
ctlfilename += "/control";
// debian policy enforce lower case for package name
// mandatory entries:
std::string debian_pkg_name = cmsys::SystemTools::LowerCase(
- this->GetOption("CPACK_DEBIAN_PACKAGE_NAME") );
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_NAME") );
const char* debian_pkg_version =
- this->GetOption("CPACK_DEBIAN_PACKAGE_VERSION");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_VERSION");
const char* debian_pkg_section =
- this->GetOption("CPACK_DEBIAN_PACKAGE_SECTION");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SECTION");
const char* debian_pkg_priority =
- this->GetOption("CPACK_DEBIAN_PACKAGE_PRIORITY");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PRIORITY");
const char* debian_pkg_arch =
- this->GetOption("CPACK_DEBIAN_PACKAGE_ARCHITECTURE");
- const char* maintainer = this->GetOption("CPACK_DEBIAN_PACKAGE_MAINTAINER");
- const char* desc = this->GetOption("CPACK_DEBIAN_PACKAGE_DESCRIPTION");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE");
+ const char* maintainer =
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER");
+ const char* desc =
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION");
// optional entries
- const char* debian_pkg_dep = this->GetOption("CPACK_DEBIAN_PACKAGE_DEPENDS");
+ const char* debian_pkg_dep =
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_DEPENDS");
const char* debian_pkg_rec =
- this->GetOption("CPACK_DEBIAN_PACKAGE_RECOMMENDS");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS");
const char* debian_pkg_sug =
- this->GetOption("CPACK_DEBIAN_PACKAGE_SUGGESTS");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS");
const char* debian_pkg_url =
- this->GetOption("CPACK_DEBIAN_PACKAGE_HOMEPAGE");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE");
const char* debian_pkg_predep =
- this->GetOption("CPACK_DEBIAN_PACKAGE_PREDEPENDS");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS");
const char* debian_pkg_enhances =
- this->GetOption("CPACK_DEBIAN_PACKAGE_ENHANCES");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_ENHANCES");
const char* debian_pkg_breaks =
- this->GetOption("CPACK_DEBIAN_PACKAGE_BREAKS");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_BREAKS");
const char* debian_pkg_conflicts =
- this->GetOption("CPACK_DEBIAN_PACKAGE_CONFLICTS");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS");
const char* debian_pkg_provides =
- this->GetOption("CPACK_DEBIAN_PACKAGE_PROVIDES");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PROVIDES");
const char* debian_pkg_replaces =
- this->GetOption("CPACK_DEBIAN_PACKAGE_REPLACES");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_REPLACES");
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(ctlfilename.c_str());
@@ -399,13 +402,10 @@ int cmCPackDebGenerator::createDeb()
out << std::endl;
}
- std::string cmd;
- if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE")) {
- cmd += this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
- }
+ std::string cmd(this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE"));
const char* debian_compression_type =
- this->GetOption("CPACK_DEBIAN_COMPRESSION_TYPE");
+ this->GetOption("GEN_CPACK_DEBIAN_COMPRESSION_TYPE");
if(!debian_compression_type)
{
debian_compression_type = "gzip";
@@ -440,8 +440,9 @@ int cmCPackDebGenerator::createDeb()
// 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 = std::string(this->GetOption("WDIR")).length();
- cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \"" << this->GetOption("WDIR")
+ size_t topLevelLength = std::string(this->GetOption("GEN_WDIR")).length();
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \""
+ << this->GetOption("GEN_WDIR")
<< "\", length = " << topLevelLength
<< std::endl);
std::set<std::string> installDirs;
@@ -467,7 +468,7 @@ int cmCPackDebGenerator::createDeb()
std::string output;
int retval = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0);
+ &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0);
if ( !res || retval )
{
@@ -485,7 +486,7 @@ int cmCPackDebGenerator::createDeb()
}
std::string md5filename;
- md5filename = this->GetOption("WDIR");
+ md5filename = this->GetOption("GEN_WDIR");
md5filename += "/md5sums";
{ // the scope is needed for cmGeneratedFileStream
@@ -523,14 +524,10 @@ int cmCPackDebGenerator::createDeb()
// Do not end the md5sum file with yet another (invalid)
}
- cmd = "";
- if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE"))
- {
- cmd = this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
- }
+ cmd = this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums";
const char* controlExtra =
- this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
+ this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
if( controlExtra )
{
std::vector<std::string> controlExtraList;
@@ -540,7 +537,7 @@ int cmCPackDebGenerator::createDeb()
{
std::string filenamename =
cmsys::SystemTools::GetFilenameName(*i);
- std::string localcopy = this->GetOption("WDIR");
+ std::string localcopy = this->GetOption("GEN_WDIR");
localcopy += "/";
localcopy += filenamename;
// if we can copy the file, it means it does exist, let's add it:
@@ -554,7 +551,7 @@ int cmCPackDebGenerator::createDeb()
}
}
res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0);
+ &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0);
if ( !res || retval )
{
@@ -575,7 +572,7 @@ int cmCPackDebGenerator::createDeb()
// since debian packages require BSD ar (most Linux distros and even
// FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here.
std::vector<std::string> arFiles;
- std::string topLevelString = this->GetOption("WDIR");
+ std::string topLevelString = this->GetOption("GEN_WDIR");
topLevelString += "/";
arFiles.push_back(topLevelString + "debian-binary");
arFiles.push_back(topLevelString + "control.tar.gz");