aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/version.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-07 22:11:23 +0000
committerlloyd <[email protected]>2011-02-07 22:11:23 +0000
commit02ed4e271a6287a0c23b137e826e62d2be752b82 (patch)
treee50ccc16f91dc52671fdd24dd5d36d4685968511 /src/utils/version.cpp
parent80d591ec716fb6cea829db45b68da1af4afd1d0e (diff)
Add a new configure.py option --distribution-info which sets a macro
in build.h named BOTAN_DISTRIBUTION_INFO. The default value is 'unspecified'. People packaging botan could set this to another value, for instance 'Gentoo 1.9.13-r3' or 'Debian 1.9.13-1', or 'pristine' to indicate a completely unmodified/stock version. This was suggested by Zooko for Crypto++ in http://sourceforge.net/apps/trac/cryptopp/ticket/11 and seemed like an idea worth stealing. Don't default the version datestmap to the current day if unset, instead set to zero. This allows applications to detect unreleased versions. Document that version_datestamp will return zero for unreleased versions. Change the version_string function to return more information about the current version, including the release date and distribution information. It will now return strings like: Botan 1.9.13 (released 20110207, distribution Gentoo 1.9.13-r3) or for an unreleased version: Botan 1.9.13 (unreleased version, distribution unspecified)
Diffstat (limited to 'src/utils/version.cpp')
-rw-r--r--src/utils/version.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/utils/version.cpp b/src/utils/version.cpp
index 22827cbe5..cf3205d19 100644
--- a/src/utils/version.cpp
+++ b/src/utils/version.cpp
@@ -1,12 +1,13 @@
/*
* Version Information
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2011 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#include <botan/version.h>
#include <botan/parsing.h>
+#include <sstream>
namespace Botan {
@@ -21,9 +22,20 @@ namespace Botan {
*/
std::string version_string()
{
- return to_string(version_major()) + "." +
- to_string(version_minor()) + "." +
- to_string(version_patch());
+ std::ostringstream out;
+
+ out << "Botan " << version_major() << "."
+ << version_minor() << "."
+ << version_patch() << " (";
+
+ if(BOTAN_VERSION_DATESTAMP == 0)
+ out << "unreleased version";
+ else
+ out << "released " << version_datestamp();
+
+ out << ", distribution " << BOTAN_DISTRIBUTION_INFO << ")";
+
+ return out.str();
}
u32bit version_datestamp() { return BOTAN_VERSION_DATESTAMP; }