Small update - TMP_RPM_* fields need to be reset for different components or 
they'll add up.

> Hi,
> while making excessive use of the RPM generator in CMake 2.8.5 I came across 
> a requirement
> it could not match out of the box: per-component spec headers.
> As it is it seems not to be possible to add to or replace spec-file headers 
> on a
> component basis. The Patch below will add this support to CPackRPM.cmake for 
> CMake 2.8.5.
> Headers may be defined by setting CPACK_RPM_COMPONENT_<name>_<header>.

-- [snip] --
diff -ru a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
--- a/Modules/CPackRPM.cmake    2011-05-25 17:39:24.000000000 +0200
+++ b/Modules/CPackRPM.cmake    2011-06-27 12:05:41.000000000 +0200
@@ -365,6 +365,7 @@

 # check if additional fields for RPM spec header are given
 FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX)
+  SET(TMP_RPM_${_RPM_SPEC_HEADER} "")
   IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
     STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
     MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
@@ -379,6 +380,28 @@
   ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
 ENDFOREACH(_RPM_SPEC_HEADER)

+# check if additional fields for RPM spec header are given *for this component*
+FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX)
+  IF(CPACK_RPM_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_${_RPM_SPEC_HEADER})
+    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} for 
${CPACK_RPM_PACKAGE_COMPONENT}:\n 
${CPACK_RPM_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_${_RPM_SPEC_HEADER}}")
+    ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+    IF(TMP_RPM_${_RPM_SPEC_HEADER})
+      SET(TMP_RPM_${_RPM_SPEC_HEADER} "${TMP_RPM_${_RPM_SPEC_HEADER}} 
${CPACK_RPM_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_${_RPM_SPEC_HEADER}}")
+    ELSE(TMP_RPM_${_RPM_SPEC_HEADER})
+      SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: 
${CPACK_RPM_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_${_RPM_SPEC_HEADER}}")
+    ENDIF(TMP_RPM_${_RPM_SPEC_HEADER})
+  ENDIF(CPACK_RPM_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT}_${_RPM_SPEC_HEADER})
+ENDFOREACH(_RPM_SPEC_HEADER)
+
+
+
 # CPACK_RPM_SPEC_INSTALL_POST
 # May be used to define a RPM post intallation script
 # for example setting it to "/bin/true" may prevent
-- [snip]--

Mit freundlichen Grüßen / Best Regards

René Köcher

Forschung & Entwicklung
________________________________

WINCOR NIXDORF Technology GmbH
Am Vogelherd 67

D - 98693 Ilmenau, Germany

Tel.:       +49 (0) 36 77 862-233
Fax:        +49 (0) 36 77 862-199
E-Mail:     rene.koec...@wincor-nixdorf.com
            www.wincor-nixdorf.com
________________________________


WINCOR NIXDORF Technology GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3523
Geschäftsführer: Eckard Heidloff, Jörn Förster
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE243233085

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht 
gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to