Re: [Maria-developers] e35fb718eae: MDEV-17591 Create MariaDB named commands/symlinks
Hi, Rasmus! On Jun 13, Rasmus Johansson wrote:
revision-id: e35fb718eae (mariadb-10.4.5-44-ge35fb718eae) parent(s): 8e3a4be45c5 author: Rasmus Johansson <razze@iki.fi> committer: Rasmus Johansson <razze@iki.fi>
Is that an address you want to have in git history? You already have two, just making sure the third one is intentional.
timestamp: 2019-06-13 13:20:40 +0000 message:
MDEV-17591 Create MariaDB named commands/symlinks
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index f28720e97bc..e49f296ed75 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -111,8 +111,10 @@ FUNCTION(INSTALL_SCRIPT) ENDIF()
INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} ${COMP}) + string(REPLACE "${CMAKE_BINARY_DIR}/scripts/" "" dest ${script})
better not to assume that the script is in ${CMAKE_BINARY_DIR}/scripts/ I'd use get_filename_component() here. Like get_filename_component(dest "${scripts}" NAME)
+ CREATE_MARIADB_SYMLINK(${dest})
- INSTALL_MANPAGE(${script}) + INSTALL_MANPAGE(${dest}) ENDFUNCTION()
diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index d3a888f9a75..ad7320cd193 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -63,6 +63,9 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) UNSET(EXCLUDE_FROM_ALL) ENDIF() ADD_EXECUTABLE(${target} ${WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources}) + # create mariadb named symlink + CREATE_MARIADB_SYMLINK(${target}) + # tell CPack where to install IF(NOT ARG_EXCLUDE_FROM_ALL) IF(NOT ARG_DESTINATION) diff --git a/cmake/symlinks.cmake b/cmake/symlinks.cmake new file mode 100644 index 00000000000..0d0c637df5a --- /dev/null +++ b/cmake/symlinks.cmake @@ -0,0 +1,74 @@ +# MariaDB names for executables +list(APPEND MARIADB_SYMLINK_NAMES "mysql" "mariadb") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlaccess" "mariadb-access") +list(APPEND MARIADB_SYMLINK_NAMES "mysqladmin" "mariadb-admin") +list(APPEND MARIADB_SYMLINK_NAMES "mariabackup" "mariadb-backup") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlbinlog" "mariadb-binlog") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlcheck" "mariadb-check") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_client_test_embedded" "mariadb-client-test-embedded") +list(APPEND MARIADB_SYMLINK_NAMES "mariadb_config" "mariadb-config") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_convert_table_format" "mariadb-convert-table-format") +list(APPEND MARIADB_SYMLINK_NAMES "mysqldump" "mariadb-dump") +list(APPEND MARIADB_SYMLINK_NAMES "mysqldumpslow" "mariadb-dumpslow") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_embedded" "mariadb-embedded") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_find_rows" "mariadb-find-rows") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_fix_extensions" "mariadb-fix-extensions") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlhotcopy" "mariadb-hotcopy") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlimport" "mariadb-import") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_install_db" "mariadb-install-db") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_ldb" "mariadb-ldb") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_plugin" "mariadb-plugin") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_secure_installation" "mariadb-secure-installation") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_setpermission" "mariadb-setpermission") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlshow" "mariadb-show") +list(APPEND MARIADB_SYMLINK_NAMES "mysqlslap" "mariadb-slap") +list(APPEND MARIADB_SYMLINK_NAMES "mysqltest" "mariadb-test") +list(APPEND MARIADB_SYMLINK_NAMES "mysqltest_embedded" "mariadb-test-embedded") +list(APPEND MARIADB_SYMLINK_NAMES "mytop" "mariadb-top") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_tzinfo_to_sql" "mariadb-tzinfo-to-sql") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_upgrade" "mariadb-upgrade") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_upgrade_service" "mariadb-upgrade-service") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_upgrade_wizard" "mariadb-upgrade-wizard") +list(APPEND MARIADB_SYMLINK_NAMES "mysql_waitpid" "mariadb-waitpid") +list(APPEND MARIADB_SYMLINK_NAMES "mysqld" "mariadbd") +list(APPEND MARIADB_SYMLINK_NAMES "mysqld_multi" "mariadbd-multi") +list(APPEND MARIADB_SYMLINK_NAMES "mysqld_safe" "mariadbd-safe") +list(APPEND MARIADB_SYMLINK_NAMES "mysqld_safe_helper" "mariadbd-safe-helper") + +# Add MariaDB symlinks +macro(CREATE_MARIADB_SYMLINK src)
do you still skip Windows, as in the previous commit? I couldn't find it in this one.
+ # Find the MariaDB name for executable + list(FIND MARIADB_SYMLINK_NAMES ${src} _index) + + if (${_index} GREATER -1) + MATH(EXPR _index "${_index}+1") + list(GET MARIADB_SYMLINK_NAMES ${_index} _name) + MESSAGE(${_name})
I suspect this was a debugging aid that you forgot to remove
+ set(mariadbname ${_name}) + endif() + + if (mariadbname) + set(dest ${mariadbname}) + message("src: ${src}") + message("dest: ${dest}") + message("CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") + message("INSTALL_BINDIR: ${INSTALL_BINDIR}")
and that too
+ + add_custom_target( + symlink_${dest} ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dest} + ) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dest} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} + COMMENT "mklink ${src} -> ${dest}") + + set(symlink_install_dir ${INSTALL_BINDIR}) + # adjust install location if needed + if(${dest} MATCHES "mariadb-install-db") + set(symlink_install_dir ${INSTALL_SCRIPTDIR}) + endif()
this is very fragile. better to take the path from the ${src} also with get_filename_component().
+ + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${dest} DESTINATION ${symlink_install_dir} COMPONENT symlinks) + endif() +endmacro(CREATE_MARIADB_SYMLINK) diff --git a/debian/mariadb-client-10.4.links b/debian/mariadb-client-10.4.links index 4a504969246..b93d2d7f8fd 100644 --- a/debian/mariadb-client-10.4.links +++ b/debian/mariadb-client-10.4.links @@ -1,6 +1,44 @@ +usr/bin/mysql_find_rows usr/bin/mariadb-find-rows +usr/bin/mysql_fix_extensions usr/bin/mariadb-fix-extenstions +usr/bin/mysql_plugin usr/bin/mariadb-plugin +usr/bin/mysql_waitpid usr/bin/mariadb-waitpid +usr/bin/mysqlaccess usr/bin/mariadb-access +usr/bin/mysqladmin usr/bin/mariadb-admin +usr/bin/mysqlanalyze usr/bin/mariadb-analyze +usr/bin/mysqlbinlog usr/bin/mariadb-binlog +usr/bin/mysqlcheck usr/bin/mariadb-analyze +usr/bin/mysqlcheck usr/bin/mariadb-optimize +usr/bin/mysqlcheck usr/bin/mariadb-repair usr/bin/mysqlcheck usr/bin/mysqlanalyze usr/bin/mysqlcheck usr/bin/mysqloptimize usr/bin/mysqlcheck usr/bin/mysqlrepair +usr/bin/mysqldump usr/bin/mariadb-dump +usr/bin/mysqldumpslow usr/bin/mariadb-dump-slow +usr/bin/mysqlimport usr/bin/mariadb-import +usr/bin/mysqloptimize usr/bin/mariadb-optimize +usr/bin/mysqlrepair usr/bin/mariadb-repair +usr/bin/mysqlreport usr/bin/mariadb-report +usr/bin/mysqlslap usr/bin/mariadb-slap +usr/bin/mysqltest usr/bin/mariadb-test +usr/share/man/man1/mysql_find_rows.1.gz usr/share/man/man1/mariadb-find-rows.1.gz +usr/share/man/man1/mysql_fix_extensions.1.gz usr/share/man/man1/mariadb-fix-extensions.1.gz
manpages aren't symlinked in rpms or bintars. and symlinks depends only on MariaDB-client, while for example mysql_install_db is in the server package. may be just put symlinks into the same package as symlink targets? just like with debs?
+usr/share/man/man1/mysql_plugin.1.gz usr/share/man/man1/mariadb-plugin.1.gz +usr/share/man/man1/mysql_waitpid.1.gz usr/share/man/man1/mariadb-waitpid.1.gz +usr/share/man/man1/mysqlaccess.1.gz usr/share/man/man1/mariadb-access.1.gz +usr/share/man/man1/mysqladmin.1.gz usr/share/man/man1/mariadb-admin.1.gz +usr/share/man/man1/mysqlanalyze.1.gz usr/share/man/man1/mariadb-analyze.1.gz +usr/share/man/man1/mysqlbinlog.1.gz usr/share/man/man1/mariadb-binlog.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mariadb-analyze.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mariadb-optimize.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mariadb-repair.1.gz usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqlanalyze.1.gz usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqloptimize.1.gz usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqlrepair.1.gz +usr/share/man/man1/mysqldump.1.gz usr/share/man/man1/mariadb-dump.1.gz +usr/share/man/man1/mysqldumpslow.1.gz usr/share/man/man1/mariadb-dump-slow.1.gz +usr/share/man/man1/mysqlimport.1.gz usr/share/man/man1/mariadb-import.1.gz +usr/share/man/man1/mysqloptimize.1.gz usr/share/man/man1/mariadb-optimize.1.gz +usr/share/man/man1/mysqlrepair.1.gz usr/share/man/man1/mariadb-repair.1.gz +usr/share/man/man1/mysqlreport.1.gz usr/share/man/man1/mariadb-report.1.gz +usr/share/man/man1/mysqlslap.1.gz usr/share/man/man1/mariadb-slap.1.gz +usr/share/man/man1/mysqltest.1.gz usr/share/man/man1/mariadb-test.1.gz diff --git a/debian/mariadb-client-core-10.4.links b/debian/mariadb-client-core-10.4.links new file mode 100644 index 00000000000..4c5ff23b38b --- /dev/null +++ b/debian/mariadb-client-core-10.4.links @@ -0,0 +1,4 @@ +usr/bin/mysql usr/bin/mariadb +usr/bin/mysqlcheck usr/bin/mariadb-check +usr/share/man/man1/mysql.1.gz usr/share/man/man1/mariadb.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mariadb-check.1.gz diff --git a/debian/mariadb-server-10.4.install b/debian/mariadb-server-10.4.install index a9cbbfc8a99..8b4db99a421 100644 --- a/debian/mariadb-server-10.4.install +++ b/debian/mariadb-server-10.4.install @@ -87,9 +87,9 @@ usr/share/man/man1/replace.1 usr/share/man/man1/resolve_stack_dump.1 usr/share/man/man1/resolveip.1 usr/share/man/man1/wsrep_sst_common.1 +usr/share/man/man1/wsrep_sst_mariabackup.1 usr/share/man/man1/wsrep_sst_mysqldump.1 usr/share/man/man1/wsrep_sst_rsync.1 -usr/share/man/man1/wsrep_sst_mariabackup.1 usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/maria_add_gis_sp_bootstrap.sql diff --git a/debian/mariadb-server-10.4.links b/debian/mariadb-server-10.4.links new file mode 100644 index 00000000000..65e0a6650d5 --- /dev/null +++ b/debian/mariadb-server-10.4.links @@ -0,0 +1,18 @@ +usr/bin/mysql_convert_table_format usr/bin/mariadb-convert-table-format +usr/bin/mysql_secure_installation usr/bin/mariadb-secure-installation +usr/bin/mysql_setpermission usr/bin/mariadb-setpermission +usr/bin/mysql_tzinfo_to_sql usr/bin/mariadb-tzinfo-to-sql +usr/bin/mysqld_multi usr/bin/mariadb-multi +usr/bin/mysqld_safe usr/bin/mariadb-safe +usr/bin/mysqld_safe_helper usr/bin/mariadb-safe-helper +usr/bin/mysqlhotcopy usr/bin/mariadb-hotcopy +usr/bin/mysqlshow usr/bin/mariadb-show +usr/share/man/man1/mysql_convert_table_format.1.gz usr/share/man/man1/mariadb-convert-table-format.1.gz +usr/share/man/man1/mysql_secure_installation.1.gz usr/share/man/man1/mariadb-secure-installation.1.gz +usr/share/man/man1/mysql_setpermission.1.gz usr/share/man/man1/mariadb-setpermission.1.gz +usr/share/man/man1/mysql_tzinfo_to_sql.1.gz usr/share/man/man1/mariadb-tzinfo-to-sql.1.gz +usr/share/man/man1/mysqld_multi.1.gz usr/share/man/man1/mariadb-multi.1.gz +usr/share/man/man1/mysqld_safe.1.gz usr/share/man/man1/mariadb-safe.1.gz +usr/share/man/man1/mysqld_safe_helper.1.gz usr/share/man/man1/mariadb-safe-helper.1.gz +usr/share/man/man1/mysqlhotcopy.1.gz usr/share/man/man1/mariadb-hotcopy.1.gz +usr/share/man/man1/mysqlshow.1.gz usr/share/man/man1/mariadb-show.1.gz diff --git a/debian/mariadb-server-core-10.4.links b/debian/mariadb-server-core-10.4.links new file mode 100644 index 00000000000..90ed9ee01cf --- /dev/null +++ b/debian/mariadb-server-core-10.4.links @@ -0,0 +1,4 @@ +usr/bin/mysql_install_db usr/bin/mariadb-install-db +usr/bin/mysql_upgrade usr/bin/mariadb-upgrade +usr/share/man/man1/mysql_install_db.1.gz usr/share/man/man1/mariadb-install-db.1.gz +usr/share/man/man1/mysql_upgrade.1.gz usr/share/man/man1/mariadb-upgrade-db.1.gz diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 3d31cda4ceb..7be46ac1985 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -332,6 +332,7 @@ ELSE() COMPONENT ${${file}_COMPONENT} ) ENDFOREACH() + SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan) ADD_CUSTOM_COMMAND( OUTPUT ${wsrep_sst_rsync_wan}
Regards, Sergei Chief Architect MariaDB and security@mariadb.org
Hi Serg, On Thu, Jun 13, 2019 at 11:18 PM Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Rasmus!
On Jun 13, Rasmus Johansson wrote:
revision-id: e35fb718eae (mariadb-10.4.5-44-ge35fb718eae) parent(s): 8e3a4be45c5 author: Rasmus Johansson <razze@iki.fi> committer: Rasmus Johansson <razze@iki.fi>
Is that an address you want to have in git history? You already have two, just making sure the third one is intentional.
I changed this for the latest commit. Thanks for pointing it out.
timestamp: 2019-06-13 13:20:40 +0000 message:
MDEV-17591 Create MariaDB named commands/symlinks
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index f28720e97bc..e49f296ed75 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -111,8 +111,10 @@ FUNCTION(INSTALL_SCRIPT) ENDIF()
INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} ${COMP}) + string(REPLACE "${CMAKE_BINARY_DIR}/scripts/" "" dest ${script})
better not to assume that the script is in ${CMAKE_BINARY_DIR}/scripts/ I'd use get_filename_component() here. Like
get_filename_component(dest "${scripts}" NAME)
Changed accordingly.
+# Add MariaDB symlinks +macro(CREATE_MARIADB_SYMLINK src)
do you still skip Windows, as in the previous commit? I couldn't find it in this one.
Yes, Windows will be in a seperate commit.
+ + add_custom_target( + symlink_${dest} ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dest} + ) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dest} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} + COMMENT "mklink ${src} -> ${dest}") + + set(symlink_install_dir ${INSTALL_BINDIR}) + # adjust install location if needed + if(${dest} MATCHES "mariadb-install-db") + set(symlink_install_dir ${INSTALL_SCRIPTDIR}) + endif()
this is very fragile. better to take the path from the ${src} also with get_filename_component().
In this case it doesn't really make sense to use get_filename_component because here $dest is already only the filename, no path.
+usr/share/man/man1/mysql_find_rows.1.gz usr/share/man/man1/mariadb-find-rows.1.gz +usr/share/man/man1/mysql_fix_extensions.1.gz usr/share/man/man1/mariadb-fix-extensions.1.gz
manpages aren't symlinked in rpms or bintars. and symlinks depends only on MariaDB-client, while for example mysql_install_db is in the server package.
I've now added the manpage symlinks to bintar and rpms also.
may be just put symlinks into the same package as symlink targets? just like with debs?
This also done now for rpm. The new commit is here: https://github.com/MariaDB/server/commit/270c73b Rasmus
participants (2)
-
Rasmus Johansson
-
Sergei Golubchik