Merge pull request #107 from msimerson/version

add --tags to 'git describe'
This commit is contained in:
flimzy 2014-09-17 06:36:39 -05:00
commit 9fdb6b17d6
2 changed files with 13 additions and 12 deletions

View File

@ -1,9 +1,8 @@
package Qpsmtpd;
use strict;
#use warnings;
our $VERSION = "0.95";
our $VERSION = '0.95';
use vars qw($TraceLevel $Spool_dir $Size_threshold);
use lib 'lib';
@ -12,17 +11,9 @@ use Qpsmtpd::Address;
use Qpsmtpd::Config;
use Qpsmtpd::Constants;
my $git;
if (-e ".git") {
local $ENV{PATH} = "/usr/bin:/usr/local/bin:/opt/local/bin/";
$git = `git describe`;
$git && chomp $git;
}
our $hooks = {};
our $LOGGING_LOADED = 0;
my $git = git_version();
sub _restart {
my $self = shift;
@ -41,6 +32,16 @@ sub _restart {
sub version { $VERSION . ($git ? "/$git" : "") }
sub git_version {
return if !-e '.git';
{
local $ENV{PATH} = "/usr/bin:/usr/local/bin:/opt/local/bin/";
$git = `git describe --tags`;
$git && chomp $git;
}
return $git;
}
sub TRACE_LEVEL { $TraceLevel }; # leave for plugin compatibility
sub hooks {

View File

@ -14,7 +14,7 @@ sub get_qp_version {
my $rvfile = get_file_contents('lib/Qpsmtpd.pm')
or return;
my ($ver_line) = grep { $_ =~ /^our \$VERSION/ } @$rvfile;
my ($ver) = $ver_line =~ /"([0-9\.]+)"/;
my ($ver) = $ver_line =~ /['"]([0-9\.]+)['"]/;
return $ver;
};