From 9e9d7677bcebdbbc3c9f66b142311c091188b26b Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 14 Oct 2014 17:09:42 +0100 Subject: [PATCH] use real git version if git is available Conflicts: perl/Version.pm --- perl/Version.pm | 4 ++-- perl/cluster.pl | 18 +++++++++++++++++- perl/issue.pl | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/perl/Version.pm b/perl/Version.pm index de7b071b..8edb59e8 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -10,7 +10,7 @@ package main; use vars qw($version $build $gitversion); $version = '1.57'; -$build = '43'; -$gitversion = '1d33367'; +$build = '44'; +$gitversion = 'b756660[i]'; 1; diff --git a/perl/cluster.pl b/perl/cluster.pl index 70b81f71..1e10eb51 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -438,7 +438,7 @@ if (DXSql::init($dsn)) { $dbh = $dbh->connect($dsn, $dbuser, $dbpass) if $dbh; } -# try to load Encode +# try to load Encode and Git { local $^W = 0; my $w = $SIG{__DIE__}; @@ -448,6 +448,22 @@ if (DXSql::init($dsn)) { import Encode; $can_encode = 1; } + eval { require Git; }; + unless ($@) { + import Git; + + # determine the real version number + my $repo = Git->repository(Directory => "$root/.git"); + if ($repo) { + my $desc = $repo->command_oneline(['describe', '--long'], STDERR => 0); + if ($desc) { + my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/; + $version = $v; + $build = $b || 0; + $gitversion = "$g\[r]"; + } + } + } $SIG{__DIE__} = $w; } diff --git a/perl/issue.pl b/perl/issue.pl index 49bc62fd..41d9fe8b 100755 --- a/perl/issue.pl +++ b/perl/issue.pl @@ -36,7 +36,7 @@ use vars qw(\$version \$build \$gitversion); \$version = '$v'; \$build = '$b'; -\$gitversion = '$g'; +\$gitversion = '$g\[i]'; 1; ); -- 2.43.0