Am Donnerstag, 13. November 2014, 11:19:26 schrieb Brad King:
> On 11/12/2014 06:08 PM, Domen Vrankar wrote:
> > Attached is the final patch.
> 
> Applied with minor tweaks, thanks:
> 
>  string: Tolerate SUBSTRING length exceeding end index
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=474bbb9d

This should be a good addition, no?

diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 56d9b66..66717ef 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -683,9 +683,7 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES 
OBSOLETES PREFIX CONFLIC
     # Transform NAME --> Name e.g. PROVIDES --> Provides
     # The Upper-case first letter and lowercase tail is the
     # appropriate value required in the final RPM spec file.
-    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(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _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}")

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to