mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-25 01:22:47 +00:00
4d331005f7
git-svn-id: http://svn.osgeo.org/postgis/trunk@9123 b70326c6-7e19-0410-871a-916f4a2858ee
40 lines
803 B
Perl
40 lines
803 B
Perl
#!/usr/bin/perl
|
|
|
|
$ENV{"LC_ALL"} = "C";
|
|
|
|
use Cwd;
|
|
my $cwd = &Cwd::cwd();
|
|
my $svn_exe = `which svn`;
|
|
my $rev = 0;
|
|
|
|
# We have a repo and can read from it
|
|
if ( $svn_exe && -d ".svn" ) {
|
|
my $svn_info;
|
|
$svn_info = `svn info`;
|
|
|
|
if ( $svn_info =~ /Last Changed Rev: (\d+)/ ) {
|
|
$rev = $1;
|
|
open(OUT,">$cwd/svnrevision.h");
|
|
print OUT "#define SVNREV $rev\n";
|
|
close(OUT);
|
|
}
|
|
else {
|
|
die "Unable to find revision in svn info\n";
|
|
}
|
|
}
|
|
# No repo, but there's a version file in the tarball
|
|
elsif ( -f "svnrevision.h" ) {
|
|
my $svn_revision_file = `cat svnrevision.h`;
|
|
if ( $svn_revision_file =~ /SVNREV (\d+)/ ) {
|
|
$rev = $1;
|
|
}
|
|
else {
|
|
die "svnrevision.h has an unexpected format\n";
|
|
}
|
|
}
|
|
else {
|
|
die "Unable read svnrevision.h or svn repository metadata\n";
|
|
}
|
|
|
|
print $rev;
|