Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
added build-id tag support:
Browse files Browse the repository at this point in the history
  
          * configure is now able to get the build-id tag: --with-build-tag;
          * show the build-id tag on plugins, chassis and application versions;
  • Loading branch information
miguelaraujo committed Nov 5, 2013
1 parent 433f4aa commit ccc8ed1
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 22 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,16 @@ ELSE(EVENT_LIBRARY_DIRS)
FIND_LIBRARY(EVENT_LIBRARIES event)
ENDIF(EVENT_LIBRARY_DIRS)

SET(BUILD_TAG CACHE STRING "build-tag")

IF(NOT BUILD_TAG)
SET(BUILD_TAG 0)
ENDIF(NOT BUILD_TAG)
ADD_DEFINITIONS(-DCHASSIS_BUILD_TAG="${BUILD_TAG}")

CONFIGURE_FILE(config.h.cmake config.h)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)

IF(NOT BUILD_NUMBER)
SET(BUILD_NUMBER 0)
ENDIF(NOT BUILD_NUMBER)

SET(PACKAGE_VERSION_ID "(${CPACK_PACKAGE_VERSION_MAJOR} << 16 | ${CPACK_PACKAGE_VERSION_MINOR} << 8 | ${CPACK_PACKAGE_VERSION_PATCH})")
SET(PACKAGE_VERSION_STRING "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
Expand Down
Empty file modified autogen.sh
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ AS_IF([test "x$enable_self_contained" = xyes],
AC_MSG_RESULT($WITH_WRAPPER_SCRIPT)
AM_CONDITIONAL(USE_WRAPPER_SCRIPT, test x$WITH_WRAPPER_SCRIPT = xyes)

dnl Check for a special build number to use
AC_MSG_CHECKING(if we have a build number to use)
AC_ARG_WITH([build-tag],
AC_HELP_STRING([--with-build-tag], [the build tag to use (default=0)]),
[CHASSIS_BUILD_TAG=$withval],
[CHASSIS_BUILD_TAG=0])
AC_MSG_RESULT([using $CHASSIS_BUILD_TAG])
AC_DEFINE_UNQUOTED([CHASSIS_BUILD_TAG], ["$CHASSIS_BUILD_TAG"], [proxy-build-tag])

dnl Check for lua
AC_MSG_CHECKING(which pkg-config file to use to find Lua)
AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua]),
Expand Down
8 changes: 6 additions & 2 deletions plugins/admin/admin-plugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -98,6 +98,10 @@
#define C(x) x, sizeof(x) -1
#define S(x) x->str, x->len

#ifndef PLUGIN_VERSION
#define PLUGIN_VERSION PACKAGE_VERSION "." CHASSIS_BUILD_TAG
#endif

struct chassis_plugin_config {
gchar *address; /**< listening address of the admin interface */

Expand Down Expand Up @@ -624,7 +628,7 @@ static int network_mysqld_admin_plugin_apply_config(chassis *chas, chassis_plugi
G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
p->magic = CHASSIS_PLUGIN_MAGIC;
p->name = g_strdup("admin");
p->version = g_strdup(PACKAGE_VERSION);
p->version = g_strdup(PLUGIN_VERSION);

p->init = network_mysqld_admin_plugin_new;
p->get_options = network_mysqld_admin_plugin_get_options;
Expand Down
8 changes: 6 additions & 2 deletions plugins/cli/cli-plugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -35,6 +35,10 @@
#include <stdio.h>
#include <readline/readline.h>

#ifndef PLUGIN_VERSION
#define PLUGIN_VERSION PACKAGE_VERSION "." CHASSIS_BUILD_TAG
#endif

typedef struct {
gchar *command;
} plugin_con_state;
Expand Down Expand Up @@ -557,7 +561,7 @@ int plugin_init(chassis_plugin *p) {
/* append the our init function to the init-hook-list */
p->magic = CHASSIS_PLUGIN_MAGIC;
p->name = g_strdup("client");
p->version = g_strdup(PACKAGE_VERSION);
p->version = g_strdup(PLUGIN_VERSION);

p->init = network_mysqld_cli_plugin_init;
p->get_options = network_mysqld_cli_plugin_get_options;
Expand Down
8 changes: 6 additions & 2 deletions plugins/debug/debug-plugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -38,6 +38,10 @@

#include <gmodule.h>

#ifndef PLUGIN_VERSION
#define PLUGIN_VERSION PACKAGE_VERSION "." CHASSIS_BUILD_TAG
#endif

/**
* debug plugin
*
Expand Down Expand Up @@ -430,7 +434,7 @@ static int network_mysqld_debug_plugin_apply_config(chassis *chas, chassis_plugi
G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
p->magic = CHASSIS_PLUGIN_MAGIC;
p->name = g_strdup("debug");
p->version = g_strdup(PACKAGE_VERSION);
p->version = g_strdup(PLUGIN_VERSION);

p->init = network_mysqld_debug_plugin_new;
p->get_options = network_mysqld_debug_plugin_get_options;
Expand Down
8 changes: 6 additions & 2 deletions plugins/proxy/proxy-plugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -158,6 +158,10 @@ typedef int socklen_t;
#define CLIENT_PLUGIN_AUTH (1 << 19)
#endif

#ifndef PLUGIN_VERSION
#define PLUGIN_VERSION PACKAGE_VERSION "." CHASSIS_BUILD_TAG
#endif

#define HASH_INSERT(hash, key, expr) \
do { \
GString *hash_value; \
Expand Down Expand Up @@ -2414,7 +2418,7 @@ int network_mysqld_proxy_plugin_apply_config(chassis *chas, chassis_plugin_confi
G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
p->magic = CHASSIS_PLUGIN_MAGIC;
p->name = g_strdup("proxy");
p->version = g_strdup(PACKAGE_VERSION);
p->version = g_strdup(PLUGIN_VERSION);

p->init = network_mysqld_proxy_plugin_new;
p->get_options = network_mysqld_proxy_plugin_get_options;
Expand Down
8 changes: 6 additions & 2 deletions plugins/replicant/replicant-plugin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -52,6 +52,10 @@
#define C(x) x, sizeof(x) - 1
#define S(x) x->str, x->len

#ifndef PLUGIN_VERSION
#define PLUGIN_VERSION PACKAGE_VERSION "." CHASSIS_BUILD_TAG
#endif

/**
* we have two phases
* - getting the binglog-pos with SHOW MASTER STATUS
Expand Down Expand Up @@ -823,7 +827,7 @@ int network_mysqld_replicant_plugin_apply_config(chassis G_GNUC_UNUSED *chas, ch
G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
p->magic = CHASSIS_PLUGIN_MAGIC;
p->name = g_strdup("replicant");
p->version = g_strdup(PACKAGE_VERSION);
p->version = g_strdup(PLUGIN_VERSION);
/* append the our init function to the init-hook-list */

p->init = network_mysqld_replicant_plugin_init;
Expand Down
8 changes: 5 additions & 3 deletions src/chassis-frontend.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -492,9 +492,11 @@ int chassis_options_set_cmdline_only_options(chassis_options_t *opts,
int chassis_frontend_print_version() {
/* allow to pass down a build-tag at build-time which gets hard-coded into the binary */
#ifndef CHASSIS_BUILD_TAG
#define CHASSIS_BUILD_TAG PACKAGE_STRING
#define CHASSIS_BUILD_TAG PACKAGE_VERSION
g_print(" chassis: %s" CHASSIS_NEWLINE, CHASSIS_BUILD_TAG);
#else
g_print(" chassis: %s.%s" CHASSIS_NEWLINE, PACKAGE_VERSION, CHASSIS_BUILD_TAG);
#endif
g_print(" chassis: %s" CHASSIS_NEWLINE, CHASSIS_BUILD_TAG);
g_print(" glib2: %d.%d.%d" CHASSIS_NEWLINE, GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
g_print(" libevent: %s" CHASSIS_NEWLINE, event_get_version());

Expand Down
8 changes: 5 additions & 3 deletions src/mysql-proxy-cli.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* $%BEGINLICENSE%$
Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -336,11 +336,13 @@ int main_cmdline(int argc, char **argv) {
if (frontend->print_version) {
#ifndef CHASSIS_BUILD_TAG
#define CHASSIS_BUILD_TAG PACKAGE_STRING
g_print("%s" CHASSIS_NEWLINE, CHASSIS_BUILD_TAG);
#else
g_print("%s.%s" CHASSIS_NEWLINE, PACKAGE_STRING, CHASSIS_BUILD_TAG);
#endif
g_print("%s" CHASSIS_NEWLINE, CHASSIS_BUILD_TAG);
chassis_frontend_print_version();
}

/* add the other options which can also appear in the configfile */
opts = chassis_options_new();
chassis_frontend_set_chassis_options(frontend, opts);
Expand Down
4 changes: 2 additions & 2 deletions winbuild.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@rem $%BEGINLICENSE%$
@rem Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
@rem Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
@rem
@rem This program is free software; you can redistribute it and/or
@rem modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -74,7 +74,7 @@
@rem del CMakeCache.txt

:CMAKE
@cmake -G %GENERATOR% -DBUILD_NUMBER=%BUILD_NUMBER% -DMYSQL_LIBRARY_DIRS:PATH=%MYSQL_DIR%\lib\debug -DMYSQL_INCLUDE_DIRS:PATH=%MYSQL_DIR%\include -DGLIB_LIBRARY_DIRS:PATH=%GLIB_DIR%\lib -DGLIB_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DGMODULE_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DGTHREAD_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DCMAKE_BUILD_TYPE=Release .
@cmake -G %GENERATOR% -DBUILD_TAG=%BUILD_TAG% -DMYSQL_LIBRARY_DIRS:PATH=%MYSQL_DIR%\lib\debug -DMYSQL_INCLUDE_DIRS:PATH=%MYSQL_DIR%\include -DGLIB_LIBRARY_DIRS:PATH=%GLIB_DIR%\lib -DGLIB_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DGMODULE_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DGTHREAD_INCLUDE_DIRS:PATH=%GLIB_DIR%\include\glib-2.0;%GLIB_DIR%\lib\glib-2.0\include -DCMAKE_BUILD_TYPE=Release .

@IF NOT %GENERATOR%=="NMake Makefiles" (GOTO VS08BUILD)
nmake
Expand Down

0 comments on commit ccc8ed1

Please sign in to comment.