aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-06-02 10:43:01 +0200
committerJohannes Berg <johannes@sipsolutions.net>2008-06-02 10:43:01 +0200
commit2e009bcb22f479a40f8112f8c8ea8d6a5f17b732 (patch)
tree88951328c1c4df675e19f8f094ee05a7ed172ccc
parentd75a3cf64fc0e7f61533f96371fd99af7d987849 (diff)
downloaddovecot-antispam-2e009bcb22f479a40f8112f8c8ea8d6a5f17b732.tar.gz
dovecot-antispam-2e009bcb22f479a40f8112f8c8ea8d6a5f17b732.tar.xz
dovecot-antispam-2e009bcb22f479a40f8112f8c8ea8d6a5f17b732.zip
add git version to plugin
-rw-r--r--.gitignore1
-rw-r--r--Makefile7
-rw-r--r--antispam-plugin.c4
-rwxr-xr-xgit-version.sh12
4 files changed, 20 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 70e3bf8..b3fb76b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
.config
*~
dovecot-version.h
+antispam-version.h
dovecot-version
*.log
debian/dovecot-antispam-*/
diff --git a/Makefile b/Makefile
index ef03835..edab73e 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ all: verify_config $(LIBRARY_NAME)
antispam-storage.o: antispam-storage.c antispam-storage-*.c $(CONFIG) antispam-plugin.h dovecot-version.h
$(CC) -c $(CFLAGS) $(INCS) -o $@ $<
-%.o: %.c $(CONFIG) antispam-plugin.h dovecot-version.h
+%.o: %.c $(CONFIG) antispam-plugin.h dovecot-version.h antispam-version.h
$(CC) -c $(CFLAGS) $(INCS) -o $@ $<
$(LIBRARY_NAME): $(objs)
@@ -77,8 +77,11 @@ 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
+
clean:
- rm -f *.so *.o *~ dovecot-version dovecot-version.h
+ rm -f *.so *.o *~ dovecot-version dovecot-version.h antispam-version.h
install: all
install -o $(USER) -g $(GROUP) -m 0660 $(LIBRARY_NAME) $(INSTALLDIR)/
diff --git a/antispam-plugin.c b/antispam-plugin.c
index 2e6449d..af594fc 100644
--- a/antispam-plugin.c
+++ b/antispam-plugin.c
@@ -32,7 +32,7 @@
#include "str.h"
#include "client.h"
#include "mail-storage-private.h"
-
+#include "antispam-version.h"
/* defined by imap, pop3, lda */
extern void (*hook_mail_storage_created)(struct mail_storage *storage);
@@ -127,7 +127,7 @@ void PLUGIN_FUNCTION(init)(void)
char * const *iter;
int spam_folder_count = 0;
- debug("plugin initialising\n");
+ debug("plugin initialising (%s)\n", ANTISPAM_GIT_VERSION);
global_pool = pool_alloconly_create("antispam-pool", 1024);
diff --git a/git-version.sh b/git-version.sh
new file mode 100755
index 0000000..204ffec
--- /dev/null
+++ b/git-version.sh
@@ -0,0 +1,12 @@
+#!/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