CPack/RPM ignore install prefix relocation path

Patch adds possibility to remove
CPACK_PACKAGING_INSTALL_PREFIX from
the list of relocation paths when
crating a relocatable rpm.
This commit is contained in:
Domen Vrankar 2015-03-20 21:52:49 +01:00
parent c95e523db8
commit 18917d66d4
3 changed files with 25 additions and 4 deletions

View File

@ -408,6 +408,16 @@
# #
# May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for # May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for
# relocatable RPM packages. # relocatable RPM packages.
#
# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION
# CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION
#
# * Mandatory : NO
# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
# are treated as one of relocation paths
#
# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
# from relocatable RPM prefix paths.
#============================================================================= #=============================================================================
# Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2009 Kitware, Inc.
@ -437,8 +447,15 @@ function(cpack_rpm_prepare_relocation_paths)
# set base path prefix # set base path prefix
if(EXISTS "${WDIR}/${PATH_PREFIX}") if(EXISTS "${WDIR}/${PATH_PREFIX}")
set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND
list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION)
set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n")
list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}")
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: removing '${PATH_PREFIX}' from relocation paths")
endif()
endif()
endif() endif()
# set other path prefixes # set other path prefixes

View File

@ -28,6 +28,10 @@ if(CPACK_GENERATOR MATCHES "RPM")
# test package description override - headers rpm is generated in the middle # test package description override - headers rpm is generated in the middle
set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description")
# test package do not use CPACK_PACKAGING_INSTALL_PREFIX
# as relocation path
set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true)
endif() endif()
if(CPACK_GENERATOR MATCHES "DEB") if(CPACK_GENERATOR MATCHES "DEB")

View File

@ -174,10 +174,10 @@ if(CPackGen MATCHES "RPM")
if(check_file_libraries_match) if(check_file_libraries_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*")
set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it
set(spec_regex "*libraries*") set(spec_regex "*libraries*")
set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$")
elseif(check_file_headers_match) elseif(check_file_headers_match)
set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*")
set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*")