Merge topic 'cpack-auto-suffixes'
53991e62da
CPack/RPM: Append .rpm to CPACK_RPM_FILE_NAME if missingf2a6d423da
CPack/DEB: Append .deb to CPACK_DEBIAN_FILE_NAME if missing907d4db558
Help: Format allowed CPACK_{DEB,RPM}_FILE_NAME values as definition list Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8880
This commit is contained in:
commit
c40e242be3
@ -69,28 +69,32 @@ List of CPack DEB generator specific variables:
|
||||
:Mandatory: Yes
|
||||
:Default: ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb``
|
||||
|
||||
This may be set to ``DEB-DEFAULT`` to allow the CPack DEB generator to generate
|
||||
package file name by itself in deb format::
|
||||
This may be set to:
|
||||
|
||||
<PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
|
||||
``DEB-DEFAULT``
|
||||
Tell CPack to automatically generate the package file name in deb format::
|
||||
|
||||
Alternatively provided package file name must end
|
||||
with either ``.deb`` or ``.ipk`` suffix.
|
||||
<PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
|
||||
|
||||
.. versionadded:: 3.10
|
||||
``.ipk`` suffix used by OPKG packaging system.
|
||||
This setting recommended as the preferred behavior, but for backward
|
||||
compatibility with the CPack DEB generator in CMake prior to version 3.6,
|
||||
this is not the default. Without this, duplicate names may occur.
|
||||
Duplicate files get overwritten and it is up to the packager to set
|
||||
the variables in a manner that will prevent such errors.
|
||||
|
||||
.. note::
|
||||
``<file-name>[.deb]``
|
||||
Use the given file name.
|
||||
|
||||
Preferred setting of this variable is ``DEB-DEFAULT`` but for backward
|
||||
compatibility with the CPack DEB generator in CMake prior to version 3.6 this
|
||||
feature is disabled by default.
|
||||
.. versionchanged:: 3.29
|
||||
|
||||
.. note::
|
||||
The ``.deb`` suffix will be automatically added if the file name does
|
||||
not end in ``.deb`` or ``.ipk``. Previously the suffix was required.
|
||||
|
||||
By using non default filenames duplicate names may occur. Duplicate files
|
||||
get overwritten and it is up to the packager to set the variables in a
|
||||
manner that will prevent such errors.
|
||||
``<file-name>.ipk``
|
||||
.. versionadded:: 3.10
|
||||
|
||||
Use the given file name.
|
||||
The ``.ipk`` suffix is used by the OPKG packaging system.
|
||||
|
||||
.. variable:: CPACK_DEBIAN_PACKAGE_EPOCH
|
||||
|
||||
|
@ -84,9 +84,18 @@ List of CPack RPM generator specific variables:
|
||||
:Default: ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces
|
||||
replaced by '-'
|
||||
|
||||
This may be set to ``RPM-DEFAULT`` to allow ``rpmbuild`` tool to generate package
|
||||
file name by itself.
|
||||
Alternatively provided package file name must end with ``.rpm`` suffix.
|
||||
This may be set to:
|
||||
|
||||
``RPM-DEFAULT``
|
||||
Tell ``rpmbuild`` to automatically generate the package file name.
|
||||
|
||||
``<file-name>[.rpm]``
|
||||
Use the given file name.
|
||||
|
||||
.. versionchanged:: 3.29
|
||||
|
||||
The ``.rpm`` suffix will be automatically added if missing.
|
||||
Previously the suffix was required.
|
||||
|
||||
.. note::
|
||||
|
||||
|
10
Help/release/dev/cpack-auto-suffixes.rst
Normal file
10
Help/release/dev/cpack-auto-suffixes.rst
Normal file
@ -0,0 +1,10 @@
|
||||
cpack-auto-suffixes
|
||||
-------------------
|
||||
|
||||
* The :cpack_gen:`CPack DEB Generator` :variable:`CPACK_DEBIAN_FILE_NAME`
|
||||
variable may now be set without any suffix, and the ``.deb`` suffix
|
||||
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.
|
@ -710,7 +710,7 @@ function(cpack_deb_prepare_package_vars)
|
||||
"${CPACK_DEBIAN_PACKAGE_NAME}-dbgsym_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.ddeb")
|
||||
else()
|
||||
if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
|
||||
message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
|
||||
set(CPACK_DEBIAN_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}.deb")
|
||||
endif()
|
||||
|
||||
set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
|
||||
|
@ -1563,7 +1563,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
|
||||
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
|
||||
if(CPACK_RPM_FILE_NAME)
|
||||
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()
|
||||
else()
|
||||
# old file name format for back compatibility
|
||||
|
@ -973,6 +973,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
endif()
|
||||
|
||||
set(cpack_tests
|
||||
DEB.AUTO_SUFFIXES
|
||||
DEB.CUSTOM_NAMES
|
||||
DEB.DEBUGINFO
|
||||
DEB.DEFAULT_PERMISSIONS
|
||||
@ -991,6 +992,7 @@ set(cpack_tests
|
||||
DEB.DEB_DESCRIPTION
|
||||
DEB.PROJECT_META
|
||||
|
||||
RPM.AUTO_SUFFIXES
|
||||
RPM.CUSTOM_BINARY_SPEC_FILE
|
||||
RPM.CUSTOM_NAMES
|
||||
RPM.DEBUGINFO
|
||||
|
@ -9,6 +9,7 @@ find_program(DEBUGEDIT debugedit)
|
||||
# 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_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
|
||||
run_cpack_test(AUTO_SUFFIXES "RPM.AUTO_SUFFIXES;DEB.AUTO_SUFFIXES" false "MONOLITHIC")
|
||||
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT")
|
||||
if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
|
||||
run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT")
|
||||
|
@ -0,0 +1,8 @@
|
||||
set(EXPECTED_FILES_COUNT "1")
|
||||
set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
|
||||
set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
|
||||
|
||||
if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
|
||||
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
|
||||
set(EXPECTED_FILE_1 "autosuffixpackage.${file_extension_}")
|
||||
endif()
|
5
Tests/RunCMake/CPack/tests/AUTO_SUFFIXES/test.cmake
Normal file
5
Tests/RunCMake/CPack/tests/AUTO_SUFFIXES/test.cmake
Normal file
@ -0,0 +1,5 @@
|
||||
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
|
||||
|
||||
# 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_RPM_FILE_NAME "autosuffixpackage")
|
Loading…
Reference in New Issue
Block a user