Skip to content

Commit

Permalink
Better version number building using git rev as a build number
Browse files Browse the repository at this point in the history
  • Loading branch information
seangeo committed Jun 10, 2010
1 parent 506b051 commit 1f6cfd8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
1 change: 0 additions & 1 deletion config/deploy.rb
Expand Up @@ -45,7 +45,6 @@ def dirname

desc "Package the latest version"
task :package do
system("rm -f src/git_revision.h")
system("make dist")
end

Expand Down
3 changes: 2 additions & 1 deletion configure.ac
@@ -1,4 +1,5 @@
AC_INIT([classifier], [1.8.3], [info@peerworks.org])
m4_include([m4/version.m4])
AC_INIT([classifier], VERSION_NUMBER, [info@peerworks.org])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_LIBOBJ_DIR(src)
Expand Down
3 changes: 3 additions & 0 deletions m4/version.m4
@@ -0,0 +1,3 @@
m4_define([REVISION], esyscmd([git rev-parse --short HEAD | tr -d '\n']))
m4_define([BASE_VERSION], [1.8.3])
m4_define([VERSION_NUMBER], BASE_VERSION.REVISION)
11 changes: 3 additions & 8 deletions src/Makefile.am
Expand Up @@ -27,7 +27,6 @@ libclassifier_la_SOURCES = classifier.c classifier.h \
item_cache.c \
item_cache.h \
uuid.h \
git_revision.h \
xml.c xml.h \
tagger.c tagger.h tagger_cache.c tagging.c tag_index.c \
array.h array.c \
Expand All @@ -39,14 +38,12 @@ libclassifier_la_SOURCES = classifier.c classifier.h \
tokenizer.h tokenizer.c

libclassifier_la_LIBADD = @LTLIBOBJS@

BUILT_SOURCES=git_revision.h
CLEANFILES=git_revision.h

bin_PROGRAMS = classifier classify
classifier_SOURCES = git_revision.h main.c
classifier_SOURCES = main.c
classifier_LDADD = libclassifier.la

classify_SOURCES = git_revision.h classify.c
classify_SOURCES =classify.c
classify_LDADD = libclassifier.la

#cls_bench_SOURCES = bench.c
Expand All @@ -60,7 +57,5 @@ endif

# noinst_PROGRAMS = cls_bench

git_revision.h:
echo "static const char *git_revision = \"`git rev-parse --short HEAD`\";" > git_revision.h


3 changes: 1 addition & 2 deletions src/classify.c
Expand Up @@ -15,7 +15,6 @@
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include "git_revision.h"
#include "logging.h"
#include "classification_engine.h"
#include "httpd.h"
Expand Down Expand Up @@ -113,7 +112,7 @@ int main(int argc, char ** argv) {
print_help();
return EXIT_SUCCESS;
case 'v':
printf("%s, build: %s\n", PACKAGE_STRING, git_revision);
printf("%s\n", PACKAGE_STRING);
return EXIT_SUCCESS;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/httpd.c
Expand Up @@ -32,7 +32,6 @@
#include "tagger.h"
#include "logging.h"
#include "misc.h"
#include "git_revision.h"
#define _bits_h_
#include <json/json.h>

Expand Down Expand Up @@ -164,7 +163,6 @@ static xmlChar * xml_for_about(void) {
xmlDocSetRootElement(doc, root);

add_element(root, "version", "string", "%s", PACKAGE_VERSION);
add_element(root, "git_revision", "string", "%s", git_revision);

xmlDocDumpFormatMemory(doc, &buffer, &buffersize, 1);
xmlFreeDoc(doc);
Expand Down
3 changes: 1 addition & 2 deletions src/main.c
Expand Up @@ -22,7 +22,6 @@
#include "classification_engine.h"
#include "httpd.h"
#include "misc.h"
#include "git_revision.h"
#include "fetch_url.h"
#include "xml_error_functions.h"

Expand Down Expand Up @@ -350,7 +349,7 @@ int main(int argc, char **argv) {
printHelp();
exit(0);
case 'v':
printf("%s, build: %s\n", PACKAGE_STRING, git_revision);
printf("%s\n", PACKAGE_STRING);
exit(EXIT_SUCCESS);
break;
default:
Expand Down

0 comments on commit 1f6cfd8

Please sign in to comment.