aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-18 12:47:12 +0200
committerJohannes Berg <johannes@sipsolutions.net>2008-09-18 12:47:12 +0200
commit86ef04eac2ce6b9717a56fcc6786aa67057f8774 (patch)
tree298985f2096f45fc83556bcaa04184489a6333b2
parentc0dd0943168cdcac3efcb0744767eef241a11112 (diff)
downloaddovecot-antispam-86ef04eac2ce6b9717a56fcc6786aa67057f8774.tar.gz
dovecot-antispam-86ef04eac2ce6b9717a56fcc6786aa67057f8774.tar.xz
dovecot-antispam-86ef04eac2ce6b9717a56fcc6786aa67057f8774.zip
make proper version
-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