View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010294CMakeCPackpublic2010-02-15 20:272012-04-25 18:04
ReporterThawan Kooburat 
Assigned ToEric NOULARD 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0010294: Patch for CPack RPM generator (CPACK_RPM_SPEC_IGNORE_FILES)
DescriptionHi,

I created a patch that another control variable to CPackRPM
# CPACK_RPM_SPEC_IGNORE_FILES
# Mandatory : NO
# Default : -
# Can be used to specify a list of files to ignore when CPackRPM is
# generating a file list to fill %file section (@CPACK_RPM_INSTALL_FILES@)

Scenario:
Files in RPM package can be installed with various attributes. It may be owned by user other than "root" or specified as configuration file (%config)

Problem:
CPack RPM automatically add all files into ${CPACK_RPM_INSTALL_FILES} which is specified as normal file and owner by root.

Usage:
By specifying a list of ignore files in CPACK_RPM_SPEC_IGNORE_FILES, user can customize attribute of some files manually and the rest is automatically filled by CPackRPM. Without this modification, RPM will report warnings that there are duplicate entries in %file section if I try to write a spec file as below. (However, the result RPM works as intended)

Example usage:
[CMakeLists.txt]
set (CPACK_RPM_USER_BINARY_SPECFILE foo.spec.in )
set (CPACK_RPM_SPEC_IGNORE_FILES "/etc/foo.config" "/etc/init.d/foo")

[foo.spec.in]
...
%files
%defattr(-,root,root,-)
%config(noreplace) /etc/foo.config
%config(noreplace) /etc/init.d/foo

@CPACK_RPM_INSTALL_FILES@

TagsNo tags attached.
Attached Filespatch file icon CPackRPM.patch [^] (1,219 bytes) 2010-02-15 20:27 [Show Content]

 Relationships
related to 0012608closedEric NOULARD Unexpected %config file declaration. 
related to 0010701closedEric NOULARD Lack of "%doc, %config, Obsolete" in CPackRPM 

  Notes
(0019558)
Eric NOULARD (developer)
2010-02-20 11:44

Thank you thawan,

I self-assign this bug.
I'll review your patch ASAP.
(0020072)
Eric NOULARD (developer)
2010-04-04 16:21

Just looking into the patch.

I was thinking that may be it would be easier to directly specify
the appropriate line for the files like:

set (CPACK_RPM_SPEC_FILES_LINES "%config(noreplace);/etc/foo.config;%config(noreplace);/etc/init.d/foo")

Then we could extract from this "list of pair" the file name
in order to filter out the appropriate file and directly replace
it with appropriate prefix in the spec file without the need
to use a CPACK_RPM_USER_BINARY_SPECFILE.

Thus even a "generated" spec file may offer the control over the
appropriate right for any file.

Do you think it suits the needs?
(0020081)
Thawan Kooburat (reporter)
2010-04-06 16:51

Thank you for reviewing my patch. I agree that the solution you purposed can solve my issue and also allow the other user to use this functionality with the “generated” spec file.

The solution that I purposed allows me to easily port my old spec file into CPack and let CPackRPM fill-in the rest of the files that do not need special attention.

Below is an example spec files that I found from the internet. You can look at the %file section and see that it might be easier to let the user write the %file section manually because there are many ways to write it.

http://www.madboa.com/geek/specs/pine.spec [^]

In conclusion, I will be very appreciated if you could keep CPACK_RPM_SPEC_IGNORE_FILES even though you choose to add CPACK_RPM_SPEC_FILES_LINES because I guess that internally you have to create a list of files that needed to be filter-out anyway. Thus, allowing user to specify that list as well should not add much complexity.
(0020087)
Eric NOULARD (developer)
2010-04-07 02:25

OK I see.
I'll see what I can do, however my idea is to avoid to have
to specify the very same information (the list of file to filter out)
at two DIFFERENT places like
    a) in CPACK_RPM_SPEC_IGNORE_FILES
    b) in the USER binary spec file.

same info in different places sometimes leads to hard to track errors
because of non-voluntary inconsistencies between the different places.

Concerning the various to write a spec file you are damn right
there many different possibilities
(see http://www.rpm.org/max-rpm/ [^])
and I do not intend to support them all in the generated spec file.
Thus the CPACK_RPM_USER_BINARY_SPECFILE mechanism as a solution
to trap for "unsupported featuress".

The idea is:
   1) Generated spec file should ease at the maximum
      the creation of RPM with some flexibility

   2) Then go for CPACK_RPM_USER_BINARY_SPECFILE when
      maximum flexibility is needed.
(0020100)
Thawan Kooburat (reporter)
2010-04-07 20:57

Thanks for looking into this issue. I understand your concerns about the duplicate information.

CPACK_RPM_USER_BINARY_SPECFILE is very flexible. In my case, I can replace all dynamic variables with CPackRPM variables and everything works like a charm (Too bad that the documentation does not give enough examples on how to use this mechanism, so it took me a while to figure this out).

However, the list of files to fill in %file section is the main problem. Small projects might be able to use a static list or user wildcards if they don’t care much. Initially, I try to come up with a solution to prepare a list of binaries by myself dynamically without modifying CPackRPM but it was too hard. My point is that @CPACK_RPM_INSTALL_FILES@ is really important for me to use the user-specified spec file properly.

I think that both CPACK_RPM_SPEC_FILES_LINES and CPACK_RPM_SPEC_IGNORE_FILES can co-exist without causing much confusion. For example, the final list for files to filter-out is a union between lists of files from both variables. In this case, even if users incorrectly specify them in both locations, it does not affect the correctness of the final spec file (both user specified and generated one). However, you might need to have two variables from %file section in the generated spec file which may look like below

%file
%defattr(-,root,root,-)
@CPACK_RPM_SPEC_FILES_LINES@
@CPACK_RPM_INSTALL_FILES @

The benefit of this are:
1. Users might be able to use %attr for each SPEC_FILE_LINE pair to override the default owner and permission if he wanted to (Not sure about this but I think it should be possible).
2. Those who want to use their own spec file only need to use @ CPACK_RPM_INSTALL_FILES @ like the first example.

So CPACK_RPM_SPEC_IGNORE_FILES will give users direct control over the @ CPACK_RPM_INSTALL_FILES @. Otherwise they have to indirectly use CPACK_RPM_SPEC_FILES_LINES to filter-out the files which might not be clear to users when reading from the documentation.

PS. Sorry for long description : )
(0020101)
Eric NOULARD (developer)
2010-04-08 02:47

OK noted.
Concerning documentation there is currently two places:
 a) embedded doc in CPackRPM.cmake
    see cmake --help-module CPackRPM

 b) Wiki pages:
     http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 [^]

I would kindly accept documentation patch for a) too ;-)
and the Wiki may be improved by any registered user.
May be you can write a paragraph on your experience feedback concerning
CPACK_RPM_USER_BINARY_SPECFILE.

I'm not sure to be able to work on this before 2 weeks so be patient
and I'll come back to you.
(0021897)
Eric NOULARD (developer)
2010-08-23 13:08

Hi Thawan,

If you have time, have a look at lastest patches attached to
bug 7000: http://public.kitware.com/Bug/view.php?id=7000. [^]

It should pave the way to solve the current issue too.
Currently %config is added automatically to absolute installed files
but adding a filtering feature which add the extra (noreplace)
is now easier.

For example we can define

CPACK_RPM_NOREPLACE_FILES which give the list of files
which should be added noreplace.

We could even add a CPACK_RPM_INSTALLED_FILES_PREFIX
which should be a list of pair "filename;prefix" indicating
that "filename" must be prefixed by "prefix".
(0029281)
Eric NOULARD (developer)
2012-04-20 15:13

This bug has been fixed in a more general way wit 0012608 fix.

commit 121c29553fc66575f231bebda6682b21216c1e03
Author: Eric NOULARD <eric.noulard@gmail.com>
Date: Mon Dec 12 23:11:02 2011 +0100

CPackRPM fix 0012608 and unoticed related bug
    
    The User may now specify a list of file that shouldn't be
    automatically handled by CPack but specified by the user.
    Like %config(noreplace) or specific %attr.
    The concerned files/dir lines will be removed from the set
    automatically handled by CPack.

 Issue History
Date Modified Username Field Change
2010-02-15 20:27 Thawan Kooburat New Issue
2010-02-15 20:27 Thawan Kooburat File Added: CPackRPM.patch
2010-02-20 11:43 Eric NOULARD Status new => assigned
2010-02-20 11:43 Eric NOULARD Assigned To => Eric NOULARD
2010-02-20 11:44 Eric NOULARD Note Added: 0019558
2010-04-04 16:21 Eric NOULARD Note Added: 0020072
2010-04-06 16:51 Thawan Kooburat Note Added: 0020081
2010-04-07 02:25 Eric NOULARD Note Added: 0020087
2010-04-07 20:57 Thawan Kooburat Note Added: 0020100
2010-04-08 02:47 Eric NOULARD Note Added: 0020101
2010-05-11 04:16 Eric NOULARD Relationship added related to 0010701
2010-08-23 13:08 Eric NOULARD Note Added: 0021897
2012-04-20 15:11 Eric NOULARD Relationship added related to 0012608
2012-04-20 15:13 Eric NOULARD Note Added: 0029281
2012-04-20 15:13 Eric NOULARD Status assigned => closed
2012-04-20 15:13 Eric NOULARD Resolution open => fixed
2012-04-20 15:13 Eric NOULARD Fixed in Version => CMake 2.8.8
2012-04-25 18:04 David Cole Target Version => CMake 2.8.8


Copyright © 2000 - 2018 MantisBT Team