[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

parse-advisory gets the year wrong



Hey guys - Happy New year!

I have noticed that the parse-advisory.pl script gets the year wrong -
if using the copyadvisory scipt now (1st of Jan 2014) to copy
advisories that were published in 2013 (like dsa-2830) it gets copied
to the 2014 folder under the security folder, instead of the 2013 one.

This is because it uses curyear, which it gets like this:

my $curyear = (localtime())[5] + 1900;

instead of getting the year from the advisory. (simply called
$year in the script).

Suggested patch attached. (I can commit it if you guys find it ok.)

best regards and happy new year!
-- Andreas Rönnquist
mailinglists@gusnan.se
gusnan@gusnan.se
Index: parse-advisory.pl
===================================================================
RCS file: /cvs/webwml/webwml/english/security/parse-advisory.pl,v
retrieving revision 1.87
diff -u -r1.87 parse-advisory.pl
--- parse-advisory.pl	11 Apr 2013 11:11:14 -0000	1.87
+++ parse-advisory.pl	1 Jan 2014 15:02:18 -0000
@@ -199,17 +199,17 @@
 if (defined($package) && $dsa =~ /DSA[- ](\d+)-(\d+)/ ) {
     $dsa_number=$1;
     $dsa_revision=$2;
-    $wml = "$curyear/dsa-$dsa_number.wml";
-    $data = "$curyear/dsa-$dsa_number.data";
+    $wml = "$year/dsa-$dsa_number.wml";
+    $data = "$year/dsa-$dsa_number.data";
     $pagetitle = "DSA-$dsa_number-$dsa_revision $package";
 } else {
     die ("Could not parse advisory filename '$adv'. Must contain Package and DSA number information");
 }
 $data = $wml = "-" if ($debug);
 
-if (!(-d $curyear)){
-  print "directory $curyear does not exist!  Creating $curyear\n";
-  make_path($curyear,{ verbose => 0, mode => 0755 }) or print "Could not create $curyear: $!\n";
+if (!(-d $year)){
+  print "directory $year does not exist!  Creating $year\n";
+  make_path($year,{ verbose => 0, mode => 0755 }) or print "Could not create $year: $!\n";
 }
 
 &make_data;
@@ -253,20 +253,20 @@
 }
 
 sub make_index{
-  return if (-f "$curyear/index.wml");
-  print "$curyear/index.wml does not exist! Creating...";
+  return if (-f "$year/index.wml");
+  print "$year/index.wml does not exist! Creating...";
   my $ldo = '<a href="http://lists.debian.org/';
   my $dsan = 'debian-security-announce';
-  my $index = "<define-tag pagetitle>Security Advisories from $curyear</define-tag>\n";
+  my $index = "<define-tag pagetitle>Security Advisories from $year</define-tag>\n";
   $index .= qq|#use wml::debian::template title="<pagetitle>" GEN_TIME="yes"\n|;
   $index .= qq|#use wml::debian::recent_list\n\n|;
-  $index .= qq|<:= get_recent_list ('.', '0', '\$(ENGLISHDIR)/security/$curyear', '', 'dsa-\\d+' ) :>\n\n|;
+  $index .= qq|<:= get_recent_list ('.', '0', '\$(ENGLISHDIR)/security/$year', '', 'dsa-\\d+' ) :>\n\n|;
   $index .= qq|<p>You can get the latest Debian security advisories by subscribing to our\n|;
   $index .= qq|$ldo$dsan/">\\\n|;
   $index .= qq|<strong>$dsan</strong></a> mailing list.\n|;
   $index .= qq|You can also $ldo$dsan/$dsan-2013/">\\\n|;
   $index .= qq|browse the archives</a> for the list.</p>\n|;
-  open INDEX, ">", "$curyear/index.wml";
+  open INDEX, ">", "$year/index.wml";
   print INDEX $index;
   close INDEX;
   print "done\n";
@@ -274,8 +274,8 @@
 }
 
 sub make_makefile{
-  return if (-f "$curyear/Makefile");
-  print "$curyear/Makefile does not exist! Creating...";
+  return if (-f "$year/Makefile");
+  print "$year/Makefile does not exist! Creating...";
   my $makefile = qq|# If this makefile is not generic enough to support a translation,\n|;
   $makefile .= qq|# please contact debian-www.\n\n|;
   $makefile .= qq|WMLBASE=../..\n|;
@@ -291,7 +291,7 @@
   $makefile .= qq|  \$(ENGLISHSRCDIR)/\$(CUR_DIR)/dsa-[0-9]*.data \\\n|;
   $makefile .= qq|  \$(TEMPLDIR)/template.wml \$(TEMPLDIR)/recent_list.wml \$(GETTEXTDEP)\n|;
   $makefile .= qq|\t\$(WML) \$(<F)\n|;
-  open MAKEFILE, ">", "$curyear/Makefile";
+  open MAKEFILE, ">", "$year/Makefile";
   print MAKEFILE $makefile;
   close MAKEFILE;
   print "done\n";

Attachment: signature.asc
Description: PGP signature


Reply to: