MantisBT - CMake
View Issue Details
0011656CMakeCPackpublic2011-01-05 02:522016-06-10 14:31
Domen Vrankar 
CMake 2.8.4 
0011656: CPackRPM: Support dependency between RPM component
As of CPack 2.8.4 the RPM component support is very basic,
no dependency between components are handled.

We should support this.
see [^] [^]
No tags attached.
related to 0009900closed Eric NOULARD Make CPack generic generator delegate the name of the file to specific generator 
child of 0007645closed Eric NOULARD Add support of CPack Component to CPack RPM generator 
patch cpack_rpm.patch (3,278) 2011-10-11 10:05
diff cpack.diff (2,239) 2014-03-31 05:51
diff CPackRPM.cmake.diff (4,714) 2014-08-26 07:46
Issue History
2011-01-05 02:52Eric NOULARDNew Issue
2011-01-05 02:52Eric NOULARDStatusnew => assigned
2011-01-05 02:52Eric NOULARDAssigned To => Eric NOULARD
2011-01-05 02:53Eric NOULARDRelationship addedchild of 0007645
2011-01-05 02:54Eric NOULARDRelationship addedrelated to 0009900
2011-02-24 11:26Eric NOULARDOS => Linux
2011-02-24 11:26Eric NOULARDTarget Version => CMake 2.8.5
2011-05-26 10:50David ColeNote Added: 0026619
2011-05-26 10:50David ColeTarget VersionCMake 2.8.5 =>
2011-10-11 10:05Daniel MorlockNote Added: 0027563
2011-10-11 10:05Daniel MorlockFile Added: cpack_rpm.patch
2011-10-30 15:19Eric NOULARDNote Added: 0027673
2012-08-14 14:33Eric NOULARDNote Added: 0030653
2012-08-14 14:33Eric NOULARDAssigned ToEric NOULARD =>
2012-08-14 14:33Eric NOULARDStatusassigned => backlog
2014-03-31 05:50Barthelemy von HallerNote Added: 0035563
2014-03-31 05:51Barthelemy von HallerFile Added: cpack.diff
2014-04-01 09:24Eric NOULARDNote Added: 0035597
2014-08-25 08:24Barthelemy von HallerNote Added: 0036673
2014-08-25 09:07Barthelemy von HallerNote Added: 0036675
2014-08-26 07:45Barthelemy von HallerNote Added: 0036678
2014-08-26 07:46Barthelemy von HallerFile Added: CPackRPM.cmake.diff
2014-12-05 10:35Eric NOULARDAssigned To => Domen Vrankar
2014-12-05 10:35Eric NOULARDStatusbacklog => assigned
2014-12-05 10:36Eric NOULARDNote Added: 0037396
2015-01-05 07:03Domen VrankarNote Added: 0037555
2016-06-10 14:28Kitware RobotNote Added: 0041772
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

David Cole   
2011-05-26 10:50   
Not for 2.8.5 - postponing until a future release
Daniel Morlock   
2011-10-11 10:05   
Attached a patch for CPackRPM.cmake in 2.8.6 to define different RPM spec headers for different components e.g. CPACK_RPM_mycomponent_PACKAGE_PROVIDES, CPACK_RPM_mycomponent_PACKAGE_REQUIRES
2011-10-30 15:19   
Just merged a modified version of the provided patch to next.
Thank you very much for that.
With that addition the dependency between components is not [yet] automatic
but at least it can be specified by hand.

Merge topic 'CPackRPM-perComponentHeader' into next

e20c59a CPackRPM support component specific variables for spec files.
2012-08-14 14:33   
Unfortunately I have not the time to work on this now.
Barthelemy von Haller   
2014-03-31 05:50   
I attach a patch for CPackRPM.cmake (2.8.12) that creates the inter-component dependencies. It needs review and testing, I have just tested it with my software and it worked.
2014-04-01 09:24   
Barthelemy could you provide a working example for you.

The patch looks OK but shouldn't work in all grouping case,
see: [^]

Moreover I think tha currently the definition of

is case sensitive, may be one should always use


Beware not to mix tab and space in you patch/source modification.
Use space only (no tab) please.
Barthelemy von Haller   
2014-08-25 08:24   

Sorry for the excessive delay in my reply. Next iteration will be faster.

For the grouping cases, I am not sure what is missing.
1. ALL_COMPONENTS_IN_ONE : CPACK_RPM_PACKAGE_COMPONENT is false, my code is ignored. My debug output should actually be within the if, I will change that.
2. IGNORE : it successfully process the dependencies considering that there is one package per component.
3. ONE_PER_GROUP : this case is not handled for RPMs. I see that if I declare groups and use this option I still get 1 rpm per component. Thus it is equivalent to IGNORE. If a day it is implement, then we should of course adapt the code.

For the casing of "CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_DEPENDS" I would not change it. First, it doesn't work anymore if I do so, possibly because it is at some point compared with CPACK_COMPONENTS_ALL. Second, if it is case sensitive there is no obvious reason to make it case insensitive (by putting it all uppercase). Users should be careful to have consistent components naming e.g. core != CORE != Core.

I will change the tabs into spaces, sorry about that.

I will shortly upload a new diff with the 2 changes mentioned above and a simple working example.

Best regards
Barthelemy von Haller   
2014-08-25 09:07   
Hi again,

I made a mistake. ONE_PER_GROUP option works and must be handled. I will do it.

Sorry for the confusion.

Maybe I will also understand the "upper case" thing soon :)

Barthelemy von Haller   
2014-08-26 07:45   
Please find attached a new diff. It contains changes to CPackRPM.cmake implementing dependencies between components.
It handles the different CPACK_COMPONENTS_GROUPING. The code is more complicated due to that.
I tested it for various cases such as group-less components, dependencies between components of the same group or multiple dependencies from one group to another.

The working example I use is unfortunately copyrighted by my company. I can send it to you Eric Noulard for test purpose but can't post it here. Would it be ok like this ?

Best regards,
2014-12-05 10:36   

Would you be kind enough to have a look at Barthelemy proposal?
Domen Vrankar   
2015-01-05 07:03   
Sorry for the late response...

I've looked the patch and tested it with the tests that come with CMake.
I haven't yet tested it allot but it doesn't work with the tests that come with CMake. Tests pass but only because generated RPM files are not semantically checked a whole lot (diffs of generated spec files are more revealing).

There are a few obvious problems:


This line unsets the value that is provided by the user and thus breaks back compatibility.

CMake file Tests/CPackComponentsForAll/ contains set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime") and even though this variable name is not documented it is present in tests and usable in the past so I would say that the back compatibility should be preserved.

All if(DEFINED *) and if(NOT DEFINED *) tests should be replaced by if set checks (just delete DEFINED) since even if a variable is defined it can still contain an empty string and such values should be ignored as well to prevent "Requires: , some_value" variable contents.

Even if I remove DEFINED values I still get "Requires: ," and "Requires: " values in spec files.

Could you also fix the above cases?
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.