version reporting: use git branch and commit if available

pull/13/head
Richard Fuchs 12 years ago
parent 7b60e2e7f5
commit 681b2c1a24

@ -22,7 +22,7 @@ flags = [
'-I../kernel-module/', '-I../kernel-module/',
'-D_GNU_SOURCE', '-D_GNU_SOURCE',
'-D__DEBUG=1', '-D__DEBUG=1',
'-DMEDIAPROXY_VERSION="dummy"', '-DRTPENGINE_VERSION="dummy"',
'-DMP_PLUGIN_DIR="/usr/lib/rtpengine"', '-DMP_PLUGIN_DIR="/usr/lib/rtpengine"',
'-O2', '-O2',
'-fstack-protector', '-fstack-protector',

@ -8,16 +8,27 @@ CFLAGS+= `pkg-config --cflags openssl`
CFLAGS+= `pcre-config --cflags` CFLAGS+= `pcre-config --cflags`
CFLAGS+= -I../kernel-module/ CFLAGS+= -I../kernel-module/
CFLAGS+= -D_GNU_SOURCE CFLAGS+= -D_GNU_SOURCE
ifneq ($(MEDIAPROXY_VERSION),)
CFLAGS+= -DMEDIAPROXY_VERSION="\"$(MEDIAPROXY_VERSION)\"" ifeq ($(RTPENGINE_VERSION),)
else
DPKG_PRSCHNGLG= $(shell which dpkg-parsechangelog 2>/dev/null) DPKG_PRSCHNGLG= $(shell which dpkg-parsechangelog 2>/dev/null)
ifneq ($(DPKG_PRSCHNGLG),) ifneq ($(DPKG_PRSCHNGLG),)
CFLAGS+= -DMEDIAPROXY_VERSION="\"$(shell dpkg-parsechangelog -l../debian/changelog | awk '/^Version: / {print $$2}')\"" DPKG_PRSCHNGLG=$(shell dpkg-parsechangelog -l../debian/changelog | awk '/^Version: / {print $$2}')
else endif
CFLAGS+= -DMEDIAPROXY_VERSION="\"undefined\"" GIT_BR_COMMIT=$(shell git branch --no-color --no-column -v 2> /dev/null | awk -e '/^\*/ {OFS="-"; print "git", $$2, $$3}')
ifneq ($(DPKG_PRSCHNGLG),)
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG)
endif
ifneq ($(GIT_BR_COMMIT),)
RTPENGINE_VERSION+=$(GIT_BR_COMMIT)
endif
ifeq ($(RTPENGINE_VERSION),)
RTPENGINE_VERSION+=undefined
endif endif
endif endif
CFLAGS+= -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
CFLAGS+= -DMP_PLUGIN_DIR="\"/usr/lib/rtpengine\"" CFLAGS+= -DMP_PLUGIN_DIR="\"/usr/lib/rtpengine\""
#CFLAGS+= -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE #CFLAGS+= -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE

@ -986,7 +986,7 @@ retry:
xmlrpc_env_init(&e); xmlrpc_env_init(&e);
xmlrpc_client_setup_global_const(&e); xmlrpc_client_setup_global_const(&e);
xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-rtpengine", MEDIAPROXY_VERSION, xmlrpc_client_create(&e, XMLRPC_CLIENT_NO_FLAGS, "ngcp-rtpengine", RTPENGINE_VERSION,
NULL, 0, &c); NULL, 0, &c);
if (e.fault_occurred) if (e.fault_occurred)
goto fault; goto fault;

@ -123,7 +123,7 @@ static int control_stream_parse(struct control_stream *s, char *line) {
else if (!strcmp(out[RE_TCP_DIV_CMD], "status")) else if (!strcmp(out[RE_TCP_DIV_CMD], "status"))
calls_status_tcp(c->callmaster, s); calls_status_tcp(c->callmaster, s);
else if (!strcmp(out[RE_TCP_DIV_CMD], "build") | !strcmp(out[RE_TCP_DIV_CMD], "version")) else if (!strcmp(out[RE_TCP_DIV_CMD], "build") | !strcmp(out[RE_TCP_DIV_CMD], "version"))
control_stream_printf(s, "Version: %s\n", MEDIAPROXY_VERSION); control_stream_printf(s, "Version: %s\n", RTPENGINE_VERSION);
else if (!strcmp(out[RE_TCP_DIV_CMD], "controls")) else if (!strcmp(out[RE_TCP_DIV_CMD], "controls"))
control_list(c, s); control_list(c, s);
else if (!strcmp(out[RE_TCP_DIV_CMD], "quit") || !strcmp(out[RE_TCP_DIV_CMD], "exit")) else if (!strcmp(out[RE_TCP_DIV_CMD], "quit") || !strcmp(out[RE_TCP_DIV_CMD], "exit"))

@ -274,7 +274,7 @@ static void options(int *argc, char ***argv) {
die("Bad command line: %s\n", er->message); die("Bad command line: %s\n", er->message);
if (version) if (version)
die("%s\n", MEDIAPROXY_VERSION); die("%s\n", RTPENGINE_VERSION);
if (!ipv4s) if (!ipv4s)
die("Missing option --ip\n"); die("Missing option --ip\n");
@ -549,7 +549,7 @@ int main(int argc, char **argv) {
options(&argc, &argv); options(&argc, &argv);
create_everything(&ctx); create_everything(&ctx);
ilog(LOG_INFO, "Startup complete, version %s", MEDIAPROXY_VERSION); ilog(LOG_INFO, "Startup complete, version %s", RTPENGINE_VERSION);
thread_create_detach(sighandler, NULL); thread_create_detach(sighandler, NULL);
thread_create_detach(timer_loop, ctx.p); thread_create_detach(timer_loop, ctx.p);
@ -565,7 +565,7 @@ int main(int argc, char **argv) {
threads_join_all(1); threads_join_all(1);
ilog(LOG_INFO, "Version %s shutting down", MEDIAPROXY_VERSION); ilog(LOG_INFO, "Version %s shutting down", RTPENGINE_VERSION);
return 0; return 0;
} }

Loading…
Cancel
Save