diff options
-rw-r--r-- | Help/release/dev/cpack-rpm-default-user-and-group.rst | 9 | ||||
-rw-r--r-- | Modules/CPackRPM.cmake | 103 | ||||
-rw-r--r-- | Modules/Compiler/GHS-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GHS-CXX.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GHS.cmake | 8 | ||||
-rw-r--r-- | Modules/FindXCTest.cmake | 4 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 2 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 34 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.h | 3 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in | 14 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 24 | ||||
-rw-r--r-- | Tests/FindGTK2/gtkmm/CMakeLists.txt | 5 |
13 files changed, 207 insertions, 9 deletions
diff --git a/Help/release/dev/cpack-rpm-default-user-and-group.rst b/Help/release/dev/cpack-rpm-default-user-and-group.rst new file mode 100644 index 0000000..7667c7f --- /dev/null +++ b/Help/release/dev/cpack-rpm-default-user-and-group.rst @@ -0,0 +1,9 @@ +cpack-rpm-default-user-and-group +-------------------------------- + +* The "CPackRPM" module learned how to set default values for owning user/group + and file/directory permissions of package content. + See :variable:`CPACK_RPM_DEFAULT_USER`, :variable:`CPACK_RPM_DEFAULT_GROUP`, + :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`, + :variable:`CPACK_RPM_DEFAULT_DIR_PERMISSIONS` and their per component + counterparts. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 7ffec13..ae51dc1 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -531,6 +531,54 @@ # - /usr/share/doc/.*/man/man.* # - /usr/lib/.*/man/man.* # +# .. variable:: CPACK_RPM_DEFAULT_USER +# CPACK_RPM_<compName>_DEFAULT_USER +# +# default user ownership of RPM content +# +# * Mandatory : NO +# * Default : root +# +# Value should be user name and not UID. +# Note that <compName> must be in upper-case. +# +# .. variable:: CPACK_RPM_DEFAULT_GROUP +# CPACK_RPM_<compName>_DEFAULT_GROUP +# +# default group ownership of RPM content +# +# * Mandatory : NO +# * Default : root +# +# Value should be group name and not GID. +# Note that <compName> must be in upper-case. +# +# .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS +# CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS +# +# default permissions used for packaged files +# +# * Mandatory : NO +# * Default : - (system default) +# +# Accepted values are lists with PERMISSIONS. Valid permissions +# are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, +# GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE and WORLD_EXECUTE. +# Note that <compName> must be in upper-case. +# +# .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS +# CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS +# +# default permissions used for packaged directories +# +# * Mandatory : NO +# * Default : - (system default) +# +# Accepted values are lists with PERMISSIONS. Valid permissions +# are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, +# GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE and WORLD_EXECUTE. +# Note that <compName> must be in upper-case. +# # Packaging of Symbolic Links # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -581,6 +629,35 @@ # Author: Eric Noulard with the help of Alexander Neundorf. +function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR) + set(PERMISSIONS ${${PERMISSIONS_VAR}}) + list(LENGTH PERMISSIONS PERM_LEN_PRE) + list(REMOVE_DUPLICATES PERMISSIONS) + list(LENGTH PERMISSIONS PERM_LEN_POST) + + if(NOT ${PERM_LEN_PRE} EQUAL ${PERM_LEN_POST}) + message(FATAL_ERROR "${PERMISSIONS_VAR} contains duplicate values.") + endif() + + foreach(PERMISSION_TYPE "OWNER" "GROUP" "WORLD") + set(${PERMISSION_TYPE}_PERMISSIONS 0) + + foreach(PERMISSION ${PERMISSIONS}) + if("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_READ") + math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 4") + elseif("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_WRITE") + math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 2") + elseif("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_EXECUTE") + math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 1") + elseif(PERMISSION MATCHES "${PERMISSION_TYPE}.*") + message(FATAL_ERROR "${PERMISSIONS_VAR} contains invalid values.") + endif() + endforeach() + endforeach() + + set(${RETURN_VAR} "${OWNER_PERMISSIONS}${GROUP_PERMISSIONS}${WORLD_PERMISSIONS}" PARENT_SCOPE) +endfunction() + function(cpack_rpm_prepare_relocation_paths) # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX) @@ -1572,6 +1649,30 @@ function(cpack_rpm_generate_package) "${CPACK_RPM_PACKAGE_RELOCATABLE}" ) + # set default user and group + foreach(_PERM_TYPE "USER" "GROUP") + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}) + set(TMP_DEFAULT_${_PERM_TYPE} "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}}") + elseif(CPACK_RPM_DEFAULT_${_PERM_TYPE}) + set(TMP_DEFAULT_${_PERM_TYPE} "${CPACK_RPM_DEFAULT_${_PERM_TYPE}}") + else() + set(TMP_DEFAULT_${_PERM_TYPE} "root") + endif() + endforeach() + + # set default file and dir permissions + foreach(_PERM_TYPE "FILE" "DIR") + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS) + get_unix_permissions_octal_notation("CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS" "TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS") + set(_PERMISSIONS_VAR "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS") + elseif(CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS) + get_unix_permissions_octal_notation("CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS" "TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS") + set(_PERMISSIONS_VAR "CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS") + else() + set(TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS "-") + endif() + endforeach() + # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") @@ -1671,7 +1772,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT \@CPACK_RPM_SPEC_PREUNINSTALL\@ %files -%defattr(-,root,root,-) +%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) \@CPACK_RPM_INSTALL_FILES\@ \@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@ \@CPACK_RPM_USER_INSTALL_FILES\@ diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake index a58d9b0..50532ce 100644 --- a/Modules/Compiler/GHS-C.cmake +++ b/Modules/Compiler/GHS-C.cmake @@ -1,3 +1,5 @@ +include(Compiler/GHS) + set(CMAKE_C_VERBOSE_FLAG "-v") set(CMAKE_C_FLAGS_INIT "") @@ -12,8 +14,6 @@ set(CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT}") set(CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT "-ldebug ${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}") -set(CMAKE_EXECUTABLE_SUFFIX ".as") - if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) set (CMAKE_C_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT}" CACHE STRING "Kernel flags used by the compiler during debug builds.") diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake index 9e202d3..2cffa0d 100644 --- a/Modules/Compiler/GHS-CXX.cmake +++ b/Modules/Compiler/GHS-CXX.cmake @@ -1,3 +1,5 @@ +include(Compiler/GHS) + set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_FLAGS_INIT "") @@ -15,8 +17,6 @@ set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT "-ldebug ${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}") -set(CMAKE_EXECUTABLE_SUFFIX ".as") - if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) set (CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT}" diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake new file mode 100644 index 0000000..e6a867d --- /dev/null +++ b/Modules/Compiler/GHS.cmake @@ -0,0 +1,8 @@ +if(__COMPILER_GHS) + return() +endif() +set(__COMPILER_GHS 1) + +set(CMAKE_EXECUTABLE_SUFFIX ".as") +set(CMAKE_LIBRARY_PATH_TERMINATOR "\n") +set(CMAKE_LIBRARY_PATH_FLAG " -L") diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 3cd9c22..805a58c 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -140,6 +140,10 @@ function(xctest_add_bundle target testee) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)" XCODE_ATTRIBUTE_TEST_HOST "$<TARGET_FILE:${testee}>") + if(NOT XCODE_VERSION VERSION_LESS 7.3) + set_target_properties(${target} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:${testee}>/../PlugIns") + endif() else(XCODE) target_link_libraries(${target} PRIVATE -bundle_loader $<TARGET_FILE:${testee}>) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2377831..6235b66 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) -set(CMake_VERSION_PATCH 20160325) +set(CMake_VERSION_PATCH 20160329) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 7f3a077..f329e77 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -77,11 +77,13 @@ bool cmCTestRunTest::CheckOutput() if ( regIt->first.find(this->ProcessOutput.c_str()) ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + this->GetIndex() << ": " << "Test timeout changed to " << this->TestProperties->AlternateTimeout << std::endl); this->TestProcess->ResetStartTime(); this->TestProcess->ChangeTimeout( this->TestProperties->AlternateTimeout); + this->TestProperties->TimeoutRegularExpressions.clear(); break; } } diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index c5813ba..1f17f8f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -149,7 +149,7 @@ void cmGhsMultiTargetGenerator::Generate() this->WriteIncludes(config, language); if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { - this->WriteTargetLinkLibraries(); + this->WriteTargetLinkLibraries(config, language); } this->WriteCustomCommands(); @@ -365,7 +365,8 @@ void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config, } } -void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() +void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( + std::string const& config, std::string const& language) { // library directories cmTargetDependSet tds = @@ -393,6 +394,35 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" << std::endl; } + + if (!this->TargetGroup) + { + std::string linkLibraries; + std::string flags; + std::string linkFlags; + std::string frameworkPath; + std::string linkPath; + std::string createRule = + this->GeneratorTarget->GetCreateRuleVariable(language, config); + bool useWatcomQuote = + this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE"); + this->LocalGenerator->GetTargetFlags( + linkLibraries, flags, linkFlags, + frameworkPath, linkPath, + this->GeneratorTarget, useWatcomQuote); + linkFlags = cmSystemTools::TrimWhitespace(linkFlags); + + if (!linkPath.empty()) + { + linkPath = " " + linkPath.substr(0U, linkPath.size() - 1U); + *this->GetFolderBuildStreams() << linkPath; + } + + if (!linkFlags.empty()) + { + *this->GetFolderBuildStreams() << " " << linkFlags << std::endl; + } + } } void cmGhsMultiTargetGenerator::WriteCustomCommands() diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 327fdef..e85e412 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -81,7 +81,8 @@ private: std::string const &config); void WriteIncludes(const std::string &config, const std::string &language); - void WriteTargetLinkLibraries(); + void WriteTargetLinkLibraries(std::string const& config, + std::string const& language); void WriteCustomCommands(); void WriteCustomCommandsHelper(std::vector<cmCustomCommand> const &commandsSet, 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() ####################### diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt index 32aafe2..eb0b7aa 100644 --- a/Tests/FindGTK2/gtkmm/CMakeLists.txt +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -12,3 +12,8 @@ target_link_libraries(gtkmm-target GTK2::gtkmm) add_executable(gtkmm-all-libs WIN32 main.cpp helloworld.cpp helloworld.h) target_link_libraries(gtkmm-all-libs ${GTK2_LIBRARIES}) target_include_directories(gtkmm-all-libs PRIVATE ${GTK2_INCLUDE_DIRS}) + +# Linking via the library variables does not cause compile feature +# requirements to propagate. Do it manually for purposes of this test. +get_property(features TARGET GTK2::sigc++ PROPERTY INTERFACE_COMPILE_FEATURES) +set_property(TARGET gtkmm-all-libs PROPERTY COMPILE_FEATURES ${features}) |