aboutsummaryrefslogtreecommitdiffstats
path: root/copypage.pl
diff options
context:
space:
mode:
authorRhonda D'Vine <alfie>2008-09-24 23:47:13 +0000
committerRhonda D'Vine <alfie>2008-09-24 23:47:13 +0000
commit269e2c57b60adf3a71e49c406205978ebe9ab533 (patch)
tree63d767c4d6136a17901dfd7653831955d975dc01 /copypage.pl
parent26feadf532528d81a31d5ce08e071c3073d266f3 (diff)
abstract VCS file revision extraction, needed for VCS switch
CVS version numbers copypage.pl: 1.27 -> 1.28
Diffstat (limited to 'copypage.pl')
-rwxr-xr-xcopypage.pl30
1 files changed, 10 insertions, 20 deletions
diff --git a/copypage.pl b/copypage.pl
index ee355219cae..0efaf9a8e24 100755
--- a/copypage.pl
+++ b/copypage.pl
@@ -12,7 +12,12 @@
# $Id$
+use FindBin;
+FindBin::again();
+use lib "$FindBin::Bin/Perl";
+
use File::Path;
+use Local::VCS_CVS qw(vcs_file_info);
# Declare variables only used in references to avoid warnings
use vars qw(@iso_8859_2_compat @iso_8859_3_compat @iso_8859_4_compat
@@ -165,8 +170,6 @@ sub copy
my $filename = $srcfile;
$filename =~ s[$srcdir][]; # Pathless filename
- my $cvsfile = "$srcdir/CVS/Entries";# Name of file with CVS revisions
-
my $srcmake = $srcdir . "Makefile"; # Name of source Makefile
my $dstmake = $dstdir . "Makefile"; # Name of destination Makefile
@@ -221,9 +224,6 @@ sub copy
}
# Open the files
- open CVS, $cvsfile
- or die "Could not read $cvsfile ($!)\n";
-
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
@@ -231,21 +231,11 @@ sub copy
or die "Could not create $dstfile ($!)\n";
# Retrieve CVS revision number
- my $revision;
- while (<CVS>)
- {
- if (m[^/$filename/([0-9]*\.[0-9]*)/])
- {
- $revision = $1;
- }
- }
-
- close CVS;
+ my %vcsinfo = vcs_file_info( $srcfile );
- unless ($revision)
+ if ( not %vcsinfo or not exists $vcsinfo{'cmt_rev'} )
{
- print "Could not get revision number - bug in script?\n";
- $revision = '1.1';
+ die "Could not get revision number for `$srcfile' - bug in script?\n";
}
# Copy the file and insert the revision number
@@ -257,7 +247,7 @@ sub copy
unless ($insertedrevision || /^#/)
{
- print DST qq'#use wml::debian::translation-check translation="$revision"';
+ printf DST qq'#use wml::debian::translation-check translation="%s"', $vcsinfo{'cmt_rev'};
print DST qq' maintainer="$maintainer"'
if defined $maintainer;
print DST qq'\n';
@@ -299,7 +289,7 @@ sub copy
unless ($insertedrevision)
{
- print DST qq'#use wml::debian::translation-check translation="$revision"';
+ printf DST qq'#use wml::debian::translation-check translation="%s"', $vcsinfo{'cmt_rev'};
print DST qq' maintainer="$maintainer"'
if defined $maintainer;
print DST qq'\n';

© 2014-2024 Faster IT GmbH | imprint | privacy policy