summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-04-05 18:28:59 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-04-05 18:28:59 (GMT)
commitc90fa7c00c142d42067ce90c07d52c6d489fe815 (patch)
tree9298e9136765615428e8a923ce7d7579278c485e
parente560bf4ba3cf860afe5bc8e23cd6d02dd1c366c1 (diff)
parent9c438240661c68da7c0b09b2d08a1facc4fe1dcc (diff)
downloadCMake-c90fa7c00c142d42067ce90c07d52c6d489fe815.zip
CMake-c90fa7c00c142d42067ce90c07d52c6d489fe815.tar.gz
CMake-c90fa7c00c142d42067ce90c07d52c6d489fe815.tar.bz2
Merge topic 'cpack-grouping-enum'
9c43824 Fix KWStyle warnings 64a5e20 Combine component packaging methods into an enum.
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx9
-rw-r--r--Source/CPack/cmCPackGenerator.cxx94
-rw-r--r--Source/CPack/cmCPackGenerator.h28
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx9
5 files changed, 97 insertions, 48 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 55d9890..0ce5b01 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -244,7 +244,7 @@ int cmCPackArchiveGenerator::PackageFiles()
// CASE 1 : COMPONENT ALL-IN-ONE package
// If ALL COMPONENTS in ONE package has been requested
// then the package file is unique and should be open here.
- if (allComponentInOne)
+ if (componentPackageMethod == ONE_PACKAGE)
{
return PackageComponentsAllInOne();
}
@@ -254,7 +254,8 @@ int cmCPackArchiveGenerator::PackageFiles()
// in this case you'll get 1 package for each component.
else
{
- return PackageComponents(ignoreComponentGroup);
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 82038e9..5665404 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -240,7 +240,7 @@ int cmCPackDebGenerator::PackageFiles()
// CASE 1 : COMPONENT ALL-IN-ONE package
// If ALL GROUPS or ALL COMPONENTS in ONE package has been requested
// then the package file is unique and should be open here.
- if (allComponentInOne)
+ if (componentPackageMethod == ONE_PACKAGE)
{
return PackageComponentsAllInOne();
}
@@ -250,7 +250,8 @@ int cmCPackDebGenerator::PackageFiles()
// in this case you'll get 1 package for each component.
else
{
- return PackageComponents(ignoreComponentGroup);
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
}
// CASE 3 : NON COMPONENT package.
@@ -560,11 +561,11 @@ bool cmCPackDebGenerator::SupportsComponentInstallation() const
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
{
- if (ignoreComponentGroup) {
+ if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
}
- if (allComponentInOne) {
+ if (componentPackageMethod == ONE_PACKAGE) {
return std::string("ALL_COMPONENTS_IN_ONE");
}
// We have to find the name of the COMPONENT GROUP
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 691092f..c8a77d1 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -36,8 +36,7 @@ cmCPackGenerator::cmCPackGenerator()
this->GeneratorVerbose = false;
this->MakefileMap = 0;
this->Logger = 0;
- this->allComponentInOne = false;
- this->ignoreComponentGroup = false;
+ this->componentPackageMethod = ONE_PACKAGE_PER_GROUP;
}
//----------------------------------------------------------------------
@@ -1263,14 +1262,23 @@ int cmCPackGenerator::CleanTemporaryDirectory()
//----------------------------------------------------------------------
int cmCPackGenerator::PrepareGroupingKind()
{
- // The default behavior is to create 1 package by component group
- // unless the user asked to put all COMPONENTS in a single package
- allComponentInOne = (NULL != (this->GetOption(
- "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))
- );
- ignoreComponentGroup = (NULL != (this->GetOption(
- "CPACK_COMPONENTS_IGNORE_GROUPS"))
- );
+ // find a component package method specified by the user
+ ComponentPackageMethod method = UNKNOWN_COMPONENT_PACKAGE_METHOD;
+
+ if(this->GetOption("CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))
+ {
+ method = ONE_PACKAGE;
+ }
+
+ if(this->GetOption("CPACK_COMPONENTS_IGNORE_GROUPS"))
+ {
+ method = ONE_PACKAGE_PER_COMPONENT;
+ }
+
+ if(this->GetOption("CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP"))
+ {
+ method = ONE_PACKAGE_PER_GROUP;
+ }
std::string groupingType;
@@ -1286,40 +1294,64 @@ int cmCPackGenerator::PrepareGroupingKind()
<< " requested component grouping = "<< groupingType <<std::endl);
if (groupingType == "ALL_COMPONENTS_IN_ONE")
{
- allComponentInOne = true;
+ method = ONE_PACKAGE;
}
else if (groupingType == "IGNORE")
{
- ignoreComponentGroup = true;
+ method = ONE_PACKAGE_PER_COMPONENT;
+ }
+ else if (groupingType == "ONE_PER_GROUP")
+ {
+ method = ONE_PACKAGE_PER_GROUP;
}
else
{
cmCPackLogger(cmCPackLog::LOG_WARNING, "["
- << this->Name << "]"
- << " requested component grouping type <"<< groupingType
- << "> UNKNOWN not in (ALL_COMPONENTS_IN_ONE,IGNORE)"
- << std::endl);
+ << this->Name << "]"
+ << " requested component grouping type <"<< groupingType
+ << "> UNKNOWN not in (ALL_COMPONENTS_IN_ONE,IGNORE,ONE_PER_GROUP)"
+ << std::endl);
+ }
+ }
+
+ // Some components were defined but NO group
+ // fallback to default if not group based
+ if(method == ONE_PACKAGE_PER_GROUP &&
+ this->ComponentGroups.empty() && !this->Components.empty())
+ {
+ if(componentPackageMethod == ONE_PACKAGE)
+ {
+ method = ONE_PACKAGE;
+ }
+ else
+ {
+ method = ONE_PACKAGE_PER_COMPONENT;
}
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "["
+ << this->Name << "]"
+ << " One package per component group requested, "
+ << "but NO component groups exist: Ignoring component group."
+ << std::endl);
}
+ // if user specified packaging method, override the default packaging method
+ if(method != UNKNOWN_COMPONENT_PACKAGE_METHOD)
+ {
+ componentPackageMethod = method;
+ }
+
+ const char* method_names[] =
+ {
+ "ALL_COMPONENTS_IN_ONE",
+ "IGNORE_GROUPS",
+ "ONE_PER_GROUP"
+ };
+
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
<< this->Name << "]"
- << " requested component grouping = ("
- << ", ALL_COMPONENTS_IN_ONE=" << allComponentInOne
- << ", IGNORE_GROUPS=" << ignoreComponentGroup
- << ")"
+ << " requested component grouping = "
+ << method_names[componentPackageMethod]
<< std::endl);
- // Some components were defined but NO group
- // force ignoreGroups
- if (this->ComponentGroups.empty() && (!this->Components.empty())
- && (!ignoreComponentGroup)) {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "["
- << this->Name << "]"
- << " Some Components defined but NO component group:"
- << " Ignoring component group."
- << std::endl);
- ignoreComponentGroup = true;
- }
return 1;
}
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 9549d0b..05d95b8 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -125,7 +125,7 @@ protected:
* CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE
* CPACK_COMPONENTS_IGNORE_GROUPS
* or
- * CPACK_COMPONENTS_GROUPING
+ * CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP
* @return 1 on success 0 on failure.
*/
virtual int PrepareGroupingKind();
@@ -237,16 +237,30 @@ protected:
*/
std::map<std::string, cmCPackComponent> Components;
std::map<std::string, cmCPackComponentGroup> ComponentGroups;
+
/**
- * If true All component will be put in a single package.
+ * If components are enabled, this enum represents the different
+ * ways of mapping components to package files.
*/
- bool allComponentInOne;
+ enum ComponentPackageMethod
+ {
+ /* one package for all components */
+ ONE_PACKAGE,
+ /* one package for each component */
+ ONE_PACKAGE_PER_COMPONENT,
+ /* one package for each group,
+ * with left over components in their own package */
+ ONE_PACKAGE_PER_GROUP,
+ UNKNOWN_COMPONENT_PACKAGE_METHOD
+ };
+
/**
- * If true component grouping will be ignored.
- * You will still get 1 package for each component unless
- * allComponentInOne is true.
+ * The component package method
+ * The default is ONE_PACKAGE_PER_GROUP,
+ * and generators may override the default
+ * before PrepareGroupingKind() is called.
*/
- bool ignoreComponentGroup;
+ ComponentPackageMethod componentPackageMethod;
cmCPackLog* Logger;
private:
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index c926be6..1a6c3be 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -205,7 +205,7 @@ int cmCPackRPMGenerator::PackageFiles()
// CASE 1 : COMPONENT ALL-IN-ONE package
// If ALL COMPONENTS in ONE package has been requested
// then the package file is unique and should be open here.
- if (allComponentInOne)
+ if (componentPackageMethod == ONE_PACKAGE)
{
return PackageComponentsAllInOne();
}
@@ -215,7 +215,8 @@ int cmCPackRPMGenerator::PackageFiles()
// in this case you'll get 1 package for each component.
else
{
- return PackageComponents(ignoreComponentGroup);
+ return PackageComponents(componentPackageMethod ==
+ ONE_PACKAGE_PER_COMPONENT);
}
}
// CASE 3 : NON COMPONENT package.
@@ -252,11 +253,11 @@ bool cmCPackRPMGenerator::SupportsComponentInstallation() const
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
{
- if (ignoreComponentGroup) {
+ if (componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
}
- if (allComponentInOne) {
+ if (componentPackageMethod == ONE_PACKAGE) {
return std::string("ALL_COMPONENTS_IN_ONE");
}
// We have to find the name of the COMPONENT GROUP