This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b2b55d49dcd0474b12bdc175d1852301440935c5 (commit)
       via  c908ba3707fcf8cf43df0c5cd90f8ea6d98d7c29 (commit)
      from  d875307328b9b04481d9e3466449ef31493dfc41 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2b55d49dcd0474b12bdc175d1852301440935c5
commit b2b55d49dcd0474b12bdc175d1852301440935c5
Merge: d875307 c908ba3
Author:     Domen Vrankar <domen.vran...@gmail.com>
AuthorDate: Fri Jan 16 15:44:15 2015 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Fri Jan 16 15:44:15 2015 -0500

    Merge topic 'rpm_multi_prefix' into next
    
    c908ba37 multiple path relocation prefixes


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c908ba3707fcf8cf43df0c5cd90f8ea6d98d7c29
commit c908ba3707fcf8cf43df0c5cd90f8ea6d98d7c29
Author:     Domen Vrankar <domen.vran...@gmail.com>
AuthorDate: Wed Dec 31 01:43:59 2014 +0100
Commit:     Domen Vrankar <domen.vran...@gmail.com>
CommitDate: Wed Dec 31 01:43:59 2014 +0100

    multiple path relocation prefixes
    
    Allow multiple path relocation prefixes for a single rpm package.

diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index d2cb2ee..5328b8c 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -379,6 +379,39 @@
 #
 #  May be used to add more exclude path (directories or files) from the initial
 #  default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST.
+#
+# .. variable:: CPACK_PACKAGING_INSTALL_FULL_<dir>
+#
+#  * Mandatory : NO
+#  * Default   : -
+#
+#  May be used to specify more than one relocation path per relocatable RPM.
+#  Variables are not component based as they can be used to set a different
+#  path prefix for e.g. binary dir and documentation dir at the same time.
+#  Only prefixes that are required by a certain component are added to that
+#  component - component must contain at least one file/directory/symbolic link
+#  with CPACK_PACKAGING_INSTALL_FULL_<dir> prefix for a certain relocation path
+#  to be added. Package will not contain any relocation paths if there are no
+#  files/directories/symbolic links on any of the provided prefix locations.
+#  Packages that either do not contain any relocation paths or contain
+#  files/directories/symbolic links that are outside relocation paths print
+#  out an AUTHOR_WARNING that RPM will be partially relocatable.
+#  Variables can be set automatically by including GNUInstallDirs module and
+#  using corresponding CMAKE_INSTALL_* variables from the same module
+#  in install() command DESTINATION paths.
+#  For a list of <dir> values see :module:`GNUInstallDirs` module.
+#
+# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+#
+#  * Mandatory : NO
+#  * Default   : CPACK_PACKAGING_INSTALL_PREFIX
+#
+#  May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for
+#  relocatable RPM packages.
+#  If CPACK_PACKAGING_INSTALL_FULL_<dir> paths are used and
+#  CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX is set then
+#  CPACK_PACKAGING_INSTALL_PREFIX prefix path is replaced by
+#  CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX prefix path where found.
 
 #=============================================================================
 # Copyright 2007-2009 Kitware, Inc.
@@ -395,6 +428,83 @@
 
 # Author: Eric Noulard with the help of Alexander Neundorf.
 
+function(cpack_rpm_prepare_relocation_paths)
+  set(RPM_RELOCATION_PATH_VARS
+      CPACK_PACKAGING_INSTALL_FULL_BINDIR CPACK_PACKAGING_INSTALL_FULL_SBINDIR
+      CPACK_PACKAGING_INSTALL_FULL_LIBEXECDIR 
CPACK_PACKAGING_INSTALL_FULL_SYSCONFDIR
+      CPACK_PACKAGING_INSTALL_FULL_SHAREDSTATEDIR 
CPACK_PACKAGING_INSTALL_FULL_LOCALSTATEDIR
+      CPACK_PACKAGING_INSTALL_FULL_LIBDIR 
CPACK_PACKAGING_INSTALL_FULL_INCLUDEDIR
+      CPACK_PACKAGING_INSTALL_FULL_OLDINCLUDEDIR 
CPACK_PACKAGING_INSTALL_FULL_DATAROOTDIR
+      CPACK_PACKAGING_INSTALL_FULL_DATADIR CPACK_PACKAGING_INSTALL_FULL_INFODIR
+      CPACK_PACKAGING_INSTALL_FULL_LOCALEDIR 
CPACK_PACKAGING_INSTALL_FULL_MANDIR
+      CPACK_PACKAGING_INSTALL_FULL_DOCDIR)
+  file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" 
RPM_PACKAGE_PREFIX_PART)
+
+  if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX)
+    # remove possible trailing slash and convert backslashes to slashes
+    file(TO_CMAKE_PATH 
"${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX}" 
RPM_COMPONENT_PREFIX_)
+    string(LENGTH "${RPM_PACKAGE_PREFIX_PART}" RPM_PACKAGE_PREFIX_PART_LEN)
+    set(RPM_PACKAGE_PREFIXES "${RPM_COMPONENT_PREFIX_}")
+
+    foreach(RELOCATE_PATH_VAR ${RPM_RELOCATION_PATH_VARS})
+      if(${RELOCATE_PATH_VAR})
+        # check if path is a subpath of CPACK_PACKAGING_INSTALL_PREFIX
+        file(RELATIVE_PATH REL_PATH_ "${RPM_PACKAGE_PREFIX_PART}" 
"${${RELOCATE_PATH_VAR}}")
+        string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_)
+
+        if("${PREFIX_}" STREQUAL "..") # not a subpath - leave it as is
+          file(TO_CMAKE_PATH "${${RELOCATE_PATH_VAR}}" RELOCATE_PATH)
+          list(APPEND RPM_PACKAGE_PREFIXES "${RELOCATE_PATH}")
+        else() # a subpath - it should be replaced with component path
+          list(APPEND RPM_PACKAGE_PREFIXES 
"${RPM_COMPONENT_PREFIX_}/${REL_PATH_}")
+        endif()
+      endif()
+    endforeach()
+  else()
+    set(RPM_PACKAGE_PREFIXES "${RPM_PACKAGE_PREFIX_PART}")
+    foreach(RELOCATE_PATH_VAR ${RPM_RELOCATION_PATH_VARS})
+      if(${RELOCATE_PATH_VAR})
+        file(TO_CMAKE_PATH "${${RELOCATE_PATH_VAR}}" RELOCATE_PATH)
+        list(APPEND RPM_PACKAGE_PREFIXES "${RELOCATE_PATH}")
+      endif()
+    endforeach()
+  endif()
+
+  list(REMOVE_DUPLICATES RPM_PACKAGE_PREFIXES)
+
+  # remove all the paths that are not used
+  foreach(RELOCATION_PATH ${RPM_PACKAGE_PREFIXES})
+    if(EXISTS "${WDIR}/${RELOCATION_PATH}")
+      set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${RELOCATION_PATH}\n")
+      list(APPEND RPM_USED_PACKAGE_PREFIXES "${RELOCATION_PATH}")
+    endif()
+  endforeach()
+
+  # warn about all the paths that are not relocatable
+  file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
+  foreach(TMP_PATH ${FILE_PATHS_})
+    string(LENGTH "${WDIR}" WDIR_LEN)
+    string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
+    unset(TMP_PATH_FOUND_)
+
+    foreach(RELOCATION_PATH ${RPM_USED_PACKAGE_PREFIXES})
+      file(RELATIVE_PATH REL_PATH_ "${RELOCATION_PATH}" "${TMP_PATH}")
+      string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_)
+
+      if(NOT "${PREFIX_}" STREQUAL "..")
+        set(TPM_PATH_FOUND_ TRUE)
+        break()
+      endif()
+    endforeach()
+
+    if(NOT TPM_PATH_FOUND_)
+      message(AUTHOR_WARNING "CPackRPM:Warning: Path ${TMP_PATH} is not on one 
of the relocatable paths! Package will be partially relocatable.")
+    endif()
+  endforeach()
+
+  set(TMP_RPM_PREFIXES ${TMP_RPM_PREFIXES} PARENT_SCOPE)
+endfunction()
+
 if(CMAKE_BINARY_DIR)
   message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.")
 endif()
@@ -636,13 +746,16 @@ if(CPACK_PACKAGE_RELOCATABLE)
   set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
 endif()
 if(CPACK_RPM_PACKAGE_RELOCATABLE)
+  unset(TMP_RPM_PREFIXES)
+
   if(CPACK_RPM_PACKAGE_DEBUG)
     message("CPackRPM:Debug: Trying to build a relocatable package")
   endif()
   if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
     message("CPackRPM:Warning: CPACK_SET_DESTDIR is set 
(=${CPACK_SET_DESTDIR}) while requesting a relocatable package 
(CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package 
won't be relocatable.")
   else()
-    set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX})
+    set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for 
back compatibility (provided external RPM spec files)
+    cpack_rpm_prepare_relocation_paths()
   endif()
 endif()
 
@@ -856,15 +969,21 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE)
   # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove
   # the final element (so the install-prefix dir itself is not omitted
   # from the RPM's content-list)
-  string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS 
".${CPACK_RPM_PACKAGE_PREFIX}")
-  list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
-  # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
-  foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
-    list(APPEND _TMP_LIST "${_ELEM}")
-    string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
-    set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
-    separate_arguments(_OMIT_DIR)
-    list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+  foreach(CPACK_RPM_PACKAGE_PREFIX ${RPM_PACKAGE_PREFIXES})
+    string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS 
".${CPACK_RPM_PACKAGE_PREFIX}")
+    list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+    unset(_TMP_LIST)
+    # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
+    foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
+      list(APPEND _TMP_LIST "${_ELEM}")
+      string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
+      list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND)
+      if(_DUPLICATE_FOUND EQUAL -1)
+        set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
+        separate_arguments(_OMIT_DIR)
+        list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+      endif()
+    endforeach()
   endforeach()
 endif()
 
@@ -1101,7 +1220,7 @@ Vendor:         \@CPACK_RPM_PACKAGE_VENDOR\@
 \@TMP_RPM_AUTOREQ\@
 \@TMP_RPM_AUTOREQPROV\@
 \@TMP_RPM_BUILDARCH\@
-\@TMP_RPM_PREFIX\@
+\@TMP_RPM_PREFIXES\@
 
 %define _rpmdir \@CPACK_RPM_DIRECTORY\@
 %define _rpmfilename \@CPACK_RPM_FILE_NAME\@
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index c61e7e9..37c781b 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -14,6 +14,9 @@
 #   destination for files of a given type
 # ``CMAKE_INSTALL_FULL_<dir>``
 #   corresponding absolute path
+# ``CPACK_PACKAGING_INSTALL_FULL_<dir>``
+#   CMAKE_INSTALL_<dir> prepended (if path is relateive) by
+#   CPACK_PACKAGING_INSTALL_PREFIX for use in CPack (relocatable RPM)
 #
 # where <dir> is one of:
 #
@@ -276,7 +279,9 @@ foreach(dir
     )
   if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
     set(CMAKE_INSTALL_FULL_${dir} 
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+    set(CPACK_PACKAGING_INSTALL_FULL_${dir} 
"${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
   else()
     set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+    set(CPACK_PACKAGING_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
   endif()
 endforeach()
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in 
b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
index 8c01b32..6d6b619 100644
--- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
+++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in
@@ -6,15 +6,19 @@ if(CPACK_GENERATOR MATCHES "ZIP")
 endif()
 
 if(CPACK_GENERATOR MATCHES "RPM")
-   set(CPACK_RPM_COMPONENT_INSTALL "ON")
-   set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
+  # set gnu install prefixes
+  set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+  include(GNUInstallDirs)
 
-   # test package summary override
-   set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
-   set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary")
+  set(CPACK_RPM_COMPONENT_INSTALL "ON")
+  set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries")
 
-   # test package description override
-   set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description")
+  # test package summary override
+  set(CPACK_RPM_PACKAGE_SUMMARY "default summary")
+  set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary")
+
+  # test package description override
+  set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description")
 endif()
 
 if(CPACK_GENERATOR MATCHES "DEB")
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake 
b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index 4d56218..d856c44 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -140,6 +140,10 @@ if(CPackGen MATCHES "RPM")
     "C/C\\+\\+ header files for use with MyLib")
 
   if(${CPackComponentWay} STREQUAL "IgnoreGroup")
+    # set gnu install prefixes to what they are set during rpm creation
+    set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+    include(GNUInstallDirs)
+
     foreach(check_file ${expected_file})
       string(REGEX MATCH ".*libraries.*" check_file_libraries_match 
${check_file})
       string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file})
@@ -154,15 +158,19 @@ if(CPackGen MATCHES "RPM")
       if(check_file_libraries_match)
         set(check_file_match_expected_summary 
".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*")
         set(check_file_match_expected_description 
".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*")
+        set(check_file_match_expected_relocation_path "Relocations : 
${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_FULL_LIBDIR}")
       elseif(check_file_headers_match)
         set(check_file_match_expected_summary 
".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
         set(check_file_match_expected_description 
".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*")
+        set(check_file_match_expected_relocation_path "Relocations : 
${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_FULL_INCLUDEDIR}")
       elseif(check_file_applications_match)
         set(check_file_match_expected_summary 
".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
         set(check_file_match_expected_description 
".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*")
+        set(check_file_match_expected_relocation_path "Relocations : 
${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_FULL_BINDIR}")
       elseif(check_file_Unspecified_match)
         set(check_file_match_expected_summary 
".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
         set(check_file_match_expected_description ".*DESCRIPTION.*")
+        set(check_file_match_expected_relocation_path "Relocations : 
${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_FULL_BINDIR}")
       else()
         message(FATAL_ERROR "error: unexpected rpm package '${check_file}'")
       endif()
@@ -170,13 +178,19 @@ if(CPackGen MATCHES "RPM")
       string(REGEX MATCH ${check_file_match_expected_summary} 
check_file_match_summary ${check_file_content})
 
       if(NOT check_file_match_summary)
-          message(FATAL_ERROR "error: '${check_file}' rpm package summary does 
not match expected value - regex '${check_file_match_expected_summary}'")
+        message(FATAL_ERROR "error: '${check_file}' rpm package summary does 
not match expected value - regex '${check_file_match_expected_summary}'")
       endif()
 
       string(REGEX MATCH ${check_file_match_expected_description} 
check_file_match_description ${check_file_content})
 
       if(NOT check_file_match_description)
-          message(FATAL_ERROR "error: '${check_file}' rpm package description 
does not match expected value - regex 
'${check_file_match_expected_description}'")
+        message(FATAL_ERROR "error: '${check_file}' rpm package description 
does not match expected value - regex 
'${check_file_match_expected_description}'")
+      endif()
+
+      string(REGEX MATCH ${check_file_match_expected_relocation_path} 
check_file_match_relocation_path ${check_file_content})
+
+      if(NOT check_file_match_relocation_path)
+        message(FATAL_ERROR "error: '${check_file}' rpm package relocation 
path does not match expected value - regex 
'${check_file_match_expected_relocation_path}'")
       endif()
     endforeach()
   elseif(${CPackComponentWay} STREQUAL "IgnoreGroup")

-----------------------------------------------------------------------

Summary of changes:
 Modules/CPackRPM.cmake                             |  141 ++++++++++++++++++--
 Modules/GNUInstallDirs.cmake                       |    5 +
 .../MyLibCPackConfig-IgnoreGroup.cmake.in          |   18 ++-
 .../RunCPackVerifyResult.cmake                     |   18 ++-
 4 files changed, 162 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to