Commit 44a612de authored by Steve McIntyre's avatar Steve McIntyre

Fix up more scripts to use Local::VCS

Rather than parsing CVS/Entries directly, use our portable
infrastructure.

romanian/whatsnew.pl looks obsolete, so disabled it

CVS version numbers

danish/security/copyadvisory.pl: 1.13 -> 1.14 
french/security/dsa-translator.pl: 1.58 -> 1.59 
german/security/copyadvisory.pl: 1.15 -> 1.16 
german/vote/copyvote.pl: 1.24 -> 1.25 
romanian/whatsnew.pl: 1.3 -> 1.4 
russian/security/copyadvisory.pl: 1.3 -> 1.4 
swedish/News/weekly/copyissue.pl: 1.24 -> 1.25 
swedish/security/copyadvisory.pl: 1.101 -> 1.102
parent afdb2973
......@@ -13,6 +13,10 @@
# Get command line
$number = $ARGV[0];
use FindBin;
use lib "$FindBin::Bin/../../Perl";
use Local::VCS;
# Check usage.
unless ($number)
{
......@@ -36,7 +40,6 @@ $srcdir = "../../english/security/$year";
die "Unable to locate English version of advisory $number.\n"
if ! -d $srcdir;
$srcfile= "$srcdir/$number.wml";
$cvsfile= "$srcdir/CVS/Entries";
$dstdir = "./$year";
$dstfile= "$dstdir/$number.wml";
......@@ -45,33 +48,21 @@ die "File $srcfile does not exist\n" unless -e $srcfile;
die "File $dstfile already exists\n" if -e $dstfile;
mkdir $dstdir, 0755 unless -d $dstdir;
# Open the files
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
die "Could not get revision number - bug in script?\n";
}
# Open the files
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
# Retrieve the CVS version number
while (<CVS>)
{
if (m[^/$number\.wml/([0-9]*\.[0-9]*)/]o)
{
$revision = $1;
}
}
close CVS;
unless ($revision)
{
print "Could not get revision number - bug in script?\n";
$revision = '1.1';
}
# Insert the revision number
print DST qq'#use wml::debian::translation-check translation="$revision" mindelta="1"\n';
......@@ -173,7 +164,7 @@ while (<SRC>)
s/\(sid\)/(sid)/;
s/Refer to Debian (<.*>)?bug #([0-9]+)</Se Debians $1fejl nummer $2</;
s/\<p\>For the detailed security status of (.*) please refer to/<p>For detaljeret sikkerhedsstatus vedrørende $1, /;
s/its security tracker page at\:/se dens sikkerhedssporingsside på\: /;
s/its security tracker page at\:/se dens sikkerhedssporingsside på\: /;
print DST $_;
}
......
......@@ -7,7 +7,7 @@
# Todo
# - Make a regexp that is enough generic to catch lines like that to be able to use $translation for theses lines instead of s//// '<p>For the <distrib_release> distribution (<distrib_name>) this problem has been fixed in version <version>.</p>' =>
# - Split translation of "For the ... distribution" and "this problem" in 2 part ?? Not yet sure that it's a good idea even if it would reduce number of s///
# - Take DSA from URL (https://cvs.debian.org/*checkout*/webwml/english/security/<YEAR>/dsa-<ID>.wml)
# - Take DSA directly from the from the website repository
# or from local copy. use -Y for year and -n for dsa numner, assume -Y as current year if not provided.
# Check for ../../english/security/<YEAR>/dsa-<ID>.wml if not found, download it
# - Save translated DSA instead of print to STDOUT. As to be saved in <YEAR>/dsa-<ID>.wml
......
......@@ -13,6 +13,10 @@
# Get command line
$number = $ARGV[0];
use FindBin;
use lib "$FindBin::Bin/../../Perl";
use Local::VCS;
# Check usage.
unless ($number)
{
......@@ -36,7 +40,6 @@ $srcdir = "../../english/security/$year";
die "Unable to locate English version of advisory $number.\n"
if ! -d $srcdir;
$srcfile= "$srcdir/$number.wml";
$cvsfile= "$srcdir/CVS/Entries";
$dstdir = "./$year";
$dstfile= "$dstdir/$number.wml";
......@@ -45,33 +48,21 @@ die "File $srcfile does not exist\n" unless -e $srcfile;
die "File $dstfile already exists\n" if -e $dstfile;
mkdir $dstdir, 0755 unless -d $dstdir;
# Open the files
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
die "Could not get revision number - bug in script?\n";
}
# Open the files
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
# Retrieve the CVS version number
while (<CVS>)
{
if (m[^/$number\.wml/([0-9]*\.[0-9]*)/]o)
{
$revision = $1;
}
}
close CVS;
unless ($revision)
{
print "Could not get revision number - bug in script?\n";
$revision = '1.1';
}
# Copy the file
while (<SRC>)
{
......
......@@ -14,6 +14,9 @@
use Date::Manip;
use Encode 'decode_utf8';
use FindBin;
use lib "$FindBin::Bin/../../Perl";
use Local::VCS;
# Get command line
$number = $ARGV[0];
......@@ -94,7 +97,6 @@ foreach $vf (@vfiles)
# Create needed file and directory names
$srcfile= "$srcdir/$vf";
$cvsfile= "$srcdir/CVS/Entries";
$dstdir = "./$year";
$dstfile= "$dstdir/$vf";
......@@ -103,43 +105,24 @@ die "File $srcfile does not exist\n" unless -e $srcfile;
die "File $dstfile already exists\n" if -e $dstfile;
mkdir $dstdir, 0755 unless -d $dstdir;
# Open the files
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
die "Could not get revision number - bug in script?\n";
}
# Open the files
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
# Retrieve the CVS version number
$revision="";
while (<CVS>)
{
#print "$_ :: $vf\n";
#if (m[^/$number\.wml/([0-9]*\.[0-9]*)/]o)
if (m(^/$vf/([0-9]*\.[0-9]*)/))
{
$revision = $1;
# print "Found $revision\n";
}
}
close CVS;
unless ($revision)
{
print "Could not get revision number for $vf - bug in script?\n";
$revision = '1.1';
}
# Insert the revision number
print DST qq'#use wml::debian::acronyms\n';
print DST qq'#use wml::debian::translation-check translation="$revision"\n';
print DST qq'# \$I'; # Too fool CVS
print DST qq'd: $vf,v 1.1 $year/11/02 21:15:10 jseidel Exp \$\n';
print DST qq'# Translator: $TRANSLATOR <$EMAIL> $dheute\n\n';
......
......@@ -17,6 +17,8 @@ $odir = "english";
$tdir = "romanian";
$nodir = "nodir";
die "Unsupported since the move to git\n";
&usage;
if ($ARGV[0]) { $rdir = $ARGV[0]; };
......
......@@ -13,6 +13,10 @@
# Get command line
$number = $ARGV[0];
use FindBin;
use lib "$FindBin::Bin/../../Perl";
use Local::VCS;
# Check usage.
unless ($number)
{
......@@ -36,7 +40,6 @@ $srcdir = "../../english/security/$year";
die "Unable to locate English version of advisory $number.\n"
if ! -d $srcdir;
$srcfile= "$srcdir/$number.wml";
$cvsfile= "$srcdir/CVS/Entries";
$dstdir = "./$year";
$dstfile= "$dstdir/$number.wml";
......@@ -45,33 +48,21 @@ die "File $srcfile does not exist\n" unless -e $srcfile;
die "File $dstfile already exists\n" if -e $dstfile;
mkdir $dstdir, 0755 unless -d $dstdir;
# Open the files
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
die "Could not get revision number - bug in script?\n";
}
# Open the files
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
# Retrieve the CVS version number
while (<CVS>)
{
if (m[^/$number\.wml/([0-9]*\.[0-9]*)/]o)
{
$revision = $1;
}
}
close CVS;
unless ($revision)
{
print "Could not get revision number - bug in script?\n";
$revision = '1.1';
}
# Insert the revision number
print DST qq'#use wml::debian::translation-check translation="$revision" mindelta="1"\n';
......
......@@ -14,6 +14,9 @@
# Externals
use Getopt::Std;
use vars qw($opt_s);
use FindBin;
use lib "$FindBin::Bin/../../../Perl";
use Local::VCS;
# Get command line
if (getopts('s:'))
......@@ -34,7 +37,6 @@ unless ($year && $issue)
$srcdir = "../../../english/News/weekly/$year/$issue";
$srcfile= "$srcdir/index.wml";
$srcfile= $opt_s if $opt_s;
$cvsfile= "$srcdir/CVS/Entries";
$yeardir= "./$year";
$dstdir = "./$year/$issue";
$dstfile= "$dstdir/index.wml";
......@@ -46,25 +48,12 @@ die "File $dstfile already exists\n" if -e $dstfile;
mkdir $yeardir, 0755 unless -d $yeardir;
mkdir $dstdir, 0755 unless -d $dstdir;
# Retrieve the CVS version number
if ($opt_s)
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
$revision = '1.0';
}
else
{
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
while (<CVS>)
{
if (m[^/index\.wml/([0-9]*\.[0-9]*)/]o)
{
$revision = $1;
}
}
close CVS;
die "Could not get revision number - bug in script?\n";
}
# Open the files
......@@ -74,12 +63,6 @@ open SRC, $srcfile
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
unless ($revision)
{
print "Could not get revision number\n";
$revision = '1.1';
}
# Copy the file, translate date and some other stuff, and insert the
# revision number
$insertedrevision = 0;
......
......@@ -13,6 +13,10 @@
# Get command line
$number = $ARGV[0];
use FindBin;
use lib "$FindBin::Bin/../../Perl";
use Local::VCS;
# Check usage.
unless ($number)
{
......@@ -36,7 +40,6 @@ $srcdir = "../../english/security/$year";
die "Unable to locate English version of advisory $number.\n"
if ! -d $srcdir;
$srcfile= "$srcdir/$number.wml";
$cvsfile= "$srcdir/CVS/Entries";
$dstdir = "./$year";
$dstfile= "$dstdir/$number.wml";
......@@ -45,33 +48,21 @@ die "File $srcfile does not exist\n" unless -e $srcfile;
die "File $dstfile already exists\n" if -e $dstfile;
mkdir $dstdir, 0755 unless -d $dstdir;
# Open the files
open CVS, $cvsfile
or die "Could not read $cvsfile ($!)\n";
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($srcfile);
$revision = $file_info{'cmt_rev'};
unless ($revision)
{
die "Could not get revision number - bug in script?\n";
}
# Open the files
open SRC, $srcfile
or die "Could not read $srcfile ($!)\n";
open DST, ">$dstfile"
or die "Could not create $dstfile ($!)\n";
# Retrieve the CVS version number
while (<CVS>)
{
if (m[^/$number\.wml/([0-9]*\.[0-9]*)/]o)
{
$revision = $1;
}
}
close CVS;
unless ($revision)
{
print "Could not get revision number - bug in script?\n";
$revision = '1.1';
}
# Insert the revision number
print DST qq'#use wml::debian::translation-check translation="$revision" mindelta="1"\n';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment