CPack/RPM: support for debuginfo package renaming

This commit is contained in:
Domen Vrankar
2017-03-24 22:41:02 +01:00
parent 6c09c5d64c
commit f237f5f851
4 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
cpack-rpm-debuginfo-honor-package-filename
------------------------------------------
* The :module:`CPackRPM` module learned to modify debuginfo package name.
See :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable.

View File

@@ -825,6 +825,30 @@
# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
#
# .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME
# CPACK_RPM_<component>_DEBUGINFO_FILE_NAME
#
# Debuginfo package file name.
#
# * Mandatory : NO
# * Default : rpmbuild tool generated package file name
#
# Alternatively provided debuginfo package file name must end with ``.rpm``
# suffix and should differ from file names of other generated packages.
#
# Variable may contain ``@cpack_component@`` placeholder which will be
# replaced by component name if component packaging is enabled otherwise it
# deletes the placeholder.
#
# Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set
# filename generation to default.
#
# .. note::
#
# :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package
# file name - disabled by default but can be enabled by setting the variable to
# ``RPM-DEFAULT``.
#
# Packaging of sources (SRPM)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
@@ -2653,6 +2677,22 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
list(APPEND filenames_ "${CPACK_RPM_FILE_NAME}")
endif()
if(CPACK_RPM_DEBUGINFO_PACKAGE)
cpack_rpm_variable_fallback("CPACK_RPM_DEBUGINFO_FILE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_FILE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_FILE_NAME"
"CPACK_RPM_DEBUGINFO_FILE_NAME")
if(CPACK_RPM_DEBUGINFO_FILE_NAME AND
NOT CPACK_RPM_DEBUGINFO_FILE_NAME STREQUAL "RPM-DEFAULT")
list(APPEND expected_filenames_
"${CPACK_RPM_PACKAGE_NAME}-debuginfo-${CPACK_PACKAGE_VERSION}.*\\.rpm")
string(REPLACE "@cpack_component@" "${CPACK_RPM_PACKAGE_COMPONENT}"
CPACK_RPM_DEBUGINFO_FILE_NAME "${CPACK_RPM_DEBUGINFO_FILE_NAME}")
list(APPEND filenames_ "${CPACK_RPM_DEBUGINFO_FILE_NAME}")
endif()
endif()
# check if other files have to be renamed
file(GLOB rename_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.rpm_name")
if(rename_files_)

View File

@@ -14,6 +14,5 @@ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so")
set(EXPECTED_FILE_4_NAME "Debuginfo")
set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo")
set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
set(EXPECTED_FILE_5_NAME "Debuginfo")
set(EXPECTED_FILE_5_COMPONENT "libs-debuginfo")
set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm")
set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*")

View File

@@ -32,4 +32,9 @@ set(CPACK_RPM_PACKAGE_NAME "Debuginfo")
set(CPACK_PACKAGE_FILE_NAME "TestDinfo-pkg")
set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON)
# test debuginfo package rename
set(CPACK_RPM_DEBUGINFO_FILE_NAME
"@cpack_component@-DebugInfoPackage.rpm")
set(CPACK_RPM_APPLICATIONS_DEBUGINFO_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src")