CPack/RPM: Append .rpm to CPACK_RPM_FILE_NAME if missing
Previously we issued an error when the `.rpm` suffix is missing. Instead, append the suffix automatically. This matches the behavior of `CPACK_ARCHIVE_FILE_NAME`, to which the archive format suffix is automatically appended. With this change, developers can simply do set(CPACK_RPM_comp_FILE_NAME "${CPACK_ARCHIVE_comp_FILE_NAME}")
This commit is contained in:
parent
f2a6d423da
commit
53991e62da
@ -89,8 +89,13 @@ List of CPack RPM generator specific variables:
|
|||||||
``RPM-DEFAULT``
|
``RPM-DEFAULT``
|
||||||
Tell ``rpmbuild`` to automatically generate the package file name.
|
Tell ``rpmbuild`` to automatically generate the package file name.
|
||||||
|
|
||||||
``<file-name>.rpm``
|
``<file-name>[.rpm]``
|
||||||
Use the given file name. The ``.rpm`` suffix is required.
|
Use the given file name.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.29
|
||||||
|
|
||||||
|
The ``.rpm`` suffix will be automatically added if missing.
|
||||||
|
Previously the suffix was required.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -4,3 +4,7 @@ cpack-auto-suffixes
|
|||||||
* The :cpack_gen:`CPack DEB Generator` :variable:`CPACK_DEBIAN_FILE_NAME`
|
* The :cpack_gen:`CPack DEB Generator` :variable:`CPACK_DEBIAN_FILE_NAME`
|
||||||
variable may now be set without any suffix, and the ``.deb`` suffix
|
variable may now be set without any suffix, and the ``.deb`` suffix
|
||||||
will be added automatically.
|
will be added automatically.
|
||||||
|
|
||||||
|
* The :cpack_gen:`CPack RPM Generator` :variable:`CPACK_RPM_FILE_NAME`
|
||||||
|
variable may now be set without any suffix, and the ``.rpm`` suffix
|
||||||
|
will be added automatically.
|
||||||
|
@ -1563,7 +1563,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
|
|||||||
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
|
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
|
||||||
if(CPACK_RPM_FILE_NAME)
|
if(CPACK_RPM_FILE_NAME)
|
||||||
if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
|
if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
|
||||||
message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
|
set(CPACK_RPM_FILE_NAME "${CPACK_RPM_FILE_NAME}.rpm")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# old file name format for back compatibility
|
# old file name format for back compatibility
|
||||||
|
@ -978,6 +978,7 @@ set(cpack_tests
|
|||||||
DEB.DEB_DESCRIPTION
|
DEB.DEB_DESCRIPTION
|
||||||
DEB.PROJECT_META
|
DEB.PROJECT_META
|
||||||
|
|
||||||
|
RPM.AUTO_SUFFIXES
|
||||||
RPM.CUSTOM_BINARY_SPEC_FILE
|
RPM.CUSTOM_BINARY_SPEC_FILE
|
||||||
RPM.CUSTOM_NAMES
|
RPM.CUSTOM_NAMES
|
||||||
RPM.DEBUGINFO
|
RPM.DEBUGINFO
|
||||||
|
@ -9,7 +9,7 @@ find_program(DEBUGEDIT debugedit)
|
|||||||
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
|
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
|
||||||
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT")
|
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT")
|
||||||
run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
|
run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
|
||||||
run_cpack_test(AUTO_SUFFIXES "DEB.AUTO_SUFFIXES" false "MONOLITHIC")
|
run_cpack_test(AUTO_SUFFIXES "RPM.AUTO_SUFFIXES;DEB.AUTO_SUFFIXES" false "MONOLITHIC")
|
||||||
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT")
|
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT")
|
||||||
if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
|
if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
|
||||||
run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT")
|
run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT")
|
||||||
|
@ -2,7 +2,7 @@ set(EXPECTED_FILES_COUNT "1")
|
|||||||
set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
|
set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
|
||||||
set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
|
set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
|
||||||
|
|
||||||
if(GENERATOR_TYPE STREQUAL "DEB")
|
if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
|
||||||
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
|
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
|
||||||
set(EXPECTED_FILE_1 "autosuffixpackage.${file_extension_}")
|
set(EXPECTED_FILE_1 "autosuffixpackage.${file_extension_}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
|
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
|
||||||
|
|
||||||
# if the filename doesn't have the expected deb suffix, test that it is appended automatically
|
# if the filename doesn't have the expected deb/rpm suffix, test that it is appended automatically
|
||||||
set(CPACK_DEBIAN_FILE_NAME "autosuffixpackage")
|
set(CPACK_DEBIAN_FILE_NAME "autosuffixpackage")
|
||||||
|
set(CPACK_RPM_FILE_NAME "autosuffixpackage")
|
||||||
|
Loading…
Reference in New Issue
Block a user