From 6b6581fbf5cb12cb8a71de9cc05c3afdb4afdd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Fri, 27 Feb 2009 19:22:01 -0800 Subject: [PATCH] Add git describe to VERSION when running from a git clone --- Changes | 2 ++ lib/Qpsmtpd.pm | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index d7ab406..6d68bf5 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,8 @@ Add connection_time plugin + Add git information to version number when running from a git clone + Add rcpt_regexp plugin (Hanno Hecker) Add notes method to Qpsmtpd::Address objects (Jared Johnson) diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index b386616..a19e264 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -9,6 +9,14 @@ use Qpsmtpd::Constants; $VERSION = "0.80"; +my $git; + +if (-e ".git") { + local $ENV{PATH} = "/usr/bin:/usr/local/bin:/opt/local/bin/"; + $git = `git describe`; + $git && chomp $git; +} + my $hooks = {}; my %defaults = ( me => hostname, @@ -41,7 +49,7 @@ sub DESTROY { #warn $_ for DashProfiler->profile_as_text("qpsmtpd"); } -sub version { $VERSION }; +sub version { $VERSION . ($git ? "/$git" : "") }; sub TRACE_LEVEL { $TraceLevel }; # leave for plugin compatibility