Author: geissert Date: 2017-10-11 10:59:16 +0000 (Wed, 11 Oct 2017) New Revision: 56605
Modified: bin/check-new-issues Log: add auto wnpp results as readline history entries Modified: bin/check-new-issues =================================================================== --- bin/check-new-issues 2017-10-11 10:11:09 UTC (rev 56604) +++ bin/check-new-issues 2017-10-11 10:59:16 UTC (rev 56605) @@ -396,6 +396,18 @@ } +sub wnpp_to_history { + my $pkg = shift; + + # there might be more than one bug, so only take the first + my ($bugline) = (split /[|]/, $wnpp{$pkg}, 2); + + my ($type, $bug) = split /\s+/, $bugline; + return unless ($type =~ /^(?:RFP|ITP)$/); + + $term->addhistory("- $pkg <itp> (bug #$bug)"); +} + sub auto_nfu { my $name=shift; @@ -445,7 +457,10 @@ foreach my $p (split /\s+/, $prog) { search_embed($p); - search_wnpp(qr<^\Q$p\E$>); + for my $we (search_wnpp($p)) { + print "$we: $wnpp{$we}\n"; + wnpp_to_history($we); + } } } if ( $file =~ /^(?:index|default|login|search|admin)\.(?:php3?|asp|cgi|pl)$/i ) { @@ -568,13 +583,18 @@ sub search_wnpp { my $s = shift; $s = lc $s; - my $found = 0; - foreach my $e (keys %wnpp) { - next unless ($e =~ m/$s/); - print "$e: $wnpp{$e}\n"; - $found = 1; + + my @matches; + @matches = grep(/$s/, sort keys %wnpp); + + if (wantarray) { + return @matches; + } else { + foreach my $e (@matches) { + print "$e: $wnpp{$e}\n"; + } + return (length(@matches) > 0); } - return $found; } sub read_removed_packages_file { _______________________________________________ Secure-testing-commits mailing list Secure-testing-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/secure-testing-commits