From 86ef04eac2ce6b9717a56fcc6786aa67057f8774 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 18 Sep 2008 12:47:12 +0200 Subject: make proper version --- Makefile | 4 ++-- antispam-plugin.c | 2 +- git-version.sh | 12 ------------ version.sh | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 15 deletions(-) delete mode 100755 git-version.sh create mode 100755 version.sh diff --git a/Makefile b/Makefile index edab73e..eafec2a 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,8 @@ dovecot-version: dovecot-version.c $(CONFIG) dovecot-version.h: dovecot-version ./dovecot-version > dovecot-version.h -antispam-version.h: git-version.sh - ./git-version.sh > antispam-version.h +antispam-version.h: version.sh + ./version.sh > antispam-version.h clean: rm -f *.so *.o *~ dovecot-version dovecot-version.h antispam-version.h diff --git a/antispam-plugin.c b/antispam-plugin.c index a7a477b..cebbd97 100644 --- a/antispam-plugin.c +++ b/antispam-plugin.c @@ -136,7 +136,7 @@ void PLUGIN_FUNCTION(init)(void) char * const *iter; int spam_folder_count = 0; - debug("plugin initialising (%s)\n", ANTISPAM_GIT_VERSION); + debug("plugin initialising (%s)\n", ANTISPAM_VERSION); global_pool = pool_alloconly_create("antispam-pool", 1024); diff --git a/git-version.sh b/git-version.sh deleted file mode 100755 index 204ffec..0000000 --- a/git-version.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -if head=`git rev-parse --verify HEAD 2>/dev/null`; then - git update-index --refresh --unmerged > /dev/null - printf "#define ANTISPAM_GIT_VERSION \"git %.8s" "$head" - if git diff-index --name-only HEAD | read dummy ; then - printf ", dirty" - fi - echo '"' -else - echo '#define ANTISPAM_GIT_VERSION "unknown"' -fi diff --git a/version.sh b/version.sh new file mode 100755 index 0000000..59341a5 --- /dev/null +++ b/version.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +VERSION=1.0 + +if head=$(git rev-parse --verify HEAD 2>/dev/null); then + git update-index --refresh --unmerged > /dev/null + descr=$(git describe) + + # on git builds check that the version number above + # is correct... + [ "${descr%%-*}" = "v$VERSION" ] || exit 2 + + echo -n '#define ANTISPAM_VERSION "' + echo -n "${descr#v}" + if git diff-index --name-only HEAD | read dummy ; then + echo -n "-dirty" + fi + echo '"' +else + echo '#define ANTISPAM_VERSION "'$VERSION'-notgit"' +fi -- cgit v1.2.3