From 1ef961ee2eae029836bc387f45c2dc35f3aa41b2 Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Thu, 21 Dec 2017 12:01:22 +0000 Subject: check-new-issues: add -b, to auto process entries git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@58778 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- bin/check-new-issues | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'bin/check-new-issues') diff --git a/bin/check-new-issues b/bin/check-new-issues index e2a5c693ea..4e0d657357 100755 --- a/bin/check-new-issues +++ b/bin/check-new-issues @@ -7,7 +7,7 @@ use Getopt::Std; use Term::ReadLine; my %opts; -getopts('ln:fhi:t:Tca:e:uUsD', \%opts); +getopts('ln:fhi:t:Tca:e:uUsDb', \%opts); sub print_commands { print <<'EOF'; @@ -58,6 +58,7 @@ OPTIONS: [ -l [-n ] [-f] ] -s : skip automatic apt-cache/apt-file searches, suggest the command to run instead -D : skip the download operations +-b : auto process entries (e.g. NFUs) EOF @@ -221,6 +222,21 @@ if ($opts{l}) { exit 0; } +if ($opts{b}) { + # auto process + foreach my $todo (sort {$b <=> $a} @todos) { + if ($data->{$todo}->{CVE}) { + my $nfu_entry = auto_nfu($todo); + if ($nfu_entry) { + ${$data->{$todo}->{entry}} =~ + s/^\s*TODO: check/\tNOT-FOR-US: $nfu_entry/m ; + next; + } + } + } + save_datafile(); + exit 0; +} my $term = new Term::ReadLine 'check-new-issues'; if ($term->ReadLine() eq 'Term::ReadLine::Stub') { @@ -274,10 +290,13 @@ $attribs->{attempted_completion_function} = \&initial_completion; foreach my $todo (sort {$b <=> $a} @todos) { last unless present_issue($todo); } +save_datafile(); -open(my $fh, ">", $datafile); -print $fh @{$entries}; -close($fh); +sub save_datafile { + open(my $fh, ">", $datafile); + print $fh @{$entries}; + close($fh); +} sub present_issue { my $name = shift; -- cgit v1.2.3