[cmake-developers] [CMake 0013898]: cpack fails to use some CPACK_RPM_PACKAGE_* variables in the generated rpm spec if their value is less than 3 characters long

Mantis Bug Tracker mantis at public.kitware.com
Thu Feb 7 19:15:22 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13898 
====================================================================== 
Reported By:                Jonathan M Davis
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13898
Category:                   CPack
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-02-07 19:15 EST
Last Modified:              2013-02-07 19:15 EST
====================================================================== 
Summary:                    cpack fails to use some CPACK_RPM_PACKAGE_*
variables in the generated rpm spec if their value is less than 3 characters
long
Description: 
If 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 Reproduce: 
1. 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)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-02-07 19:15 Jonathan M DavisNew Issue                                    
======================================================================




More information about the cmake-developers mailing list