aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2002-09-04 19:54:17 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2002-09-04 19:54:17 +0000
commit64924399c99d4cfe64739fa1bd990989fe3fc883 (patch)
tree9c416379a0e24093ec3c97137244c6b8762db3e9
parentb8ec40cc12488e83b5c14197b0d28f72512132a9 (diff)
downloadrpmdrake-64924399c99d4cfe64739fa1bd990989fe3fc883.tar
rpmdrake-64924399c99d4cfe64739fa1bd990989fe3fc883.tar.gz
rpmdrake-64924399c99d4cfe64739fa1bd990989fe3fc883.tar.bz2
rpmdrake-64924399c99d4cfe64739fa1bd990989fe3fc883.tar.xz
rpmdrake-64924399c99d4cfe64739fa1bd990989fe3fc883.zip
add "search in files" in rpmdrake-remove
-rwxr-xr-xrpmdrake15
1 files changed, 10 insertions, 5 deletions
diff --git a/rpmdrake b/rpmdrake
index 332f9e1e..f6483a0a 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -133,6 +133,8 @@ sub extract_header {
}
}
+sub db { URPM::DB::open or die 'Couldn\'t open RPM DB' }
+
sub do_search($$$$$$) {
my ($find_entry, $tree, $options, $current_search_type, $urpm, $pkgs) = @_;
my $entry = $find_entry->get_text or return;
@@ -143,7 +145,13 @@ sub do_search($$$$$$) {
my @search_results;
if ($current_search_type ne 'normal') {
if ($MODE eq 'remove') {
- @search_results = map { if_(eval { ($pkgs->{$_}{summary}.$pkgs->{$_}{description}) =~ /$entry/i }, $_) } keys %$pkgs;
+ if ($current_search_type eq 'descriptions') {
+ @search_results = map { if_(eval { ($pkgs->{$_}{summary}.$pkgs->{$_}{description}) =~ /$entry/i }, $_) } keys %$pkgs;
+ } else {
+ slow_func(_("Please wait, searching..."),
+ sub { db->traverse(sub { push @search_results, map { if_(eval { /$entry/i }, my_fullname($_[0])) } $_[0]->files });
+ @search_results = grep { exists $pkgs->{$_} } uniq(@search_results); });
+ }
} else {
my @hdlists = map { my $h = "$urpm->{statedir}/$_->{hdlist}";
if_(!$_->{ignore} && (!($MODE eq 'update') || $_->{update}) && (-r $h), $h) } @{$urpm->{media}};
@@ -199,8 +207,6 @@ sub do_search($$$$$$) {
}
}
-sub db { URPM::DB::open or die 'Couldn\'t open RPM DB' }
-
sub find_installed_version {
my ($p) = @_;
my @version;
@@ -537,8 +543,7 @@ or you already installed all of them."));
}
my $search_types_menu = new Gtk::Menu;
- my @search_types = ([ 'normal', _("in names") ], [ 'descriptions', _("in descriptions") ]);
- $MODE ne 'remove' and push @search_types, [ 'files', _("in files") ];
+ my @search_types = ([ 'normal', _("in names") ], [ 'descriptions', _("in descriptions") ], [ 'files', _("in files") ]);
my $current_search_type = $search_types[0]->[0];
foreach (@search_types) {
my $capt_type = $_->[0];