CPack fix kwstyle breakage and make CPackRPM backward compatible

backward compatible= No componentized RPM unless requested
using CPACK_RPM_COMP0NENT_INSTALL
This commit is contained in:
Eric NOULARD 2010-11-15 20:54:19 +01:00
parent 2c84d169b3
commit 66e86b4770
3 changed files with 28 additions and 8 deletions

View File

@ -741,7 +741,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
* - Because it was already used for component install * - Because it was already used for component install
* in order to put things in subdirs... * in order to put things in subdirs...
*/ */
cmSystemTools::PutEnv((std::string("DESTDIR=")+tempInstallDirectory).c_str()); cmSystemTools::PutEnv(
(std::string("DESTDIR=")+tempInstallDirectory).c_str()
);
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Creating directory: '" << dir << "'" << std::endl); "- Creating directory: '" << dir << "'" << std::endl);

View File

@ -44,7 +44,7 @@ int cmCPackRPMGenerator::PackageFiles()
<< toplevel << std::endl); << toplevel << std::endl);
/* Are we in the component packaging case */ /* Are we in the component packaging case */
if (!this->ComponentGroups.empty()) if (SupportsComponentInstallation() & (!this->ComponentGroups.empty()))
{ {
/* Reset package file name list it will be populated during the /* Reset package file name list it will be populated during the
* component packaging run*/ * component packaging run*/
@ -57,8 +57,12 @@ int cmCPackRPMGenerator::PackageFiles()
compIt!=this->Components.end(); ++compIt ) compIt!=this->Components.end(); ++compIt )
{ {
std::string localToplevel(initialTopLevel); std::string localToplevel(initialTopLevel);
std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel.c_str())); std::string packageFileName(
std::string outputFileName(std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) cmSystemTools::GetParentDirectory(toplevel.c_str())
);
std::string outputFileName(
std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")
)
+"-"+compIt->first + this->GetOutputExtension()); +"-"+compIt->first + this->GetOutputExtension());
localToplevel += "/"+ compIt->first; localToplevel += "/"+ compIt->first;
@ -68,12 +72,14 @@ int cmCPackRPMGenerator::PackageFiles()
/* replace proposed CPACK_OUTPUT_FILE_NAME */ /* replace proposed CPACK_OUTPUT_FILE_NAME */
this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str());
/* replace the TEMPORARY package file name */ /* replace the TEMPORARY package file name */
this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",packageFileName.c_str()); this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
packageFileName.c_str());
this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str()); this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str());
if (!this->ReadListFile("CPackRPM.cmake")) if (!this->ReadListFile("CPackRPM.cmake"))
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackRPM.cmake" << std::endl); cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackRPM.cmake" << std::endl);
retval = 0; retval = 0;
} }
@ -86,7 +92,8 @@ int cmCPackRPMGenerator::PackageFiles()
{ {
if (!this->ReadListFile("CPackRPM.cmake")) if (!this->ReadListFile("CPackRPM.cmake"))
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackRPM.cmake" << std::endl); cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackRPM.cmake" << std::endl);
retval = 0; retval = 0;
} }
} }
@ -99,4 +106,15 @@ int cmCPackRPMGenerator::PackageFiles()
return retval; return retval;
} }
bool cmCPackRPMGenerator::SupportsComponentInstallation() const
{
if (IsSet("CPACK_RPM_COMPONENT_INSTALL"))
{
return true;
}
else
{
return false;
}
}

View File

@ -39,7 +39,7 @@ protected:
virtual int InitializeInternal(); virtual int InitializeInternal();
virtual int PackageFiles(); virtual int PackageFiles();
virtual const char* GetOutputExtension() { return ".rpm"; } virtual const char* GetOutputExtension() { return ".rpm"; }
virtual bool SupportsComponentInstallation() const {return true;} virtual bool SupportsComponentInstallation() const;
}; };