Add (undocumented) support for version suffixes

Allow appending arbitrary text to the libabigail version string
representation. That is useful to identify custom versions of the
library (e.g. development versions or versions of a particular origin).

The feature can be enabled by passing VERSION_SUFFIX to `configure`,
e.g.

  $ configure VERSION_SUFFIX="-dev"

That will extend the version string to (currently) 1.7.0-dev.
The behaviour before this patch remains the default behaviour of not
appending any additional text.

The feature stays intentionally undocumented as the main release of
libabigail will usually not carry a version suffix.

	* configure.ac: add substitution for VERSION_SUFFIX
	* include/abg-version.h.in: add define for ABIGAIL_VERSION_SUFFIX
	* include/abg-config.h(abigail_get_library_version): add support
	for a version suffix
	* src/abg-config.cc(abigail_get_library_version): Likewise.
	* src/abg-tools-utils.cc(get_library_version_string): Likewise.

Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
This commit is contained in:
Matthias Maennich 2019-12-15 23:51:51 +00:00
parent acfcea3ef2
commit ade58f9c49
5 changed files with 23 additions and 6 deletions

View File

@ -42,6 +42,17 @@ AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_REVISION)
dnl This VERSION_SUFFIX environment variable is to allow appending
dnl arbitrary text to the libabigail version string representation.
dnl That is useful to identify custom versions of the library
dnl (e.g. development versions or versions of a particular origin).
dnl
dnl The feature can be enabled by passing VERSION_SUFFIX to `configure`,
dnl e.g.
dnl
dnl $ configure VERSION_SUFFIX="-dev"
AC_SUBST(VERSION_SUFFIX)
AC_ARG_ENABLE(rpm,
AS_HELP_STRING([--enable-rpm=yes|no|auto],
[enable the support of rpm in abipkgdiff (default is auto)]),
@ -872,7 +883,7 @@ AC_OUTPUT
AC_MSG_NOTICE([
=====================================================================
Libabigail: $VERSION_MAJOR.$VERSION_MINOR.$VERSION_REVISION
Libabigail: $VERSION_MAJOR.$VERSION_MINOR.$VERSION_REVISION$VERSION_SUFFIX
=====================================================================
Here is the configuration of the package:

View File

@ -80,10 +80,13 @@ extern "C"
/// \param min the minor version number of the library.
///
/// \param rev the revision version number of the library.
///
/// \param suf the version suffix of the library.
void
abigail_get_library_version(std::string& maj,
std::string& min,
std::string& rev);
std::string& rev,
std::string& suf);
}
}//end namespace abigail

View File

@ -3,4 +3,5 @@
#define ABIGAIL_VERSION_MAJOR "@VERSION_MAJOR@"
#define ABIGAIL_VERSION_MINOR "@VERSION_MINOR@"
#define ABIGAIL_VERSION_REVISION "@VERSION_REVISION@"
#define ABIGAIL_VERSION_SUFFIX "@VERSION_SUFFIX@"
#endif

View File

@ -86,11 +86,13 @@ extern "C"
void
abigail_get_library_version(std::string& major,
std::string& minor,
std::string& revision)
std::string& revision,
std::string& suffix)
{
major = ABIGAIL_VERSION_MAJOR;
minor = ABIGAIL_VERSION_MINOR;
revision = ABIGAIL_VERSION_REVISION;
suffix = ABIGAIL_VERSION_SUFFIX;
}
}

View File

@ -1064,9 +1064,9 @@ sorted_strings_common_prefix(vector<string>& input_strings, string& prefix)
string
get_library_version_string()
{
string major, minor, revision, version_string;
abigail::abigail_get_library_version(major, minor, revision);
version_string = major + "." + minor + "." + revision;
string major, minor, revision, version_string, suffix;
abigail::abigail_get_library_version(major, minor, revision, suffix);
version_string = major + "." + minor + "." + revision + suffix;
return version_string;
}