aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--antispam-plugin.c2
-rwxr-xr-xgit-version.sh12
-rwxr-xr-xversion.sh21
4 files changed, 24 insertions, 15 deletions
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