From 1cbe4ca890314b1fb17b427791fcb37cc0fa991c Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja.osipov@gmail.com> Date: Tue, 22 Feb 2011 19:09:15 +0300 Subject: [PATCH] CPack: initial commit. Add the simplest CPack configuration for 'make package' and 'make package_source' targets. Add an empty snapshot to revision control to use in 'make package' and thus spare the user from the need to do --init-storage. Modify args.test to accept a bare (no git version) version number, and thus ensure the user from a yet another call before he/she can start work/play around. --- .gitignore | 5 +++++ CMakeLists.txt | 19 ++++++++++++++++++- cmake/tarantool_cpack.cmake | 27 +++++++++++++++++++++++++++ core/log_io.c | 2 +- include/config.h.cmake | 2 +- mod/CMakeLists.txt | 2 ++ test/CMakeLists.txt | 5 +++++ test/box/00000000000000000001.snap | Bin 0 -> 15 bytes test/box/args.result | 4 ++-- test/box/args.test | 2 +- 10 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 cmake/tarantool_cpack.cmake create mode 100644 test/box/00000000000000000001.snap diff --git a/.gitignore b/.gitignore index a367757d18..56c23eec46 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,8 @@ cmake_install.cmake mod/silverbox/tarantool_silverbox mod/feeder/tarantool_feeder include/config.h +CPackConfig.cmake +CPackSourceConfig.cmake +_CPack_Packages +install_manifest.txt +tarantool-*.tar.gz diff --git a/CMakeLists.txt b/CMakeLists.txt index f7ab70f1e3..64de4233d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.6) -project(Tarantool) +project(tarantool) include(CheckLibraryExists) include(CheckIncludeFile) find_program(ECHO echo) @@ -72,10 +72,23 @@ add_custom_target(TAGS COMMAND ctags -R -e -f TAGS # # Define TARANTOOL_VERSION -- a string constant with tarantool version. # +set (TARANTOOL_VERSION "") execute_process (COMMAND ${GIT} describe HEAD OUTPUT_VARIABLE TARANTOOL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) +# +# Make sure the version is set even if building +# out of source. +# +set (CPACK_PACKAGE_VERSION_MAJOR "1") +set (CPACK_PACKAGE_VERSION_MINOR "3") +set (CPACK_PACKAGE_VERSION_PATCH "4") +if (TARANTOOL_VERSION STREQUAL "") + set (TARANTOOL_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +endif() + # # Set flags for all include files: those maintained by us and @@ -155,6 +168,10 @@ add_subdirectory(core) add_subdirectory(mod) add_subdirectory(test) +install (FILES README LICENSE doc/silverbox-protocol.txt + DESTINATION doc) + +include (cmake/tarantool_cpack.cmake) # # Output compile-time defines into config.h. Do it at the end # of the script to make sure all variables are set. diff --git a/cmake/tarantool_cpack.cmake b/cmake/tarantool_cpack.cmake new file mode 100644 index 0000000000..f6f7c42c4c --- /dev/null +++ b/cmake/tarantool_cpack.cmake @@ -0,0 +1,27 @@ +# +# List generators +# +set (CPACK_GENERATOR "TGZ") +set (CPACK_SOURCE_GENERATOR "TGZ") +# +# Describe the source distribution +# +set (CPACK_SOURCE_IGNORE_FILES "\\\\.git" "_CPack_Packages" + "CMakeCache.txt" "CPackSourceConfig.cmake" "CPackConfig.cmake" + "CMakeFiles" "\\\\.gz" "\\\\.Z" "\\\\.zip" + "mod/silverbox/tarantool_silverbox" + "mod/silverbox/tarantool_feeder" "install_manifest.txt" + "Makefile" "cmake_install.cmake" "test/var/" "\\\\.a") +set (CPACK_SOURCE_PACKAGE_FILE_NAME +"tarantool-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-src") +# +# Provide options for the binary distribution. +# +STRING(TOLOWER "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" platform) + +set (CPACK_PACKAGE_FILE_NAME +"tarantool-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${platform}") + +# +# +include (CPack) diff --git a/core/log_io.c b/core/log_io.c index ea572971a8..6c5df8ee42 100644 --- a/core/log_io.c +++ b/core/log_io.c @@ -1131,7 +1131,7 @@ recover(struct recovery_state *r, i64 lsn) result = recover_snap(r); if (result < 0) { if (greatest_lsn(r->snap_prefered_class) <= 0) { - say_crit("don't you forget to initialize storage with --init_storage switch?"); + say_crit("didn't you forget to initialize storage with --init-storage switch?"); _exit(1); } panic("snapshot recovery failed"); diff --git a/include/config.h.cmake b/include/config.h.cmake index 3bd80eb234..cadf475ba9 100644 --- a/include/config.h.cmake +++ b/include/config.h.cmake @@ -5,7 +5,7 @@ * config.h.cmake. Please do not modify. */ /* - A string with major-minor-patch-commit-id identifier of the + * A string with major-minor-patch-commit-id identifier of the * release. */ #define TARANTOOL_VERSION "@TARANTOOL_VERSION@" diff --git a/mod/CMakeLists.txt b/mod/CMakeLists.txt index 1cb0091835..590433959f 100644 --- a/mod/CMakeLists.txt +++ b/mod/CMakeLists.txt @@ -24,6 +24,8 @@ function(tarantool_module mod) set_target_properties(tarantool_${mod} PROPERTIES COMPILE_FLAGS "${core_cflags}") + install (TARGETS tarantool_${mod} DESTINATION bin) + endfunction() foreach (module ${TARANTOOL_MODULES}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 877f774457..a34de08cd6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,8 @@ add_custom_target(test COMMAND ${PROJECT_SOURCE_DIR}/test/test-run.py --bindir=${PROJECT_BINARY_DIR}/mod/silverbox --vardir=${PROJECT_BINARY_DIR}/test/var ) + +install (PROGRAMS tarantool DESTINATION bin) +install (DIRECTORY lib DESTINATION bin) +install (FILES box/tarantool.cfg box/00000000000000000001.snap + DESTINATION bin) diff --git a/test/box/00000000000000000001.snap b/test/box/00000000000000000001.snap new file mode 100644 index 0000000000000000000000000000000000000000..8f8d8ac5b4c8634e2099b9d6671560db48518960 GIT binary patch literal 15 WcmWIca}3}z&@(jT;*wjvRsaASSp$~< literal 0 HcmV?d00001 diff --git a/test/box/args.result b/test/box/args.result index 48153743f8..68b984bcfe 100644 --- a/test/box/args.result +++ b/test/box/args.result @@ -60,8 +60,8 @@ tarantool_silverbox --daemonize tarantool_silverbox: the daemon is already running tarantool_silverbox --version -1.3.minor-<rev>-<commit> +1.minor.patch-<rev>-<commit> tarantool_silverbox -V -1.3.minor-<rev>-<commit> +1.minor.patch-<rev>-<commit> diff --git a/test/box/args.test b/test/box/args.test index 77ba40e862..05e942901d 100644 --- a/test/box/args.test +++ b/test/box/args.test @@ -9,7 +9,7 @@ server.test_option("-c") server.test_option("--config tarantool.cfg") server.test_option("--daemonize") sys.stdout.pop_filter() -sys.stdout.push_filter("(\d\.\d)\.\d-\d+-\S+", "\\1.minor-<rev>-<commit>") +sys.stdout.push_filter("(\d)\.\d\.\d(-\d+-\S+)?", "\\1.minor.patch-<rev>-<commit>") server.test_option("--version") server.test_option("-V ") sys.stdout.pop_filter() -- GitLab