Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: alexander.turenko@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 2/2] build: add bundled curl and c-ares to version output
Date: Tue, 21 Jan 2020 14:54:32 +0300	[thread overview]
Message-ID: <60d67cf38872e012f83410591dfa39140fc679e0.1579605136.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1579605136.git.sergepetrenko@tarantool.org>

Since we may use bundled lubcurl and c-ares, it can be useful to know
the exact curl and c-ares versions tarantool was built with.

Follow-up #4591
---
 cmake/BuildAres.cmake     | 10 ++++++++++
 cmake/BuildLibCURL.cmake  | 10 ++++++++++
 src/lua/init.c            | 14 ++++++++++++++
 src/main.cc               |  6 ++++++
 src/trivia/config.h.cmake |  4 ++++
 test/box-py/args.result   |  8 ++++++++
 test/box-py/args.test.py  |  5 ++++-
 7 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/cmake/BuildAres.cmake b/cmake/BuildAres.cmake
index 0f9f174ce..7be6f5b00 100644
--- a/cmake/BuildAres.cmake
+++ b/cmake/BuildAres.cmake
@@ -4,6 +4,16 @@ macro(ares_build)
     set(ARES_BINARY_DIR ${PROJECT_BINARY_DIR}/build/ares/work)
     set(ARES_INSTALL_DIR ${PROJECT_BINARY_DIR}/build/ares/dest)
 
+    # Get bundled ares version for `tarantool -v` output.
+    if (EXISTS "${ARES_SOURCE_DIR}/.git" AND GIT)
+        execute_process (COMMAND ${GIT} describe HEAD
+            OUTPUT_VARIABLE BUNDLED_ARES_VERSION
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            WORKING_DIRECTORY ${ARES_SOURCE_DIR})
+            string(REPLACE cares- "" BUNDLED_ARES_VERSION ${BUNDLED_ARES_VERSION})
+            string(REPLACE _ . BUNDLED_ARES_VERSION ${BUNDLED_ARES_VERSION})
+    endif()
+
     # See BuildLibCURL.cmake for details.
     set(ARES_CFLAGS "")
     if (TARGET_OS_DARWIN AND NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "")
diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake
index 756297878..aff34cbf0 100644
--- a/cmake/BuildLibCURL.cmake
+++ b/cmake/BuildLibCURL.cmake
@@ -4,6 +4,16 @@ macro(curl_build)
     set(LIBCURL_BINARY_DIR ${PROJECT_BINARY_DIR}/build/curl/work)
     set(LIBCURL_INSTALL_DIR ${PROJECT_BINARY_DIR}/build/curl/dest)
 
+    # Get bundled curl version for `tarantool -v` output.
+    if (EXISTS "${LIBCURL_SOURCE_DIR}/.git" AND GIT)
+        execute_process (COMMAND ${GIT} describe HEAD
+            OUTPUT_VARIABLE BUNDLED_CURL_VERSION
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            WORKING_DIRECTORY ${LIBCURL_SOURCE_DIR})
+            string(REPLACE curl- "" BUNDLED_CURL_VERSION ${BUNDLED_CURL_VERSION})
+            string(REPLACE _ . BUNDLED_CURL_VERSION ${BUNDLED_CURL_VERSION})
+    endif()
+
     if (BUILD_STATIC)
         set(LIBZ_LIB_NAME libz.a)
     else()
diff --git a/src/lua/init.c b/src/lua/init.c
index 097dd8495..437175260 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -427,6 +427,20 @@ luaopen_tarantool(lua_State *L)
 	lua_pushstring(L, TARANTOOL_C_FLAGS);
 	lua_settable(L, -3);
 
+#ifdef BUNDLED_CURL_VERSION
+	/* build.curl */
+	lua_pushstring(L, "curl");
+	lua_pushstring(L, BUNDLED_CURL_VERSION);
+	lua_settable(L, -3);
+#endif
+
+#ifdef BUNDLED_ARES_VERSION
+	/* build.c_ares */
+	lua_pushstring(L, "c_ares");
+	lua_pushstring(L, BUNDLED_ARES_VERSION);
+	lua_settable(L, -3);
+#endif
+
 	lua_settable(L, -3);    /* box.info.build */
 	return 1;
 }
diff --git a/src/main.cc b/src/main.cc
index e674d85b1..098b97013 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -675,6 +675,12 @@ print_version(void)
 	printf("%s %s\n", tarantool_package(), tarantool_version());
 	printf("Target: %s\n", BUILD_INFO);
 	printf("Build options: %s\n", BUILD_OPTIONS);
+#ifdef BUNDLED_CURL_VERSION
+	printf("Bundled libCURL version: %s\n", BUNDLED_CURL_VERSION);
+#endif
+#ifdef BUNDLED_ARES_VERSION
+	printf("Bundled c-ares version: %s\n", BUNDLED_ARES_VERSION);
+#endif
 	printf("Compiler: %s\n", COMPILER_INFO);
 	printf("C_FLAGS:%s\n", TARANTOOL_C_FLAGS);
 	printf("CXX_FLAGS:%s\n", TARANTOOL_CXX_FLAGS);
diff --git a/src/trivia/config.h.cmake b/src/trivia/config.h.cmake
index 226f83128..c541beb31 100644
--- a/src/trivia/config.h.cmake
+++ b/src/trivia/config.h.cmake
@@ -42,6 +42,10 @@
 #define TARANTOOL_LIBEXT "so"
 #endif
 
+/** Is set to the version of builtin libcurl used. */
+#cmakedefine BUNDLED_CURL_VERSION "${BUNDLED_CURL_VERSION}"
+/** Is set to the version of builtin c-ares used. */
+#cmakedefine BUNDLED_ARES_VERSION "${BUNDLED_ARES_VERSION}"
 /**
  * Defined if cpuid() instruction is available.
  */
diff --git a/test/box-py/args.result b/test/box-py/args.result
index 54629edea..cb1131eb3 100644
--- a/test/box-py/args.result
+++ b/test/box-py/args.result
@@ -47,6 +47,8 @@ tarantool --version
 Tarantool 2.minor.patch-<rev>-<commit>
 Target: platform <build>
 Build options: flags
+Curl 7.66.patch
+c-ares 1.15.patch-<rev>-<commit>
 Compiler: cc
 C_FLAGS: flags
 CXX_FLAGS: flags
@@ -55,6 +57,8 @@ tarantool -v
 Tarantool 2.minor.patch-<rev>-<commit>
 Target: platform <build>
 Build options: flags
+Curl 7.66.patch
+c-ares 1.15.patch-<rev>-<commit>
 Compiler: cc
 C_FLAGS: flags
 CXX_FLAGS: flags
@@ -63,6 +67,8 @@ tarantool -V
 Tarantool 2.minor.patch-<rev>-<commit>
 Target: platform <build>
 Build options: flags
+Curl 7.66.patch
+c-ares 1.15.patch-<rev>-<commit>
 Compiler: cc
 C_FLAGS: flags
 CXX_FLAGS: flags
@@ -114,6 +120,8 @@ tarantool -V ${SOURCEDIR}/test/box-py/args.lua 1 2 3
 Tarantool 2.minor.patch-<rev>-<commit>
 Target: platform <build>
 Build options: flags
+Curl 7.66.patch
+c-ares 1.15.patch-<rev>-<commit>
 Compiler: cc
 C_FLAGS: flags
 CXX_FLAGS: flags
diff --git a/test/box-py/args.test.py b/test/box-py/args.test.py
index f89c5bb09..59b0f4b4c 100644
--- a/test/box-py/args.test.py
+++ b/test/box-py/args.test.py
@@ -16,7 +16,10 @@ sys.stdout.push_filter("unrecognized option.*", "unrecognized option")
 server.test_option("-Z")
 server.test_option("--no-such-option")
 server.test_option("--no-such-option --version")
-sys.stdout.push_filter(".* (\d+)\.\d+\.\d(-\d+-\w+)?", "Tarantool \\1.minor.patch-<rev>-<commit>")
+sys.stdout.push_filter("Tarantool (\d+)\.\d+\.\d(-\d+-\w+)?", "Tarantool \\1.minor.patch-<rev>-<commit>")
+sys.stdout.push_filter("Bundled libCURL version: (\d+).(\d+)\.\d+", "Curl \\1.\\2.patch")
+sys.stdout.push_filter("Bundled c-ares version: (\d+)\.(\d+)\.\d(-\d+-\w+)?",
+                       "c-ares \\1.\\2.patch-<rev>-<commit>")
 sys.stdout.push_filter("Target: .*", "Target: platform <build>")
 sys.stdout.push_filter(".*Disable shared arena since.*\n", "")
 sys.stdout.push_filter("Build options: .*", "Build options: flags")
-- 
2.21.0 (Apple Git-122)

  parent reply	other threads:[~2020-01-21 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 11:54 [Tarantool-patches] [PATCH v2 0/2] build: link curl with c-ares Serge Petrenko
2020-01-21 11:54 ` [Tarantool-patches] [PATCH v2 1/2] build: link bundled libcurl " Serge Petrenko
2020-02-08 19:42   ` Alexander Turenko
2020-03-03 16:46     ` Serge Petrenko
2020-03-03 16:51       ` Serge Petrenko
2020-03-03 23:20       ` Alexander Turenko
2020-03-04 12:42       ` Alexander Turenko
2020-03-05  5:27   ` Kirill Yukhin
2020-01-21 11:54 ` Serge Petrenko [this message]
2020-03-04 12:03   ` [Tarantool-patches] [PATCH v2 2/2] build: add bundled curl and c-ares to version output Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60d67cf38872e012f83410591dfa39140fc679e0.1579605136.git.sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] build: add bundled curl and c-ares to version output' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox