[Secure-testing-commits] r1736 - data/DTSA
Joey Hess
joeyh at costa.debian.org
Tue Aug 30 14:33:58 UTC 2005
Author: joeyh
Date: 2005-08-30 14:33:58 +0000 (Tue, 30 Aug 2005)
New Revision: 1736
Removed:
data/DTSA/mkadvisory
Log:
remove, obsolete
Deleted: data/DTSA/mkadvisory
===================================================================
--- data/DTSA/mkadvisory 2005-08-30 13:27:58 UTC (rev 1735)
+++ data/DTSA/mkadvisory 2005-08-30 14:33:58 UTC (rev 1736)
@@ -1,119 +0,0 @@
-#!/usr/bin/perl
-# Generate an advisory using a template.
-use strict;
-use warnings;
-use User::pwent;
-use Date::Format;
-use Term::ReadLine;
-
-my $prefix="DTSA";
-my $advisory=getadvisory();
-
-my %subst;
-my %substchoices=(
- DEBIAN_SPECIFIC => ["no","yes"],
- TYPE => ["local", "remote"],
-);
-my %urgencytorecommendation=(
- high => "strongly recommended",
- medium => "recommended",
- low => "encouraged",
-);
-my $term = Term::ReadLine->new("mkadvisory");
-
-sub getsubst {
- my $in=shift;
- # Use any numer of X's around the left or right side of a
- # variable to pad it to its max width, this will be turned
- # into spaces for alignment.
- my ($lpad, $var, $rpad)=$in=~/(X*)([^X]+)(X*)/;
- $lpad=length($lpad);
- $rpad=length($rpad);
-
- if (! exists $subst{$var}) {
- if ($var eq 'ADVISORY') {
- $subst{$var}=$advisory;
- }
- elsif ($var eq 'WHOAMI') {
- my ($fullname, $office, $workphone, $homephone) =
- split /\s*,\s*/, getpwuid($<)->gecos;
- $subst{$var}=$fullname;
- }
- elsif ($var eq 'DATE') {
- $subst{$var}=time2str("%B %o, %Y", time, "UTC");
- }
- elsif ($var eq 'UPGRADE_RECOMMENDATION') {
- print "Choose from ".join(", ", keys %urgencytorecommendation)."\n";
- while ($subst{URGENCY}=$term->readline("URGENCY: ", 'high')) {
- if (exists $urgencytorecommendation{$subst{URGENCY}}) {
- last;
- }
- }
- $subst{$var}=$urgencytorecommendation{$subst{URGENCY}};
- }
- else {
- if (exists($substchoices{$var})) {
- print "Choose from ".join(", ", @{$substchoices{$var}})."\n";
- $subst{$var}=$term->readline("$var: ", $substchoices{$var}->[0]);
- }
- else {
- $subst{$var}=$term->readline("$var: ");
- }
- }
- }
- my $ret=$subst{$var};
- if ($lpad && length($ret) < length($in) + 4) {
- $ret=(" " x (length($in) + 4 - length($ret))).$ret;
- }
- if ($rpad && length($ret) < length($in) + 4) {
- $ret.=(" " x (length($in) + 4 - length($ret)));
- }
- return $ret;
-}
-
-# Get the advisory number. If a parameter is passed, use that as the
-# number, otherwise, find the next unused one.
-sub getadvisory {
- my $num;
- if (@ARGV) {
- $num=shift;
- }
- else {
- $num=1;
- foreach my $file (glob("$prefix-*")) {
- my ($major, $minor)=$file=~/$prefix-(.*)-(.*)/;
- if ($major >= $num) {
- $num=$major+1;
- }
- }
- $num="$num-1";
- }
- if (-e "$prefix-$num") {
- die "$prefix-$num already exists\n";
- }
- return "$prefix-$num";
-}
-
-print "Creating $advisory ...\n";
-open (OUT, ">$advisory") || die "write $advisory: $!";
-open (TEMPLATE, "template") || die "read template: $!";
-while (<TEMPLATE>) {
- s/__([A-Z_]+)__/getsubst($1)/eg;
- print OUT;
-}
-close TEMPLATE;
-close OUT;
-
-print "Adding to list ...\n";
-open (IN, "list") || die "read list: $!";
-my @list=<IN>;
-close IN;
-open (OUT,">list") || die "write list: $!";
-print OUT "[".time2str("%e %b %Y", time, "UTC")."] $advisory $subst{PACKAGE} - $subst{SHORTDESC}\n";
-print OUT "\t{$subst{CVE}}\n" if length $subst{CVE};
-print OUT "\t- $subst{PACKAGE} $subst{TESTINGVER} ($subst{URGENCY})\n";
-print OUT @list;
-close OUT;
-
-print "Editing $advisory ...\n";
-exec("sensible-editor", $advisory);
More information about the Secure-testing-commits
mailing list