From c6a843122ad60fff05e7daa2f7b30abc2ec101e9 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Mon, 19 Oct 2020 16:14:41 +0200 Subject: [BUILD] set build type and stop Release build if repository is dirty --- src/bench/main.c | 2 +- src/client/client.c | 4 ++-- src/fuse/main.c | 2 +- src/kernel/dnbd3_main.c | 6 +++--- src/server/CMakeLists.txt | 3 --- src/server/rpc.c | 4 ++-- src/server/server.c | 10 +++++----- 7 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/bench/main.c b/src/bench/main.c index 89c09f3..a167f05 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_BUILD_VERSION ); printf( "Usage: %s [--debug] --host --image [--rid revision]\n", argv0 ); printf( "Or: %s [-d] -h -i [-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 e433160..69cc00f 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -644,7 +644,7 @@ static int dnbd3_daemon_send(int argc, char **argv) static void dnbd3_print_help(char *argv_0) { - printf( "Version: %s\n", DNBD3_VERSION ); + printf( "Version: %s\n", DNBD3_BUILD_VERSION ); printf( "\nUsage: %s\n" "\t-h -i [-r ] -d [-a ] || -c -d \n\n", argv_0 ); printf( "Start the DNBD3 client.\n" ); @@ -666,6 +666,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_BUILD_VERSION ); exit( EXIT_SUCCESS ); } diff --git a/src/fuse/main.c b/src/fuse/main.c index cf9efbe..5cf3e81 100644 --- a/src/fuse/main.c +++ b/src/fuse/main.c @@ -273,7 +273,7 @@ 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_BUILD_VERSION ); 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/kernel/dnbd3_main.c b/src/kernel/dnbd3_main.c index 27e8eed..353e8d2 100644 --- a/src/kernel/dnbd3_main.c +++ b/src/kernel/dnbd3_main.c @@ -49,8 +49,8 @@ static int __init dnbd3_init(void) return -EIO; } - pr_info("kernel module in version %s loaded\n", DNBD3_VERSION); - pr_debug("machine type " ENDIAN_MODE "\n"); + pr_info("kernel module in version %s loaded\n", DNBD3_BUILD_VERSION); + pr_debug("machine type %s\n", DNBD3_ENDIAN_MODE); // add MAX_NUMBER_DEVICES devices for (i = 0; i < max_devs; i++) @@ -87,7 +87,7 @@ module_exit(dnbd3_exit); MODULE_DESCRIPTION("Distributed Network Block Device 3"); MODULE_LICENSE("GPL"); -MODULE_VERSION(DNBD3_VERSION); +MODULE_VERSION(DNBD3_BUILD_VERSION); module_param(max_devs, int, 0444); MODULE_PARM_DESC(max_devs, "number of network block devices to initialize (default: 8)"); diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 47dda53..1855d91 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -12,9 +12,6 @@ endif(NOT JANSSON_FOUND) # add compile option to enable enhanced POSIX features add_definitions(-D_GNU_SOURCE) -# export project build type to source code -add_definitions(-DBUILD_TYPE=${CMAKE_BUILD_TYPE}) - if(DNBD3_SERVER_AFL) # build dnbd3-server with AFL support message(STATUS "Building dnbd3-server with AFL support") diff --git a/src/server/rpc.c b/src/server/rpc.c index ab08395..c8da951 100644 --- a/src/server/rpc.c +++ b/src/server/rpc.c @@ -311,8 +311,8 @@ 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, "build", json_string( TOSTRING( BUILD_TYPE ) ) ); + json_object_set_new( statisticsJson, "version", json_string( DNBD3_BUILD_VERSION ) ); + json_object_set_new( statisticsJson, "build", json_string( DNBD3_BUILD_TYPE ) ); } if ( space ) { uint64_t spaceTotal = 0, spaceAvail = 0; diff --git a/src/server/server.c b/src/server/server.c index 8aefece..55ec042 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -105,7 +105,7 @@ 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_BUILD_VERSION ); printf( "Usage: %s [OPTIONS]...\n", argv_0 ); printf( "Start the DNBD3 server\n" ); printf( "-c or --config Configuration directory (default /etc/dnbd3-server/)\n" ); @@ -130,7 +130,7 @@ void dnbd3_printHelp(char *argv_0) */ void dnbd3_printVersion() { - printf( "dnbd3-server version: %s\n", DNBD3_VERSION ); + printf( "dnbd3-server version: %s\n", DNBD3_BUILD_VERSION ); exit( 0 ); } @@ -363,9 +363,9 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } logadd( LOG_INFO, "DNBD3 server starting...." ); - logadd( LOG_INFO, "Machine type: " ENDIAN_MODE ); - logadd( LOG_INFO, "Build Type: " TOSTRING( BUILD_TYPE ) ); - logadd( LOG_INFO, "Version: %s", DNBD3_VERSION ); + logadd( LOG_INFO, "Machine type: " DNBD3_ENDIAN_MODE ); + logadd( LOG_INFO, "Build Type: %s", DNBD3_BUILD_TYPE ); + logadd( LOG_INFO, "Version: %s", DNBD3_BUILD_VERSION ); if ( altservers_load() < 0 ) { logadd( LOG_WARNING, "Could not load alt-servers. Does the file exist in %s?", _configDir ); -- cgit v1.2.3-55-g7522