From c914958cc60d4977238bb1f4df20d8ca737a3bbf Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 11 Jul 2010 04:44:23 +0000 Subject: tlmgrgui: save desc and file lists at init time so that match/search is faster and does not have to get the file lists and desc every time git-svn-id: svn://tug.org/texlive/trunk@19369 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgrgui.pl | 44 ++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl index 301001ed394..c4aacdad53a 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui.pl @@ -704,7 +704,7 @@ sub show_extended_info { if ($do_arch) { my @archs = $localtlpdb->available_architectures; @arch_deps = map { "$p.$_"; } @archs; - add_filelist_text($p, __("Binaries' dependencies:"), @arch_deps); + add_filelist_text($p, __("Binaries' dependencies:"), sort(@arch_deps)); } add_filelist_text($p, __("Runfiles:"), $tlp->runfiles); add_filelist_text($p, __("Docfiles:"), $tlp->docfiles); @@ -852,24 +852,14 @@ sub MatchesFilters { my $r = $match_entry->get; # check first for the default search type, the descriptions if ($match_descriptions) { - # normal case, match descriptions - my $t = $Packages{$p}{'tlp'}->shortdesc; - $t |= ""; - my $lt = $Packages{$p}{'tlp'}->longdesc; - $lt |= ""; - if (($p =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { + if ($Packages{$p}{'match_desc'} =~ m/$r/) { $found = 1; } } # if we already dound, don't check the next condition! if (!$found) { if ($match_filenames) { - my @files = $Packages{$p}{'tlp'}->all_files; - if ($Packages{$p}{'tlp'}->relocated) { - for (@files) { s:^$RelocPrefix/:$RelocTree/:; } - } - my @ret = grep(m;$r;, @files); - if (@ret) { + if ($Packages{$p}{'match_files'} =~ m/$r/) { $found = 1; } } @@ -1619,6 +1609,13 @@ sub setup_list { $Packages{$p}{'selected'} = 0; delete($Packages{$p}{'tlp'}) if defined($Packages{$p}{'tlp'}); $Packages{$p}{'tlp'} = $tlp; + $Packages{$p}{'match_desc'} = "$p\n"; + $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); + $Packages{$p}{'match_desc'} .= "\n"; + $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); + my @all_f = $tlp->all_files; + if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } + $Packages{$p}{'match_files'} = "@all_f"; $Packages{$p}{'cb'}->destroy() if defined($Packages{$p}{'cb'}); $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}); if (($tlp->category eq "Collection") || @@ -1642,6 +1639,13 @@ sub setup_list { $Packages{$p}{'installed'} = 1; $Packages{$p}{'selected'} = 0; $Packages{$p}{'tlp'} = $tlp; + $Packages{$p}{'match_desc'} = "$p\n"; + $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); + $Packages{$p}{'match_desc'} .= "\n"; + $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); + my @all_f = $tlp->all_files; + if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } + $Packages{$p}{'match_files'} = "@all_f"; $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}); if (($tlp->category eq "Collection") || ($tlp->category eq "Scheme")) { @@ -1684,6 +1688,13 @@ sub update_list_remote { if (!defined($Packages{$p}{'tlp'})) { $Packages{$p}{'tlp'} = $tlp; } + $Packages{$p}{'match_desc'} = "\n$p\n"; + $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); + $Packages{$p}{'match_desc'} .= "\n"; + $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); + my @all_f = $tlp->all_files; + if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } + $Packages{$p}{'match_files'} = "@all_f"; ## delete($Packages{$p}{'tlp'}) if defined($Packages{$p}{'tlp'}); ## $Packages{$p}{'tlp'} = $tlp; $Packages{$p}{'selected'} = 0 @@ -1712,6 +1723,13 @@ sub update_list_remote { if (!defined($Packages{$p}{'tlp'})) { $Packages{$p}{'tlp'} = $tlp; } + $Packages{$p}{'match_desc'} = "\n$p\n"; + $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); + $Packages{$p}{'match_desc'} .= "\n"; + $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); + my @all_f = $tlp->all_files; + if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } + $Packages{$p}{'match_files'} = "@all_f"; ## disabled, the file lists in remote tlpd contain RELOC ## $Packages{$p}{'tlp'} = $tlp; $Packages{$p}{'selected'} = 0 -- cgit v1.2.3