[Secure-testing-commits] r26017 - bin
Raphael Geissert
geissert at moszumanska.debian.org
Sat Mar 8 16:03:09 UTC 2014
Author: geissert
Date: 2014-03-08 16:03:09 +0000 (Sat, 08 Mar 2014)
New Revision: 26017
Modified:
bin/check-new-issues
Log:
Add -s option to skip calls to apt-cache and apt-file
Modified: bin/check-new-issues
===================================================================
--- bin/check-new-issues 2014-03-08 16:01:38 UTC (rev 26016)
+++ bin/check-new-issues 2014-03-08 16:03:09 UTC (rev 26017)
@@ -7,7 +7,7 @@
use Term::ReadLine;
my %opts;
-getopts('ln:fhi:t:Tca:e:uU', \%opts);
+getopts('ln:fhi:t:Tca:e:uUs', \%opts);
sub print_commands {
print <<'EOF';
@@ -52,6 +52,8 @@
-e <file> : use <file> for embedded-code-copies, "-" for STDIN
-a <n> : If automatic apt-cache/apt-file search gives more than n results,
display only the count (default 10)
+-s : skip automatic apt-cache/apt-file searches, suggest the
+ command to run instead
EOF
@@ -364,16 +366,20 @@
$prog = $1;
}
if ($prog) {
- my $prog_esc =$prog;
- $prog_esc =~ tr{a-zA-Z0-9_@/-}{ }cs;
- print "doing apt-cache search...";
- my @ac=`apt-cache search $prog_esc`;
- if (scalar @ac > $auto_display_limit || scalar @ac == 0) {
- print "\r", scalar @ac, " results from apt-cache search $prog_esc\n";
+ unless ($opts{s}) {
+ my $prog_esc =$prog;
+ $prog_esc =~ tr{a-zA-Z0-9_@/-}{ }cs;
+ print "doing apt-cache search...";
+ my @ac=`apt-cache search $prog_esc`;
+ if (scalar @ac > $auto_display_limit || scalar @ac == 0) {
+ print "\r", scalar @ac, " results from apt-cache search $prog_esc\n";
+ }
+ else {
+ print "\r=== apt-cache search $prog_esc:\n", @ac, "===\n";
+ }
+ } else {
+ print "You probably want to .c$prog\n";
}
- else {
- print "\r=== apt-cache search $prog_esc:\n", @ac, "===\n";
- }
foreach my $p (split /\s+/, $prog) {
search_embed($p);
@@ -384,25 +390,29 @@
return;
}
if ( $file =~ /(php3?|asp|cgi|pl)$/ ) {
- if (! exists $afcache{$file}) {
- my $file_esc = quotemeta($file);
- print "doing apt-file search...";
- $afcache{$file}=[`apt-file -i search $file_esc`];
- if (scalar @{$afcache{$file}} > $auto_display_limit) {
- # replace with empty array to save mem
- my $num = scalar @{$afcache{$file}};
- $afcache{$file} = [];
- $afcache{$file}->[$num-1] = undef;
+ unless ($opts{s}) {
+ if (! exists $afcache{$file}) {
+ my $file_esc = quotemeta($file);
+ print "doing apt-file search...";
+ $afcache{$file}=[`apt-file -i search $file_esc`];
+ if (scalar @{$afcache{$file}} > $auto_display_limit) {
+ # replace with empty array to save mem
+ my $num = scalar @{$afcache{$file}};
+ $afcache{$file} = [];
+ $afcache{$file}->[$num-1] = undef;
+ }
}
+ if (scalar @{$afcache{$file}} > $auto_display_limit ||
+ scalar @{$afcache{$file}} == 0) {
+ print "\r", scalar @{$afcache{$file}},
+ " results from apt-file -i search $file\n";
+ }
+ else {
+ print "\r=== apt-file -i search $file:\n", @{$afcache{$file}}, "===\n";
+ }
+ } else {
+ print "You probably want to .f$file\n";
}
- if (scalar @{$afcache{$file}} > $auto_display_limit ||
- scalar @{$afcache{$file}} == 0) {
- print "\r", scalar @{$afcache{$file}},
- " results from apt-file -i search $file\n";
- }
- else {
- print "\r=== apt-file -i search $file:\n", @{$afcache{$file}}, "===\n";
- }
}
}
More information about the Secure-testing-commits
mailing list