diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-02-17 17:22:43 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-02-17 17:22:43 +0000 |
commit | 248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc (patch) | |
tree | e13ba0c3e143f3793e1b71fded273bcdbb7bb88e | |
parent | c2d9450831e9c4e57d17baed6679acc4c3446f78 (diff) | |
download | rpmdrake-248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc.tar rpmdrake-248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc.tar.gz rpmdrake-248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc.tar.bz2 rpmdrake-248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc.tar.xz rpmdrake-248c4c50f3b8aa2bab0b04bd3e27c6121e9af3fc.zip |
(sort_packages,sort_packages_biarch,sort_packages_monoarch) split them out
-rw-r--r-- | Rpmdrake/pkg.pm | 14 | ||||
-rwxr-xr-x | rpmdrake | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 9edccd86..ff37d59d 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -56,13 +56,25 @@ our @EXPORT = qw( get_pkgs perform_installation perform_removal - run_rpm); + run_rpm + sort_packages + ); use mygtk2 qw(gtknew); use ugtk2 qw(:all); our $priority_up_alread_warned; +sub sort_packages_biarch { + my ($x64, $other) = partition { !/86$/ } @_; + (sort { uc($a) cmp uc($b) } @$x64), sort { uc($a) cmp uc($b) } @$other; +} + +sub sort_packages_monoarch { + sort { uc($a) cmp uc($b) } @_; +} + +*sort_packages = arch() =~ /x86_64/ ? \&sort_packages_biarch : \&sort_packages_monoarch; sub run_rpm { foreach (qw(LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL)) { @@ -195,11 +195,7 @@ sub do_search($$$$$$$) { my $iter; if (@search_results) { - my $f = arch() =~ /x86_64/ ? sub { - my ($x64, $other) = partition { !/86$/ } @_; - (sort { uc($a) cmp uc($b) } @$x64), sort { uc($a) cmp uc($b) } @$other; - } : sub { sort { uc($a) cmp uc($b) } @_ }; - @search_results = $f->(@search_results); + @search_results = sort_packages(@search_results); $elems{$results_ok} = [ map { [ $_, $results_ok ] } @search_results ]; $iter = $options->{add_parent}->($results_ok); $options->{add_nodes}->(map { [ $_, $results_ok . ($options->{tree_mode} eq 'by_presence' |