From: Jonathan McDowell Date: Thu, 7 Apr 2011 03:17:57 +0000 (-0700) Subject: Add the bzr version number to non release builds X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/fe84894a4052c71965c6a75b013db3dcec23d67d?hp=3e3f47ec2fdbfaf0682d9790a99264a4e60e9bf1 Add the bzr version number to non release builds If we're building from a bzr checkout then include the revision number in the version string we report. --- diff --git a/.bzrignore b/.bzrignore index 70d4591..69bae54 100644 --- a/.bzrignore +++ b/.bzrignore @@ -18,3 +18,4 @@ stripkey tags .depend autom4te.cache +version.h diff --git a/Makefile.in b/Makefile.in index 66a3b5c..49ea2a5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -142,6 +142,7 @@ clean: $(RM) $(PROGS) $(OBJS) Makefile.bak testparse maxpath *.core core \ gpgwww.o add.o lookup.o main.o maxpath.o onak.o sixdegrees \ sixdegrees.o splitkeys.o stripkey.o onak.conf keyd.o \ + version.h \ $(foreach be,@BACKENDS@,keydb_$(be).o) *.so ifeq (x@KEYD@, xyes) $(RM) keyd.o keydb_$(DBTYPE).o @@ -151,7 +152,16 @@ distclean: clean $(RM) -f Makefile .depend config.log config.status config.h $(RM) -r autom4te.cache -.depend: $(SRCS) +version.h: + @echo '#include "config.h"' > version.h + @if [ -e .bzr ]; then \ + echo "#define ONAK_VERSION PACKAGE_VERSION \"+bzr`bzr revno`\"" \ + >> version.h; \ + else \ + echo "#define ONAK_VERSION PACKAGE_VERSION" >> version.h; \ + fi + +.depend: $(SRCS) version.h rm -f .depend $(MAKEDEPEND) $(CFLAGS) $(SRCS) > .depend diff --git a/armor.c b/armor.c index bb0085e..a192f77 100644 --- a/armor.c +++ b/armor.c @@ -9,11 +9,11 @@ #include #include "armor.h" -#include "config.h" #include "keystructs.h" #include "log.h" #include "onak-conf.h" #include "parsekey.h" +#include "version.h" #define ARMOR_WIDTH 64 @@ -323,8 +323,8 @@ int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count, */ putchar_func(ctx, sizeof("-----BEGIN PGP PUBLIC KEY BLOCK-----\n") - 1, (unsigned char *) "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"); - putchar_func(ctx, sizeof("Version: onak " PACKAGE_VERSION "\n\n") - 1, - (unsigned char *) "Version: onak " PACKAGE_VERSION "\n\n"); + putchar_func(ctx, sizeof("Version: onak " ONAK_VERSION "\n\n") - 1, + (unsigned char *) "Version: onak " ONAK_VERSION "\n\n"); armor_init(&armor_ctx); armor_ctx.putchar_func = putchar_func; diff --git a/gpgwww.c b/gpgwww.c index 7d90a00..f087123 100644 --- a/gpgwww.c +++ b/gpgwww.c @@ -14,7 +14,6 @@ #include "armor.h" #include "charfuncs.h" #include "cleanup.h" -#include "config.h" #include "getcgi.h" #include "hash.h" #include "keydb.h" @@ -23,6 +22,7 @@ #include "onak-conf.h" #include "parsekey.h" #include "stats.h" +#include "version.h" #define OP_UNKNOWN 0 #define OP_GET 1 @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) if (op != OP_GET) { puts("
"); - puts("Produced by gpgwww " PACKAGE_VERSION ", part of onak. " + puts("Produced by gpgwww " ONAK_VERSION ", part of onak. " "" "Jonathan McDowell"); end_html(); diff --git a/keyd.c b/keyd.c index c2d8349..1a349a6 100644 --- a/keyd.c +++ b/keyd.c @@ -19,7 +19,6 @@ #include #include -#include "config.h" #include "charfuncs.h" #include "cleanup.h" #include "keyd.h" @@ -30,6 +29,7 @@ #include "mem.h" #include "onak-conf.h" #include "parsekey.h" +#include "version.h" void daemonize(void) { @@ -381,7 +381,7 @@ int sock_accept(int fd) static void usage(void) { - puts("keyd " PACKAGE_VERSION " - backend key serving daemon for the " + puts("keyd " ONAK_VERSION " - backend key serving daemon for the " "onak PGP keyserver.\n"); puts("Usage:\n"); puts("\tkeyd [options]\n"); diff --git a/keydctl.c b/keydctl.c index b786fea..96af7d2 100644 --- a/keydctl.c +++ b/keydctl.c @@ -13,9 +13,9 @@ #include #include -#include "config.h" #include "keyd.h" #include "onak-conf.h" +#include "version.h" /* HACK: We need to stop onak-conf.o requiring this. */ void *DBFUNCS = NULL; @@ -147,7 +147,7 @@ static void keyd_status(void) static void usage(void) { - puts("keydctl " PACKAGE_VERSION " - control an onak keyd instance.\n"); + puts("keydctl " ONAK_VERSION " - control an onak keyd instance.\n"); puts("Usage:\n"); puts("\tonak [options] \n"); puts("\tCommands:\n"); diff --git a/lookup.c b/lookup.c index fafef12..9bafcc8 100644 --- a/lookup.c +++ b/lookup.c @@ -17,7 +17,6 @@ #include "charfuncs.h" #include "cleankey.h" #include "cleanup.h" -#include "config.h" #include "getcgi.h" #include "keydb.h" #include "keyindex.h" @@ -26,6 +25,7 @@ #include "onak-conf.h" #include "parsekey.h" #include "photoid.h" +#include "version.h" #define OP_UNKNOWN 0 #define OP_GET 1 @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) } if (!mrhkp) { puts("
"); - puts("Produced by onak " PACKAGE_VERSION + puts("Produced by onak " ONAK_VERSION " by Jonathan McDowell"); end_html(); }