Skip to content

Commit

Permalink
MDEV-23230 wsrep files installed when built without WSREP (#2334)
Browse files Browse the repository at this point in the history
Prevent wsrep files from being installed if WITH_WSREP=OFF.

Reviewed by Daniel Black
Additionally excluded #include wsrep files and galera* files
along with galera/wsrep tests.

mysql-test/include/have_wsrep.inc remainds as its used by
a few isolated tests.

Co-authored-by: Chris Ross <cross2@cisco.com>
  • Loading branch information
grooverdan and cross-cisco committed Nov 28, 2022
1 parent bd694bb commit 7b44d0b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,10 @@ INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY COMPONENT Readme)
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)

IF(UNIX)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme)
IF(WITH_WSREP)
INSTALL_DOCUMENTATION(Docs/README-wsrep COMPONENT Readme)
ENDIF()
ENDIF()

INCLUDE(build_depends)
Expand Down
6 changes: 6 additions & 0 deletions cmake/install_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug

FUNCTION(INSTALL_MYSQL_TEST from to)
IF(INSTALL_MYSQLTESTDIR)
IF(NOT WITH_WSREP)
SET(EXCL_GALERA "(suite/(galera|wsrep|sys_vars/[rt]/(sysvars_)?wsrep).*|include/((w.*)?wsrep.*|.*galera.*)\\.inc|std_data/(galera|wsrep).*)")
ELSE()
SET(EXCL_GALERA "^DOES_NOT_EXIST$")
ENDIF()
INSTALL(
DIRECTORY ${from}
DESTINATION "${INSTALL_MYSQLTESTDIR}/${to}"
Expand All @@ -286,6 +291,7 @@ FUNCTION(INSTALL_MYSQL_TEST from to)
PATTERN "*.vcxproj.user" EXCLUDE
PATTERN "CTest*" EXCLUDE
PATTERN "*~" EXCLUDE
REGEX "${EXCL_GALERA}" EXCLUDE
)
ENDIF()
ENDFUNCTION()
5 changes: 4 additions & 1 deletion cmake/systemd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ MACRO(CHECK_SYSTEMD)
IF(HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF)
SET(HAVE_SYSTEMD TRUE)
SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery)
SET(SYSTEMD_SCRIPTS mariadb-service-convert)
IF(WITH_WSREP)
SET(SYSTEMD_SCRIPTS ${SYSTEMD_SCRIPTS} galera_new_cluster galera_recovery)
ENDIF()
IF(DEB)
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")
SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start")
Expand Down
11 changes: 10 additions & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ FOREACH(f ${HEADERS_GEN_CONFIGURE})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}
DESTINATION ${INSTALL_INCLUDEDIR}/server COMPONENT Development)
ENDFOREACH(f)
INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR}/server/mysql COMPONENT Development FILES_MATCHING PATTERN "*.h")
IF(NOT WITH_WSREP)
SET(EXCL_SERVICE_WSREP "service_wsrep.h")
SET(EXCL_WSREP "wsrep.h")
ENDIF()
INSTALL(DIRECTORY mysql/
DESTINATION ${INSTALL_INCLUDEDIR}/server/mysql COMPONENT Development
FILES_MATCHING PATTERN "*.h"
PATTERN "${EXCL_SERVICE_WSREP}" EXCLUDE
)

STRING(REPLACE "." "\\." EXCL_RE "${HEADERS};${HEADERS_GEN_CONFIGURE}")
STRING(REPLACE ";" "|" EXCL_RE "${EXCL_RE}")
Expand All @@ -85,6 +93,7 @@ MACRO(INSTALL_PRIVATE DIR)
FILES_MATCHING PATTERN "*.h"
PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE
PATTERN "${EXCL_WSREP}" EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
ENDMACRO()

Expand Down
12 changes: 7 additions & 5 deletions man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA

SET(MAN1_WSREP wsrep_sst_rsync.1 wsrep_sst_common.1 wsrep_sst_mariabackup.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync_wan.1 galera_recovery.1 galera_new_cluster.1)
SET(MAN1_SERVER innochecksum.1 myisam_ftdump.1 myisamchk.1
aria_chk.1 aria_dump_log.1 aria_ftdump.1 aria_pack.1 aria_read_log.1
aria_s3_copy.1
Expand All @@ -24,12 +26,12 @@ SET(MAN1_SERVER innochecksum.1 myisam_ftdump.1 myisamchk.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
perror.1 replace.1 resolve_stack_dump.1
resolveip.1 mariadb-service-convert.1
mysqld_safe_helper.1 wsrep_sst_common.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
galera_recovery.1 galera_new_cluster.1
mysqld_safe_helper.1
mysql_ldb.1 myrocks_hotbackup.1
wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1
wsrep_sst_rsync_wan.1)
mbstream.1 mariabackup.1)
IF(WITH_WSREP)
SET(MAN1_SERVER ${MAN1_SERVER} ${MAN1_WSREP})
ENDIF()
SET(MAN8_SERVER mysqld.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
Expand Down
4 changes: 4 additions & 0 deletions sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ IF(WIN32)
TARGET_LINK_LIBRARIES(mariadb-upgrade-service mysys winservice)
ENDIF(WIN32)

IF(NOT WITH_WSREP)
SET(EXCL_WSREP "wsrep*.h")
ENDIF()
INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/server/private COMPONENT Development
FILES_MATCHING PATTERN "*.h"
PATTERN share EXCLUDE
PATTERN "${EXCL_WSREP}" EXCLUDE
PATTERN CMakeFiles EXCLUDE)
12 changes: 10 additions & 2 deletions support-files/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ ENDIF()

IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure wsrep_notify)
SET(SCRIPTS mysqld_multi.server mysql-log-rotate binary-configure)
IF(WITH_WSREP)
SET(SCRIPTS ${SCRIPTS} wsrep_notify)
ENDIF()
FOREACH(script ${SCRIPTS})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${script}
Expand Down Expand Up @@ -126,7 +130,11 @@ IF(UNIX)
COMMAND ${CMAKE_COMMAND} -E create_symlink ./mariadb.service mysqld.service
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

INSTALL(FILES use_galera_new_cluster.conf
IF(WITH_WSREP)
INSTALL(FILES use_galera_new_cluster.conf
DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
${CMAKE_CURRENT_BINARY_DIR}/mysql.service
${CMAKE_CURRENT_BINARY_DIR}/mysqld.service
Expand Down

0 comments on commit 7b44d0b

Please sign in to comment.