summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-12-02 12:54:27 +0100
committerSimon Rettberg2020-12-02 12:54:27 +0100
commit656e776498fe862b1b388435568c5bb72213cb16 (patch)
tree855d21b40e4ccb9c07664e4922632da2a883d99d /src
parent[CLIENT] print help and version number correctly (diff)
downloaddnbd3-656e776498fe862b1b388435568c5bb72213cb16.tar.gz
dnbd3-656e776498fe862b1b388435568c5bb72213cb16.tar.xz
dnbd3-656e776498fe862b1b388435568c5bb72213cb16.zip
[BUILD] Include branch and build timestamp in binaries
Diffstat (limited to 'src')
-rw-r--r--src/bench/main.c2
-rw-r--r--src/client/client.c4
-rw-r--r--src/fuse/main.c4
-rw-r--r--src/server/rpc.c2
-rw-r--r--src/server/server.c8
5 files changed, 13 insertions, 7 deletions
diff --git a/src/bench/main.c b/src/bench/main.c
index d195e26..37e2821 100644
--- a/src/bench/main.c
+++ b/src/bench/main.c
@@ -20,7 +20,7 @@
static void printUsage(char *argv0, int exitCode)
{
- printf( "Version: %s\n", DNBD3_VERSION );
+ printf( "Version: %s\n", DNBD3_VERSION_LONG );
printf( "Usage: %s [--debug] --host <serverAddress(es)> --image <imageName> [--rid revision]\n", argv0 );
printf( "Or: %s [-d] -h <serverAddress(es)> -i <imageName> [-r revision]\n", argv0 );
printf( " -h --host List of space separated hosts to use\n" );
diff --git a/src/client/client.c b/src/client/client.c
index cb13682..41e6c32 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -21,6 +21,7 @@
#include <dnbd3/config/client.h>
#include <dnbd3/types.h>
#include <dnbd3/version.h>
+#include <dnbd3/build.h>
#include <stdio.h>
#include <stdlib.h>
@@ -729,5 +730,6 @@ static void dnbd3_print_help(char *argv_0)
void dnbd3_print_version()
{
- printf( "dnbd3-client version: %s\n", DNBD3_VERSION );
+ printf( "dnbd3-client version: %s\n", DNBD3_VERSION_LONG );
+ printf( "Built: %s\n", DNBD3_BUILD_DATE );
}
diff --git a/src/fuse/main.c b/src/fuse/main.c
index 8963e6d..e06f6e8 100644
--- a/src/fuse/main.c
+++ b/src/fuse/main.c
@@ -11,6 +11,7 @@
#include "connection.h"
#include "helper.h"
#include <dnbd3/version.h>
+#include <dnbd3/build.h>
#include <dnbd3/shared/protocol.h>
#include <dnbd3/shared/log.h>
@@ -273,7 +274,8 @@ static struct fuse_lowlevel_ops image_oper = {
static void printVersion()
{
char *arg[] = { "foo", "-V" };
- printf( "dnbd3-fuse version: %s\n", DNBD3_VERSION );
+ printf( "dnbd3-fuse version: %s\n", DNBD3_VERSION_LONG );
+ printf( "Built: %s\n", DNBD3_BUILD_DATE );
printf( "Protocol version: %d\n", (int)PROTOCOL_VERSION );
struct fuse_args args = FUSE_ARGS_INIT( 2, arg );
fuse_parse_cmdline( &args, NULL, NULL, NULL );
diff --git a/src/server/rpc.c b/src/server/rpc.c
index 9bef5ee..566f35c 100644
--- a/src/server/rpc.c
+++ b/src/server/rpc.c
@@ -312,7 +312,7 @@ static bool handleStatus(int sock, int permissions, struct field *fields, size_t
"runId", randomRunId );
}
if ( version ) {
- json_object_set_new( statisticsJson, "version", json_string( DNBD3_VERSION ) );
+ json_object_set_new( statisticsJson, "version", json_string( DNBD3_VERSION_LONG ", built " DNBD3_BUILD_DATE ) );
json_object_set_new( statisticsJson, "build", json_string( DNBD3_BUILD ) );
}
if ( space ) {
diff --git a/src/server/server.c b/src/server/server.c
index ec2e24c..6d1366f 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -106,7 +106,8 @@ static void queueJobInternal(job_t *job);
*/
void dnbd3_printHelp(char *argv_0)
{
- printf( "Version: %s\n\n", DNBD3_VERSION );
+ printf( "Version: %s\n\n", DNBD3_VERSION_LONG );
+ printf( "Built: %s\n", DNBD3_BUILD_DATE );
printf( "Usage: %s [OPTIONS]...\n", argv_0 );
printf( "Start the DNBD3 server\n" );
printf( "-c or --config Configuration directory (default /etc/dnbd3-server/)\n" );
@@ -131,7 +132,8 @@ void dnbd3_printHelp(char *argv_0)
*/
void dnbd3_printVersion()
{
- printf( "dnbd3-server version: %s\n", DNBD3_VERSION );
+ printf( "dnbd3-server version: %s\n", DNBD3_VERSION_LONG );
+ printf( "Built: %s\n", DNBD3_BUILD_DATE );
exit( 0 );
}
@@ -373,7 +375,7 @@ int main(int argc, char *argv[])
logadd( LOG_INFO, "DNBD3 server starting...." );
logadd( LOG_INFO, "Machine type: " DNBD3_ENDIAN_MODE );
logadd( LOG_INFO, "Build Type: %s", DNBD3_BUILD );
- logadd( LOG_INFO, "Version: %s", DNBD3_VERSION );
+ logadd( LOG_INFO, "Version: %s, built %s", DNBD3_VERSION_LONG, DNBD3_BUILD_DATE );
if ( altservers_load() < 0 ) {
logadd( LOG_WARNING, "Could not load alt-servers. Does the file exist in %s?", _configDir );