mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-25 01:22:47 +00:00
Change from scripts-based script versions to repository based versions. Should also be more robust? ha ha ha. (#1282)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9123 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
cac26025c5
commit
4d331005f7
|
@ -1,37 +1,39 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
my $debug = 0;
|
$ENV{"LC_ALL"} = "C";
|
||||||
|
|
||||||
my @files = (
|
|
||||||
"postgis.sql.in.c",
|
|
||||||
"geography.sql.in.c",
|
|
||||||
"long_xact.sql.in.c"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
use Cwd;
|
||||||
|
my $cwd = &Cwd::cwd();
|
||||||
|
my $svn_exe = `which svn`;
|
||||||
my $rev = 0;
|
my $rev = 0;
|
||||||
|
|
||||||
foreach $f (@files)
|
# We have a repo and can read from it
|
||||||
{
|
if ( $svn_exe && -d ".svn" ) {
|
||||||
my $file = "./postgis/$f";
|
my $svn_info;
|
||||||
if( -f $file )
|
$svn_info = `svn info`;
|
||||||
{
|
|
||||||
my $r = 0;
|
if ( $svn_info =~ /Last Changed Rev: (\d+)/ ) {
|
||||||
open(F, $file);
|
$rev = $1;
|
||||||
while(<F>)
|
open(OUT,">$cwd/svnrevision.h");
|
||||||
{
|
print OUT "#define SVNREV $rev\n";
|
||||||
$r = $1 if /\$Id: \S+ (\d+) /;
|
close(OUT);
|
||||||
}
|
}
|
||||||
print "$f got revision $r\n" if $debug && $r;
|
else {
|
||||||
$rev = $r if $r > $rev;
|
die "Unable to find revision in svn info\n";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
die "Could not open input file $f\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 "\nMaximum scripts revision: $rev\n\n" if $debug;
|
print $rev;
|
||||||
|
|
||||||
print $rev if ! $debug;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue