summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-03-01 20:30:14 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-03-01 20:30:14 (GMT)
commitb5b4aa2f713fd7e18a70b09d52aec1841c8393cf (patch)
tree71c69db9340161b1bc8bf89297e66104cea2dafe /Source/CPack
parentc55ce31c6e8a8e05333fcd8b159939aeef7f8aff (diff)
parent3fb89cf8bdae9b534dddb45b786903de4c9ac7aa (diff)
downloadCMake-b5b4aa2f713fd7e18a70b09d52aec1841c8393cf.zip
CMake-b5b4aa2f713fd7e18a70b09d52aec1841c8393cf.tar.gz
CMake-b5b4aa2f713fd7e18a70b09d52aec1841c8393cf.tar.bz2
Merge topic 'CPack-ChangeComponentNamingScheme'
3fb89cf CPack remove previously CPack generated files (if any) before running CPack f2ab270 CPack fix KWStyle warning 4deb308 CPack Authorize DISPLAY_NAME usage in component package 8c450f6 CPack remove "-ALL" suffix for ALL-IN-ONE packages
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx18
-rw-r--r--Source/CPack/cmCPackGenerator.cxx41
-rw-r--r--Source/CPack/cmCPackGenerator.h13
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx15
4 files changed, 74 insertions, 13 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index febf205..3c670a1 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -121,9 +121,11 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
<< std::endl);
// Begin the archive for this group
std::string packageFileName= std::string(toplevel);
- packageFileName += "/"
- +std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-"+compGIt->first + this->GetOutputExtension();
+ packageFileName += "/"+
+ GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
+ compGIt->first,
+ true)
+ + this->GetOutputExtension();
// open a block in order to automatically close archive
// at the end of the block
{
@@ -154,9 +156,11 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
std::string packageFileName = std::string(toplevel);
localToplevel += "/"+ compIt->first;
- packageFileName += "/"
- +std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-"+compIt->first + this->GetOutputExtension();
+ packageFileName += "/"+
+ GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
+ compIt->first,
+ false)
+ + this->GetOutputExtension();
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName,archive);
// Add the files of this component to the archive
@@ -177,7 +181,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent)
packageFileNames.push_back(std::string(toplevel));
packageFileNames[0] += "/"
+std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-ALL" + this->GetOutputExtension();
+ + this->GetOutputExtension();
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
"(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE is set)"
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 69d9b8c..86200c1 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1309,10 +1309,51 @@ int cmCPackGenerator::PrepareGroupingKind()
return 1;
}
+//----------------------------------------------------------------------
std::string cmCPackGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName) {
return componentName;
}
+//----------------------------------------------------------------------
+std::string cmCPackGenerator::GetComponentPackageFileName(
+ const std::string& initialPackageFileName,
+ const std::string& groupOrComponentName,
+ bool isGroupName) {
+
+ /*
+ * the default behavior is to use the
+ * component [group] name as a suffix
+ */
+ std::string suffix="-"+groupOrComponentName;
+ /* check if we should use DISPLAY name */
+ std::string dispNameVar = "CPACK_"+Name+"_USE_DISPLAY_NAME_IN_FILENAME";
+ if (IsOn(dispNameVar.c_str()))
+ {
+ /* the component Group case */
+ if (isGroupName)
+ {
+ std::string groupDispVar = "CPACK_COMPONENT_GROUP_"
+ + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
+ const char* groupDispName = GetOption(groupDispVar.c_str());
+ if (groupDispName)
+ {
+ suffix = "-"+std::string(groupDispName);
+ }
+ }
+ /* the [single] component case */
+ else
+ {
+ std::string dispVar = "CPACK_COMPONENT_"
+ + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
+ const char* dispName = GetOption(dispVar.c_str());
+ if(dispName)
+ {
+ suffix = "-"+std::string(dispName);
+ }
+ }
+ }
+ return initialPackageFileName + suffix;
+}
//----------------------------------------------------------------------
bool cmCPackGenerator::SupportsComponentInstallation() const
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index d4b1b16..0497d1c 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -145,6 +145,19 @@ protected:
const std::string& componentName);
/**
+ * CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
+ * with CPACK_COMPONENT_xxxx_<NAME>_DISPLAY_NAME if
+ * CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME is ON.
+ * @param[in] initialPackageFileName
+ * @param[in] groupOrComponentName
+ * @param[in] isGroupName
+ */
+ virtual std::string GetComponentPackageFileName(
+ const std::string& initialPackageFileName,
+ const std::string& groupOrComponentName,
+ bool isGroupName);
+
+ /**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
* @pre @ref toplevel has been filled-in
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index cc50580..0b0c6b1 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -75,8 +75,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
cmSystemTools::GetParentDirectory(toplevel.c_str())
);
std::string outputFileName(
- std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-"+compGIt->first + this->GetOutputExtension()
+ GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
+ compGIt->first,
+ true)
+ + this->GetOutputExtension()
);
localToplevel += "/"+ compGIt->first;
@@ -113,9 +115,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
cmSystemTools::GetParentDirectory(toplevel.c_str())
);
std::string outputFileName(
- std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")
- )
- +"-"+compIt->first + this->GetOutputExtension());
+ GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
+ compIt->first,
+ false)
+ + this->GetOutputExtension());
localToplevel += "/"+ compIt->first;
/* replace the TEMP DIRECTORY with the component one */
@@ -173,7 +176,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(bool allComponent)
);
std::string outputFileName(
std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-ALL"+ this->GetOutputExtension()
+ + this->GetOutputExtension()
);
// all GROUP in one vs all COMPONENT in one
localToplevel += "/"+compInstDirName;