aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-10-01 11:32:25 +0000
committerThierry Vignaud <tv@mandriva.org>2009-10-01 11:32:25 +0000
commitdb3b6f3c6fc75f5d3de3e37901602b5ec1c70226 (patch)
tree2302e18efb89cbd6230e154047b7acde6f15b3de
parentfcf29f4a401c46e6e5ac063a69819bf7d6d24ea3 (diff)
downloadrpmdrake-db3b6f3c6fc75f5d3de3e37901602b5ec1c70226.tar
rpmdrake-db3b6f3c6fc75f5d3de3e37901602b5ec1c70226.tar.gz
rpmdrake-db3b6f3c6fc75f5d3de3e37901602b5ec1c70226.tar.bz2
rpmdrake-db3b6f3c6fc75f5d3de3e37901602b5ec1c70226.tar.xz
rpmdrake-db3b6f3c6fc75f5d3de3e37901602b5ec1c70226.zip
(do_search) enable to search in full or short package names (#46473)
-rw-r--r--NEWS1
-rwxr-xr-xrpmdrake16
-rw-r--r--rpmdrake.pm4
3 files changed, 18 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 34ff5d8a..09478e47 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
o search
* default to OR like searches for searches among package names (#37643)
* enable to disable use of regular expression (default is: disabled)
+ * enable to search in full or short package names (#46473)
Version 5.17 - 1 June 2009, Thierry Vignaud
diff --git a/rpmdrake b/rpmdrake
index 5bd4e1de..09094b54 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -76,7 +76,14 @@ sub do_search($$$$$$$) {
if ($current_search_type eq 'normal') {
my $count;
foreach (@filtered_pkgs) {
- next if first(split_fullname($_)) !~ /$entry_rx/;
+ if ($NVR_searches->[0]) {
+ next if !/$entry_rx/;
+ } else {
+ if (/^([^-]*)-/) {
+ my $name = $1;
+ next if /^(.*)-/ and $name !~ /$entry_rx/;
+ }
+ }
push @search_results, $_;
# FIXME: should be done for all research types
last if $count++ > 2000;
@@ -528,6 +535,7 @@ sub run_treeview_dialog {
my $auto_string = N("/_Options") . N("/_Select dependencies without asking");
my $noclean_string = N("/_Options") . "/" . N("Clear download cache after successfull install");
my $updates_string = N("/_Options") . N("/_Compute updates on startup");
+ my $NVR_string = N("/_Options") . "/" . N("Search in _full package names");
my $regexp_search_string = N("/_Options") . "/" . N("Use _regular expressions in searches");
my ($menu, $factory) = create_factory_menu(
$w->{real_window},
@@ -576,6 +584,9 @@ sub run_treeview_dialog {
[ $updates_string, undef, sub {
$compute_updates->[0] = $check_boxes{$updates_string}->get_active;
}, undef, '<CheckItem>' ],
+ [ $NVR_string, undef, sub {
+ $NVR_searches->[0] = $check_boxes{$NVR_string}->get_active;
+ }, undef, '<CheckItem>' ],
[ $regexp_search_string, undef, sub {
$use_regexp->[0] = $check_boxes{$regexp_search_string}->get_active;
}, undef, '<CheckItem>' ],
@@ -628,8 +639,9 @@ sub run_treeview_dialog {
%check_boxes = map {
$_ => $factory->get_widget("<main>" . $get_path->($_));
- } ($auto_string, $noclean_string, $updates_string, $regexp_search_string);
+ } ($auto_string, $noclean_string, $NVR_string, $updates_string, $regexp_search_string);
$check_boxes{$regexp_search_string}->set_active($use_regexp->[0]);
+ $check_boxes{$NVR_string}->set_active($NVR_searches->[0]);
if (!$>) {
$check_boxes{$auto_string}->set_active($::rpmdrake_options{auto});
$check_boxes{$updates_string}->set_active($compute_updates->[0]);
diff --git a/rpmdrake.pm b/rpmdrake.pm
index d8177885..dd4a30a7 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -55,6 +55,7 @@ our @EXPORT = qw(
$mandrivaupdate_width
$max_info_in_descr
$mode
+ $NVR_searches
$offered_to_add_sources
$rpmdrake_height
$rpmdrake_width
@@ -159,7 +160,7 @@ $ENV{HOME} = $> == 0 ? $root->[7] : $ENV{HOME} || '/root';
$ENV{HOME} = $::env if $::env = $Rpmdrake::init::rpmdrake_options{env}[0];
our $configfile = "$ENV{HOME}/.rpmdrake";
-our ($changelog_first_config, $compute_updates, $filter, $max_info_in_descr, $mode, $tree_flat, $tree_mode, $use_regexp);
+our ($changelog_first_config, $compute_updates, $filter, $max_info_in_descr, $mode, $NVR_searches, $tree_flat, $tree_mode, $use_regexp);
our ($mandrakeupdate_wanted_categories, $ignore_debug_media, $offered_to_add_sources, $no_confirmation);
our ($rpmdrake_height, $rpmdrake_width, $mandrivaupdate_height, $mandrivaupdate_width);
our %config = (
@@ -173,6 +174,7 @@ our %config = (
mandrivaupdate_width => { var => \$mandrivaupdate_width, default => [ 0 ] },
max_info_in_descr => { var => \$max_info_in_descr, default => [] },
mode => { var => \$mode, default => [ 'by_group' ] },
+ NVR_searches => { var => \$NVR_searches, default => [ 0 ] },
'no-confirmation' => { var => \$no_confirmation, default => [ 0 ] },
offered_to_add_sources => { var => \$offered_to_add_sources, default => [ 0 ] },
rpmdrake_height => { var => \$rpmdrake_height, default => [ 0 ] },