From a0446fa8710ece12a7b9457e1b0e03ce7e4fc2c4 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 21 Jan 2020 10:28:07 -0500 Subject: [PATCH] lib: add bt_version_get_extra_{name,description,patch_names} Those new functions return extra information about the library's version for custom builds (see `version/README.adoc`). Signed-off-by: Philippe Proulx Change-Id: I52abca8235826d1e336584285e925147895b13f4 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2838 Reviewed-by: Francis Deslauriers Tested-by: jenkins --- include/babeltrace2/version.h | 56 ++++++++++++++++++++++++++++++++++- src/lib/babeltrace2.c | 18 +++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/include/babeltrace2/version.h b/include/babeltrace2/version.h index 8ced70e1..a1d27864 100644 --- a/include/babeltrace2/version.h +++ b/include/babeltrace2/version.h @@ -37,7 +37,7 @@ extern "C" { @brief Library version getters. -This module contains four functions to information about the library's +This module contains functions to get information about the library's version:
@@ -61,6 +61,15 @@ version:
\bt_dt_opt Release name's description
bt_version_get_name_description()
+ +
\bt_dt_opt Extra name
+
bt_version_get_extra_name()
+ +
\bt_dt_opt Extra description
+
bt_version_get_extra_description()
+ +
\bt_dt_opt Extra patch names
+
bt_version_get_extra_patch_names()
*/ @@ -149,6 +158,51 @@ case for a development build, this function returns \c NULL. */ extern const char *bt_version_get_name_description(void); +/*! +@brief + Returns the extra name of libbabeltrace2's version. + +The extra name of the library's version can be set at build time for a +custom build. + +@returns + Library's version extra name, or \c NULL if not available. +*/ +extern const char *bt_version_get_extra_name(void); + +/*! +@brief + Returns the extra description of libbabeltrace2's version. + +The extra description of the library's version can be set at build time +for a custom build. + +@returns + @parblock + Library's version extra description, or \c NULL if not available. + + Can contain newlines. + @endparblock +*/ +extern const char *bt_version_get_extra_description(void); + +/*! +@brief + Returns the extra patch names of libbabeltrace2's version. + +The extra patch names of the library's version can be set at build time +for a custom build. + +@returns + @parblock + Library's version extra patch names, or \c NULL if not available. + + Each line of the returned string contains the name of a patch + applied to Babeltrace's source tree for a custom build. + @endparblock +*/ +extern const char *bt_version_get_extra_patch_names(void); + /*! @} */ #ifdef __cplusplus diff --git a/src/lib/babeltrace2.c b/src/lib/babeltrace2.c index ce01e728..95ea7fb8 100644 --- a/src/lib/babeltrace2.c +++ b/src/lib/babeltrace2.c @@ -63,3 +63,21 @@ const char *bt_version_get_name_description(void) return strlen(BT_VERSION_DESCRIPTION) == 0 ? NULL : BT_VERSION_DESCRIPTION; } + +const char *bt_version_get_extra_name(void) +{ + return strlen(BT_VERSION_EXTRA_NAME) == 0 ? NULL : + BT_VERSION_EXTRA_NAME; +} + +const char *bt_version_get_extra_description(void) +{ + return strlen(BT_VERSION_EXTRA_DESCRIPTION) == 0 ? NULL : + BT_VERSION_EXTRA_DESCRIPTION; +} + +const char *bt_version_get_extra_patch_names(void) +{ + return strlen(BT_VERSION_EXTRA_PATCHES) == 0 ? NULL : + BT_VERSION_EXTRA_PATCHES; +} -- 2.34.1