Merge topic 'cpack-deb-component-vars-prepare'

c8375e15 CPackDeb: Refactor package variable lookup by generator
This commit is contained in:
Brad King 2015-04-21 09:39:51 -04:00 committed by CMake Topic Stage
commit 0d852d4c65
2 changed files with 268 additions and 244 deletions

View File

@ -223,18 +223,19 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
endif() endif()
# CPACK_DEBIAN_PACKAGE_SHLIBDEPS function(cpack_deb_prepare_package_vars)
# If specify OFF, only user depends are used # CPACK_DEBIAN_PACKAGE_SHLIBDEPS
if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # If specify OFF, only user depends are used
if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
endif() endif()
find_program(FAKEROOT_EXECUTABLE fakeroot) find_program(FAKEROOT_EXECUTABLE fakeroot)
if(FAKEROOT_EXECUTABLE) if(FAKEROOT_EXECUTABLE)
set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
endif() endif()
if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
# dpkg-shlibdeps is a Debian utility for generating dependency list # dpkg-shlibdeps is a Debian utility for generating dependency list
find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
@ -319,34 +320,34 @@ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
endif() endif()
endif() endif()
else () else ()
if(CPACK_DEBIAN_PACKAGE_DEBUG) if(CPACK_DEBIAN_PACKAGE_DEBUG)
message( "CPackDeb Debug: Using only user-provided depends") message( "CPackDeb Debug: Using only user-provided depends")
endif() endif()
endif() endif()
# Let's define the control file found in debian package: # Let's define the control file found in debian package:
# Binary package: # Binary package:
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
# DEBIAN/control # DEBIAN/control
# debian policy enforce lower case for package name # debian policy enforce lower case for package name
# Package: (mandatory) # Package: (mandatory)
if(NOT CPACK_DEBIAN_PACKAGE_NAME) if(NOT CPACK_DEBIAN_PACKAGE_NAME)
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
endif() endif()
# Version: (mandatory) # Version: (mandatory)
if(NOT CPACK_DEBIAN_PACKAGE_VERSION) if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
if(NOT CPACK_PACKAGE_VERSION) if(NOT CPACK_PACKAGE_VERSION)
message(FATAL_ERROR "CPackDeb: Debian package requires a package version") message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
endif() endif()
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
endif() endif()
# Architecture: (mandatory) # Architecture: (mandatory)
if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
# There is no such thing as i686 architecture on debian, you should use i386 instead # There is no such thing as i686 architecture on debian, you should use i386 instead
# $ dpkg --print-architecture # $ dpkg --print-architecture
find_program(DPKG_CMD dpkg) find_program(DPKG_CMD dpkg)
@ -358,78 +359,78 @@ if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
endif() endif()
# have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
# this returns the successful find_package() calls, maybe this can help # this returns the successful find_package() calls, maybe this can help
# Depends: # Depends:
# You should set: DEBIAN_PACKAGE_DEPENDS # You should set: DEBIAN_PACKAGE_DEPENDS
# TODO: automate 'objdump -p | grep NEEDED' # TODO: automate 'objdump -p | grep NEEDED'
if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
endif() endif()
# Maintainer: (mandatory) # Maintainer: (mandatory)
if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
if(NOT CPACK_PACKAGE_CONTACT) if(NOT CPACK_PACKAGE_CONTACT)
message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
endif() endif()
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
endif() endif()
# Description: (mandatory) # Description: (mandatory)
if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
endif() endif()
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
endif() endif()
# Section: (recommended) # Section: (recommended)
if(NOT CPACK_DEBIAN_PACKAGE_SECTION) if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
set(CPACK_DEBIAN_PACKAGE_SECTION "devel") set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
endif() endif()
# Priority: (recommended) # Priority: (recommended)
if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
endif() endif()
# Compression: (recommended) # Compression: (recommended)
if(NOT CPACK_DEBIAN_COMPRESSION_TYPE) if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip") set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
endif() endif()
# Recommends: # Recommends:
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
# Suggests: # Suggests:
# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive) # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
# Typical examples are: # Typical examples are:
# - conffiles # - conffiles
# - postinst # - postinst
# - postrm # - postrm
# - prerm" # - prerm"
# Usage: # Usage:
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
# Are we packaging components ? # Are we packaging components ?
if(CPACK_DEB_PACKAGE_COMPONENT) if(CPACK_DEB_PACKAGE_COMPONENT)
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
else() else()
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
endif() endif()
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
# Print out some debug information if we were asked for that # Print out some debug information if we were asked for that
if(CPACK_DEBIAN_PACKAGE_DEBUG) if(CPACK_DEBIAN_PACKAGE_DEBUG)
message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
@ -438,18 +439,44 @@ if(CPACK_DEBIAN_PACKAGE_DEBUG)
message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
endif() endif()
# For debian source packages: # For debian source packages:
# debian/control # debian/control
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
# .dsc # .dsc
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
# Builds-Depends: # Builds-Depends:
#if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) #if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
# set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS # set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4" # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
# ) # )
#endif() #endif()
# move variables to parent scope so that they may be used to create debian package
set(GEN_CPACK_DEBIAN_PACKAGE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_DEBIAN_PACKAGE_SECTION}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_PRIORITY "${CPACK_DEBIAN_PACKAGE_PRIORITY}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE "${CPACK_DEBIAN_FAKEROOT_EXECUTABLE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_DEBIAN_PACKAGE_HOMEPAGE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS "${CPACK_DEBIAN_PACKAGE_PREDEPENDS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_ENHANCES "${CPACK_DEBIAN_PACKAGE_ENHANCES}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_BREAKS "${CPACK_DEBIAN_PACKAGE_BREAKS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS "${CPACK_DEBIAN_PACKAGE_CONFLICTS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE)
set(GEN_WDIR "${WDIR}" PARENT_SCOPE)
endfunction()
cpack_deb_prepare_package_vars()

View File

@ -90,7 +90,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
} }
cmsys::Glob gl; cmsys::Glob gl;
std::string findExpr(this->GetOption("WDIR")); std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*"; findExpr += "/*";
gl.RecurseOn(); gl.RecurseOn();
if ( !gl.FindFiles(findExpr) ) if ( !gl.FindFiles(findExpr) )
@ -217,7 +217,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne()
} }
cmsys::Glob gl; cmsys::Glob gl;
std::string findExpr(this->GetOption("WDIR")); std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*"; findExpr += "/*";
gl.RecurseOn(); gl.RecurseOn();
if ( !gl.FindFiles(findExpr) ) if ( !gl.FindFiles(findExpr) )
@ -286,7 +286,7 @@ int cmCPackDebGenerator::createDeb()
// debian-binary file // debian-binary file
std::string dbfilename; std::string dbfilename;
dbfilename += this->GetOption("WDIR"); dbfilename += this->GetOption("GEN_WDIR");
dbfilename += "/debian-binary"; dbfilename += "/debian-binary";
{ // the scope is needed for cmGeneratedFileStream { // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(dbfilename.c_str()); cmGeneratedFileStream out(dbfilename.c_str());
@ -296,44 +296,47 @@ int cmCPackDebGenerator::createDeb()
// control file // control file
std::string ctlfilename; std::string ctlfilename;
ctlfilename = this->GetOption("WDIR"); ctlfilename = this->GetOption("GEN_WDIR");
ctlfilename += "/control"; ctlfilename += "/control";
// debian policy enforce lower case for package name // debian policy enforce lower case for package name
// mandatory entries: // mandatory entries:
std::string debian_pkg_name = cmsys::SystemTools::LowerCase( 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 = const char* debian_pkg_version =
this->GetOption("CPACK_DEBIAN_PACKAGE_VERSION"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_VERSION");
const char* debian_pkg_section = const char* debian_pkg_section =
this->GetOption("CPACK_DEBIAN_PACKAGE_SECTION"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SECTION");
const char* debian_pkg_priority = const char* debian_pkg_priority =
this->GetOption("CPACK_DEBIAN_PACKAGE_PRIORITY"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PRIORITY");
const char* debian_pkg_arch = const char* debian_pkg_arch =
this->GetOption("CPACK_DEBIAN_PACKAGE_ARCHITECTURE"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE");
const char* maintainer = this->GetOption("CPACK_DEBIAN_PACKAGE_MAINTAINER"); const char* maintainer =
const char* desc = this->GetOption("CPACK_DEBIAN_PACKAGE_DESCRIPTION"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER");
const char* desc =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION");
// optional entries // 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 = const char* debian_pkg_rec =
this->GetOption("CPACK_DEBIAN_PACKAGE_RECOMMENDS"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS");
const char* debian_pkg_sug = const char* debian_pkg_sug =
this->GetOption("CPACK_DEBIAN_PACKAGE_SUGGESTS"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS");
const char* debian_pkg_url = const char* debian_pkg_url =
this->GetOption("CPACK_DEBIAN_PACKAGE_HOMEPAGE"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE");
const char* debian_pkg_predep = const char* debian_pkg_predep =
this->GetOption("CPACK_DEBIAN_PACKAGE_PREDEPENDS"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS");
const char* debian_pkg_enhances = const char* debian_pkg_enhances =
this->GetOption("CPACK_DEBIAN_PACKAGE_ENHANCES"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_ENHANCES");
const char* debian_pkg_breaks = const char* debian_pkg_breaks =
this->GetOption("CPACK_DEBIAN_PACKAGE_BREAKS"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_BREAKS");
const char* debian_pkg_conflicts = const char* debian_pkg_conflicts =
this->GetOption("CPACK_DEBIAN_PACKAGE_CONFLICTS"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS");
const char* debian_pkg_provides = const char* debian_pkg_provides =
this->GetOption("CPACK_DEBIAN_PACKAGE_PROVIDES"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PROVIDES");
const char* debian_pkg_replaces = const char* debian_pkg_replaces =
this->GetOption("CPACK_DEBIAN_PACKAGE_REPLACES"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_REPLACES");
{ // the scope is needed for cmGeneratedFileStream { // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(ctlfilename.c_str()); cmGeneratedFileStream out(ctlfilename.c_str());
@ -399,13 +402,10 @@ int cmCPackDebGenerator::createDeb()
out << std::endl; out << std::endl;
} }
std::string cmd; std::string cmd(this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE"));
if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE")) {
cmd += this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
}
const char* debian_compression_type = const char* debian_compression_type =
this->GetOption("CPACK_DEBIAN_COMPRESSION_TYPE"); this->GetOption("GEN_CPACK_DEBIAN_COMPRESSION_TYPE");
if(!debian_compression_type) if(!debian_compression_type)
{ {
debian_compression_type = "gzip"; debian_compression_type = "gzip";
@ -440,8 +440,9 @@ int cmCPackDebGenerator::createDeb()
// now add all directories which have to be compressed // now add all directories which have to be compressed
// collect all top level install dirs for that // 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 // 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(); size_t topLevelLength = std::string(this->GetOption("GEN_WDIR")).length();
cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \"" << this->GetOption("WDIR") cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \""
<< this->GetOption("GEN_WDIR")
<< "\", length = " << topLevelLength << "\", length = " << topLevelLength
<< std::endl); << std::endl);
std::set<std::string> installDirs; std::set<std::string> installDirs;
@ -467,7 +468,7 @@ int cmCPackDebGenerator::createDeb()
std::string output; std::string output;
int retval = -1; int retval = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, 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 ) if ( !res || retval )
{ {
@ -485,7 +486,7 @@ int cmCPackDebGenerator::createDeb()
} }
std::string md5filename; std::string md5filename;
md5filename = this->GetOption("WDIR"); md5filename = this->GetOption("GEN_WDIR");
md5filename += "/md5sums"; md5filename += "/md5sums";
{ // the scope is needed for cmGeneratedFileStream { // the scope is needed for cmGeneratedFileStream
@ -523,14 +524,10 @@ int cmCPackDebGenerator::createDeb()
// Do not end the md5sum file with yet another (invalid) // Do not end the md5sum file with yet another (invalid)
} }
cmd = ""; cmd = this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE"))
{
cmd = this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
}
cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums"; cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums";
const char* controlExtra = const char* controlExtra =
this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA"); this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
if( controlExtra ) if( controlExtra )
{ {
std::vector<std::string> controlExtraList; std::vector<std::string> controlExtraList;
@ -540,7 +537,7 @@ int cmCPackDebGenerator::createDeb()
{ {
std::string filenamename = std::string filenamename =
cmsys::SystemTools::GetFilenameName(*i); cmsys::SystemTools::GetFilenameName(*i);
std::string localcopy = this->GetOption("WDIR"); std::string localcopy = this->GetOption("GEN_WDIR");
localcopy += "/"; localcopy += "/";
localcopy += filenamename; localcopy += filenamename;
// if we can copy the file, it means it does exist, let's add it: // 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, 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 ) if ( !res || retval )
{ {
@ -575,7 +572,7 @@ int cmCPackDebGenerator::createDeb()
// since debian packages require BSD ar (most Linux distros and even // 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. // FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here.
std::vector<std::string> arFiles; std::vector<std::string> arFiles;
std::string topLevelString = this->GetOption("WDIR"); std::string topLevelString = this->GetOption("GEN_WDIR");
topLevelString += "/"; topLevelString += "/";
arFiles.push_back(topLevelString + "debian-binary"); arFiles.push_back(topLevelString + "debian-binary");
arFiles.push_back(topLevelString + "control.tar.gz"); arFiles.push_back(topLevelString + "control.tar.gz");