From 22ebb69f47bb7493793df876d7ae4e79f5a8cc30 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 27 Aug 2007 09:38:01 +0000 Subject: (do_search) make parsehdlist only look at what we search in (save 25% of time spent when searching in packages' files) --- rpmdrake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rpmdrake b/rpmdrake index 0fa97352..1f518f1c 100755 --- a/rpmdrake +++ b/rpmdrake @@ -87,18 +87,21 @@ sub do_search($$$$$$$) { eval { require MDV::Packdrakeng; $pack = MDV::Packdrakeng->open(archive => $_, quiet => 1) } ? $pack->{toc_f_count} : 0; } @hdlists ); - open my $sf, 'parsehdlist --fileswinfo --description --summary ' . join(' ', map { "'$_'" } @hdlists) . ' |'; - my ($pkg, $progresscount); + open my $sf, join(' ','parsehdlist', '--name', + if_($current_search_type eq 'files', '--files'), + if_($current_search_type eq 'descriptions', '--description', '--summary'), + map { "'$_'" } @hdlists) . ' |'; + my ($pkg, $progresscount, $found); local $_; while (<$sf>) { $searchstop and last; - if (/^NAME<([^>]+)> VERSION<([^>]+)> RELEASE<([^>]+)> ARCH<([^>]+)>/) { - $pkg = "$1-$2-$3.$4"; + if (my ($pkg) = chomp_(/:name:(.+-[^-]+-[^-]+.[^.-]+)$/)) { $progresscount++; $progresscount <= $total_size and $searchprogress->set_fraction($progresscount/$total_size); $searchw->flush; + exists $pkgs->{$pkg} and $found and push @search_results, $pkg; + undef $found; next; } - $pkg or next; my (undef, $key, $value) = split ':', $_; if ($current_search_type eq 'descriptions') { $key =~ /^summary|description$/ or next; @@ -106,8 +109,7 @@ sub do_search($$$$$$$) { $key eq 'files' or next; } if ($value =~ $entry_rx) { - exists $pkgs->{$pkg} and push @search_results, $pkg; - $pkg = ''; + $found = 1; } } close $sf; -- cgit v1.2.1