diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-03-28 22:51:18 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-03-28 22:51:18 (GMT) |
commit | 1fe004eac3c5b905cb620580c3258ca3bd455c18 (patch) | |
tree | 4a06fcf562e5dc11cb4fb0f004e99984afdfd996 /Tests/CPackComponentsForAll | |
parent | d29004756fa314119a91821a14eef81a2ffcf40a (diff) | |
download | CMake-1fe004eac3c5b905cb620580c3258ca3bd455c18.zip CMake-1fe004eac3c5b905cb620580c3258ca3bd455c18.tar.gz CMake-1fe004eac3c5b905cb620580c3258ca3bd455c18.tar.bz2 |
cpack rpm setting of defattr
RPM supports setting of default user, group,
file and directory permissions that will be
applied for files in package unless specified
per file/dir with attr setting
This is related to bug report 14714
Diffstat (limited to 'Tests/CPackComponentsForAll')
-rw-r--r-- | Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in | 14 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 24 |
2 files changed, 38 insertions, 0 deletions
diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 0f2b774..0ffe44d 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -32,6 +32,20 @@ if(CPACK_GENERATOR MATCHES "RPM") # test package do not use CPACK_PACKAGING_INSTALL_PREFIX # as relocation path set(CPACK_RPM_NO_LIBRARIES_INSTALL_PREFIX_RELOCATION true) + + # test default permissions + set(CPACK_RPM_DEFAULT_USER defusr) + set(CPACK_RPM_DEFAULT_GROUP defgrp) + set(CPACK_RPM_DEFAULT_FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ) + set(CPACK_RPM_DEFAULT_DIR_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ) + set(CPACK_RPM_LIBRARIES_DEFAULT_USER user) + set(CPACK_RPM_APPLICATIONS_DEFAULT_GROUP group) + set(CPACK_RPM_LIBRARIES_DEFAULT_FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE) + set(CPACK_RPM_APPLICATIONS_DEFAULT_DIR_PERMISSIONS + OWNER_READ GROUP_READ WORLD_READ) endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 34b9c82..0c5cca8 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -304,6 +304,30 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() + + # validate permissions user and group + execute_process(COMMAND ${RPM_EXECUTABLE} -pqlv ${check_file} + OUTPUT_VARIABLE check_file_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(check_file_libraries_match) + set(check_file_match_expected_permissions ".*-rwx------.*user.*defgrp.*") + elseif(check_file_headers_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*") + elseif(check_file_applications_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*group.*") + elseif(check_file_Unspecified_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*") + else() + message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") + endif() + + string(REGEX MATCH "${check_file_match_expected_permissions}" check_file_match_permissions "${check_file_content}") + + if(NOT check_file_match_permissions) + message(FATAL_ERROR "error: '${check_file}' rpm package permissions do not match expected value - regex '${check_file_match_expected_permissions}'") + endif() endforeach() ####################### |