diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-08-27 09:38:01 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-08-27 09:38:01 +0000 |
commit | 22ebb69f47bb7493793df876d7ae4e79f5a8cc30 (patch) | |
tree | 7269de916a21ba62883087ef5261b1a29d6680d0 | |
parent | abebc9447eeda941b2484f6dc116166e3b1d63c5 (diff) | |
download | rpmdrake-22ebb69f47bb7493793df876d7ae4e79f5a8cc30.tar rpmdrake-22ebb69f47bb7493793df876d7ae4e79f5a8cc30.tar.gz rpmdrake-22ebb69f47bb7493793df876d7ae4e79f5a8cc30.tar.bz2 rpmdrake-22ebb69f47bb7493793df876d7ae4e79f5a8cc30.tar.xz rpmdrake-22ebb69f47bb7493793df876d7ae4e79f5a8cc30.zip |
(do_search) make parsehdlist only look at what we search in (save 25%
of time spent when searching in packages' files)
-rwxr-xr-x | rpmdrake | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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; |