Add (undocumented) support for version suffixes
authorMatthias Maennich <maennich@google.com>
Sun, 15 Dec 2019 23:51:51 +0000 (23:51 +0000)
committerMatthias Maennich <maennich@google.com>
Thu, 9 Jan 2020 17:06:31 +0000 (17:06 +0000)
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>
configure.ac
include/abg-config.h
include/abg-version.h.in
src/abg-config.cc
src/abg-tools-utils.cc

index 87605a373f5198453b9d4956c9b7585a48c1cf60..00ba5dc4182ee3b1ced3bcf910a2d0062779cc16 100644 (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:
index cea016c37168c3aa689a2f332dc3a77a5f8fc2be..59c990d41187b9a6599d1492ba4635bd410e7c62 100644 (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
index 68c8d84d5ee57f7367682634654e527232e36ce0..7d828a0ff5fa168901059584ce15d4bd9e900cfe 100644 (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
index d629f2da8e0d8dc02eda2dde22012bc79252b28d..28c0da531e11131076287447563f86ba07a2ffe5 100644 (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;
 }
 
 }
index 377f313cd77851c072e3a07078fd5e3e7ee96d59..0495905253ed1e9a6e8aeb88338176fffd08ea7e 100644 (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;
 }