View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013898CMakeCPackpublic2013-02-07 19:152013-07-01 09:37
ReporterJonathan M Davis 
Assigned ToEric NOULARD 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSLinuxOS Version
Product VersionCMake 2.8.10.2 
Target VersionFixed in Version 
Summary0013898: cpack fails to use some CPACK_RPM_PACKAGE_* variables in the generated rpm spec if their value is less than 3 characters long
DescriptionIf you do set(CPACK_RPM_PACKAGE_AUTOREQPROV 0) or set(CPACK_RPM_PACKAGE_AUTOREQPROV no), when using the RPM generator for cpack, it has no effect on the RPM spec file which is generated. However, if you do set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") or set(CPACK_RPM_PACKAGE_AUTOREQPROV "no "), then it works.

Looking through CPackRPM.cmake, I suspect that it has to do with this section at line 480:

----------------
  if(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
    string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
    math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
    string(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL)
    string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
    string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
    set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
    if(CPACK_RPM_PACKAGE_DEBUG)
      message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
    endif()
    set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
  else()
    # Do not forget to unset previously set header (from previous component)
    unset(TMP_RPM_${_RPM_SPEC_HEADER})
  endif()
----------------

and I expect that it affects every variable which is looped over and hits that code:

----------------
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV)
----------------

but I've only tested it with CPACK_RPM_PACKAGE_AUTOREQPROV. I've also only tested it with a library target.
Steps To Reproduce1. Use set(CPACK_RPM_PACKAGE_AUTOREQPROV 0) or set(CPACK_RPM_PACKAGE_AUTOREQPROV no) as part of setting up cpack for generating RPMs in cmake.

2. Use make package to generate the RPM.

3. Run "rpm -qRp filename.rpm" on your rpm, and it will print out the list of stuff in the Required field of the RPM. It should have a very short list of items with no .so files included.

Instead, it lists all of the .so files that your program or library requires; stuff like

libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032219)
Eric NOULARD (developer)
2013-02-08 04:39

Hi Jonathan,

The problem is not where it seems to be.
the portion of code you quoted is not handling the "value" of
CPACK_RPM_PACKAGE_AUTOREQPROV but the name "AUTOREQPROV" itself
in order to produce:
"Autoreqprov" out of "AUTOREQPROV"
i.e. first letter upper-case and the tail being lower case.

Now the problem lies in this line
if(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)

when the value of "CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP"
namely "CPACK_RPM_PACKAGE_AUTOREQPROV" is either
0, NO, no, OFF then CMake 'if' command semantic says it is false!!
What we want in this case is

if (DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)

I'll prepare a patch for that.
(0032220)
Jonathan M Davis (reporter)
2013-02-08 04:48

Oh well, then I guessed wrong, but I'm not very good at reading cmake string manipulation. It's a good thing that you figured it out in either case. I _did_ think that I'd tried either 01 or 12 and it didn't work though (I forget which). I'd messed around with shortening either 1234567890 or 0123456789 until it stopped working, and it stopped working at 2 characters, and then no did the name thing - it worked when I added characters but not otherwise (though that part fits with your explanation), so I'd come to the conclusion that it was an issue with the number of characters. But I may not remember what I did correctly. Regardless, the important thing is that the valid arguments to AutoReqProv work (as well as the arguments for any other of the variables in that loop), and no and 0 don't currently work. Thanks for the quick response time in any case.
(0032244)
Eric NOULARD (developer)
2013-02-09 07:44

Merge topic 'CPackRPM-fixSomeRPMSpecificVarHandling' into next

9be3da1 CPackRPM fix 0013898 uses IF(DEFINED var) to avoid wrong var value logic
(0033418)
Robert Maynard (manager)
2013-07-01 09:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-02-07 19:15 Jonathan M Davis New Issue
2013-02-08 04:39 Eric NOULARD Note Added: 0032219
2013-02-08 04:39 Eric NOULARD Assigned To => Eric NOULARD
2013-02-08 04:39 Eric NOULARD Status new => assigned
2013-02-08 04:48 Jonathan M Davis Note Added: 0032220
2013-02-09 07:44 Eric NOULARD Note Added: 0032244
2013-02-09 07:44 Eric NOULARD Status assigned => resolved
2013-02-09 07:44 Eric NOULARD Resolution open => fixed
2013-07-01 09:37 Robert Maynard Note Added: 0033418
2013-07-01 09:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team