summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cmCPackDebGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack/cmCPackDebGenerator.cxx')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx193
1 files changed, 79 insertions, 114 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index ca2185c..82038e9 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -51,6 +51,62 @@ int cmCPackDebGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
+int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
+ std::string packageName)
+ {
+ int retval = 1;
+ // Begin the archive for this pack
+ std::string localToplevel(initialTopLevel);
+ std::string packageFileName(
+ cmSystemTools::GetParentDirectory(toplevel.c_str())
+ );
+ std::string outputFileName(
+ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+ +"-"+packageName + this->GetOutputExtension()
+ );
+
+ localToplevel += "/"+ packageName;
+ /* replace the TEMP DIRECTORY with the component one */
+ this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str());
+ packageFileName += "/"+ outputFileName;
+ /* replace proposed CPACK_OUTPUT_FILE_NAME */
+ this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str());
+ /* replace the TEMPORARY package file name */
+ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
+ packageFileName.c_str());
+ // Tell CPackDeb.cmake the name of the component GROUP.
+ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",packageName.c_str());
+ if (!this->ReadListFile("CPackDeb.cmake"))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error while execution CPackDeb.cmake" << std::endl);
+ retval = 0;
+ return retval;
+ }
+
+ cmsys::Glob gl;
+ std::string findExpr(this->GetOption("WDIR"));
+ findExpr += "/*";
+ gl.RecurseOn();
+ if ( !gl.FindFiles(findExpr) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot find any files in the installed directory" << std::endl);
+ return 0;
+ }
+ packageFiles = gl.GetFiles();
+
+ int res = createDeb();
+ if (res != 1)
+ {
+ retval = 0;
+ }
+ // add the generated package to package file names list
+ packageFileNames.push_back(packageFileName);
+ return retval;
+}
+
+//----------------------------------------------------------------------
int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
{
int retval = 1;
@@ -71,53 +127,24 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
<< compGIt->first
<< std::endl);
// Begin the archive for this group
- std::string localToplevel(initialTopLevel);
- std::string packageFileName(
- cmSystemTools::GetParentDirectory(toplevel.c_str())
- );
- std::string outputFileName(
- std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
- +"-"+compGIt->first + this->GetOutputExtension()
- );
-
- localToplevel += "/"+ compGIt->first;
- /* replace the TEMP DIRECTORY with the component one */
- this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str());
- packageFileName += "/"+ outputFileName;
- /* replace proposed CPACK_OUTPUT_FILE_NAME */
- this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str());
- /* replace the TEMPORARY package file name */
- this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
- packageFileName.c_str());
- // Tell CPackDeb.cmake the name of the component GROUP.
- this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compGIt->first.c_str());
- if (!this->ReadListFile("CPackDeb.cmake"))
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Error while execution CPackDeb.cmake" << std::endl);
- retval = 0;
- return retval;
- }
-
- cmsys::Glob gl;
- std::string findExpr(this->GetOption("WDIR"));
- findExpr += "/*";
- gl.RecurseOn();
- if ( !gl.FindFiles(findExpr) )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find any files in the installed directory" << std::endl);
- return 0;
- }
- packageFiles = gl.GetFiles();
-
- int res = createDeb();
- if (res != 1)
+ retval &= PackageOnePack(initialTopLevel,compGIt->first);
+ }
+ // Handle Orphan components (components not belonging to any groups)
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt=this->Components.begin();
+ compIt!=this->Components.end(); ++compIt )
+ {
+ // Does the component belong to a group?
+ if (compIt->second.Group==NULL)
{
- retval = 0;
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Component <"
+ << compIt->second.Name
+ << "> does not belong to any group, package it separately."
+ << std::endl);
+ // Begin the archive for this orphan component
+ retval &= PackageOnePack(initialTopLevel,compIt->first);
}
- // add the generated package to package file names list
- packageFileNames.push_back(packageFileName);
}
}
// CPACK_COMPONENTS_IGNORE_GROUPS is set
@@ -128,59 +155,14 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
for (compIt=this->Components.begin();
compIt!=this->Components.end(); ++compIt )
{
- std::string localToplevel(initialTopLevel);
- std::string packageFileName(
- cmSystemTools::GetParentDirectory(toplevel.c_str())
- );
- std::string outputFileName(
- std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")
- )
- +"-"+compIt->first + this->GetOutputExtension());
-
- localToplevel += "/"+ compIt->first;
- /* replace the TEMP DIRECTORY with the component one */
- this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str());
- packageFileName += "/"+ outputFileName;
- /* replace proposed CPACK_OUTPUT_FILE_NAME */
- this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str());
- /* replace the TEMPORARY package file name */
- this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
- packageFileName.c_str());
-
- this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compIt->first.c_str());
- if (!this->ReadListFile("CPackDeb.cmake"))
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Error while execution CPackDeb.cmake" << std::endl);
- retval = 0;
- return retval;
- }
- cmsys::Glob gl;
- std::string findExpr(this->GetOption("WDIR"));
- findExpr += "/*";
- gl.RecurseOn();
- if ( !gl.FindFiles(findExpr) )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find any files in the installed directory" << std::endl);
- return 0;
- }
- packageFiles = gl.GetFiles();
-
- int res = createDeb();
- if (res != 1)
- {
- retval = 0;
- }
- // add the generated package to package file names list
- packageFileNames.push_back(packageFileName);
+ retval &= PackageOnePack(initialTopLevel,compIt->first);
}
}
return retval;
}
//----------------------------------------------------------------------
-int cmCPackDebGenerator::PackageComponentsAllInOne(bool allComponent)
+int cmCPackDebGenerator::PackageComponentsAllInOne()
{
int retval = 1;
std::string compInstDirName;
@@ -189,15 +171,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(bool allComponent)
packageFileNames.clear();
std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
- // all GROUP in one vs all COMPONENT in one
- if (allComponent)
- {
- compInstDirName = "ALL_COMPONENTS_IN_ONE";
- }
- else
- {
- compInstDirName = "ALL_GROUPS_IN_ONE";
- }
+ compInstDirName = "ALL_COMPONENTS_IN_ONE";
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
@@ -266,17 +240,15 @@ 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 ||
- (allGroupInOne && (!this->ComponentGroups.empty()))
- )
+ if (allComponentInOne)
{
- return PackageComponentsAllInOne(allComponentInOne);
+ return PackageComponentsAllInOne();
}
// CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one)
// There will be 1 package for each component group
// however one may require to ignore component group and
// in this case you'll get 1 package for each component.
- else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup))
+ else
{
return PackageComponents(ignoreComponentGroup);
}
@@ -601,14 +573,7 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
cmSystemTools::UpperCase(componentName) + "_GROUP";
if (NULL != GetOption(groupVar.c_str()))
{
- if (allGroupInOne)
- {
- return std::string("ALL_GROUPS_IN_ONE");
- }
- else
- {
- return std::string(GetOption(groupVar.c_str()));
- }
+ return std::string(GetOption(groupVar.c_str()));
}
else
{