Author: geissert
Date: 2017-12-21 12:01:22 +0000 (Thu, 21 Dec 2017)
New Revision: 58778

Modified:
   bin/check-new-issues
Log:
check-new-issues: add -b, to auto process entries


Modified: bin/check-new-issues
===================================================================
--- bin/check-new-issues        2017-12-21 12:00:07 UTC (rev 58777)
+++ bin/check-new-issues        2017-12-21 12:01:22 UTC (rev 58778)
@@ -7,7 +7,7 @@
 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 @@
 -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 @@
        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 @@
 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;


_______________________________________________
Secure-testing-commits mailing list
Secure-testing-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/secure-testing-commits

Reply via email to