Add git describe to VERSION when running from a git clone

This commit is contained in:
Ask Bjørn Hansen 2009-02-27 19:22:01 -08:00
parent d4edf3acc6
commit 6b6581fbf5
2 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,8 @@
Add connection_time plugin Add connection_time plugin
Add git information to version number when running from a git clone
Add rcpt_regexp plugin (Hanno Hecker) Add rcpt_regexp plugin (Hanno Hecker)
Add notes method to Qpsmtpd::Address objects (Jared Johnson) Add notes method to Qpsmtpd::Address objects (Jared Johnson)

View File

@ -9,6 +9,14 @@ use Qpsmtpd::Constants;
$VERSION = "0.80"; $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 $hooks = {};
my %defaults = ( my %defaults = (
me => hostname, me => hostname,
@ -41,7 +49,7 @@ sub DESTROY {
#warn $_ for DashProfiler->profile_as_text("qpsmtpd"); #warn $_ for DashProfiler->profile_as_text("qpsmtpd");
} }
sub version { $VERSION }; sub version { $VERSION . ($git ? "/$git" : "") };
sub TRACE_LEVEL { $TraceLevel }; # leave for plugin compatibility sub TRACE_LEVEL { $TraceLevel }; # leave for plugin compatibility