diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-10-29 22:29:50 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-10-30 10:32:59 +0100 |
commit | c7902186129cae888c45a87150d33059528a7033 (patch) | |
tree | 847a55c21c0604d4798cc17105f02c4dd421bdd1 /cmake | |
parent | 5482d62760bcbdcf44f1340fb5846c3942419dc5 (diff) | |
download | mariadb-git-c7902186129cae888c45a87150d33059528a7033.tar.gz |
Fix RPM packaging on cmake 3.18+
cmake has caught up and since version 3.18 it started supporting
CPACK_RPM_POST_TRANS_SCRIPT_FILE, something we've supported for
two years and cmake 2.8.11. Both implementation add %posttrans tag
and rpmbuild gets confused.
Disable our implementation for cmake 3.18+
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Internal/CPack/CPackRPM.cmake | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/cmake/Internal/CPack/CPackRPM.cmake b/cmake/Internal/CPack/CPackRPM.cmake index 2729667e319..92bcc6c6c25 100644 --- a/cmake/Internal/CPack/CPackRPM.cmake +++ b/cmake/Internal/CPack/CPackRPM.cmake @@ -26,26 +26,28 @@ set_from_component(VENDOR) # the scriptlet, if present, is appended (together with the %posttrans tag) # to the pre-uninstall scriptlet # -set(base_time "PRE") -set(base_type "UNINSTALL") -set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE) -set(acc) +if(CMAKE_VERSION VERSION_LESS 3.18) + set(base_time "PRE") + set(base_type "UNINSTALL") + set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE) + set(acc) -macro(read_one_file time_ type_ tag_) - set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE) - if (${var}) - file(READ ${${var}} content) - set(acc "${tag_}\n${content}\n\n${acc}") - endif() -endmacro() + macro(read_one_file time_ type_ tag_) + set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE) + if (${var}) + file(READ ${${var}} content) + set(acc "${tag_}\n${content}\n\n${acc}") + endif() + endmacro() -read_one_file("POST" "TRANS" "%posttrans") -if (acc) - set(orig_${base_var} ${${base_var}}) - read_one_file(${base_time} ${base_type} "") - set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet) - file(WRITE ${${base_var}} "${acc}") -endif() + read_one_file("POST" "TRANS" "%posttrans") + if (acc) + set(orig_${base_var} ${${base_var}}) + read_one_file(${base_time} ${base_type} "") + set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet) + file(WRITE ${${base_var}} "${acc}") + endif() +endif(CMAKE_VERSION VERSION_LESS 3.18) # load the original CPackRPM.cmake set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) @@ -59,7 +61,9 @@ set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) restore(LICENSE) restore(VENDOR) -set(${base_var} ${orig_${base_var}}) +if(${orig_${base_var}}) + set(${base_var} ${orig_${base_var}}) +endif() # per-component cleanup foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) |