diff options
author | Norbert Preining <preining@logic.at> | 2008-05-01 11:09:10 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-01 11:09:10 +0000 |
commit | c546a8b525b0386d05fb203da8fbb82de2effc99 (patch) | |
tree | 4ac6b7c389a4f0e762320fcffdc0bae3c7f5a2cf | |
parent | 355d7f47dc5f2aeed17531d1e859188b1dd7128b (diff) |
allow to search for files
git-svn-id: svn://tug.org/texlive/trunk@7773 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tl-package-manager.pl | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/Master/texmf/scripts/texlive/tl-package-manager.pl b/Master/texmf/scripts/texlive/tl-package-manager.pl index a1b0650d5d3..dbdecbafbc1 100755 --- a/Master/texmf/scripts/texlive/tl-package-manager.pl +++ b/Master/texmf/scripts/texlive/tl-package-manager.pl @@ -48,9 +48,10 @@ use TeXLive::TLMedia; use TeXLive::TLUtils; TeXLive::TLUtils->import( qw(kpsewhich member) ); use Cwd qw/abs_path/; -use Getopt::Long; use Pod::Usage; -$Getopt::Long::autoabbrev=0; +use Getopt::Long qw(:config no_autoabbrev pass_through); +#$Getopt::Long::autoabbrev=0; +#$Getopt::Long::pass_through=1; use strict; @@ -289,6 +290,11 @@ if ($action =~ m/^generate$/i) { my $r = shift; my $ret = ""; my $tlpdb; + my $searchfile = 0; + if ($r =~ m/^-file$/i) { + $searchfile = 1; + $r = shift; + } if ($action =~ m/^globalsearch$/i) { my $tlmediasrc = TeXLive::TLMedia->new($location); $tlpdb = $tlmediasrc->tlpdb; @@ -296,13 +302,23 @@ if ($action =~ m/^generate$/i) { $tlpdb = $localtlpdb; } foreach my $pkg ($tlpdb->list_packages) { - next if ($pkg =~ m/\./); - my $t = $tlpdb->get_package($pkg)->shortdesc; - $t |= ""; - my $lt = $tlpdb->get_package($pkg)->longdesc; - $lt |= ""; - if (($pkg =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { - $ret .= " $pkg - $t\n"; + if ($searchfile) { + my @ret = grep(m;$r;, $tlpdb->get_package($pkg)->all_files); + if (@ret) { + print "$pkg:\n"; + foreach (@ret) { + print "\t$_\n"; + } + } + } else { + next if ($pkg =~ m/\./); + my $t = $tlpdb->get_package($pkg)->shortdesc; + $t |= ""; + my $lt = $tlpdb->get_package($pkg)->longdesc; + $lt |= ""; + if (($pkg =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { + $ret .= " $pkg - $t\n"; + } } } print "$ret"; @@ -667,16 +683,22 @@ Prints the list of arch-os available at the default install location. Adds binaries for the given architectures to the installtion. -=item B<search what> +=item B<search [-file] what> -Search the names and short descriptions of all locally installed packages +Search the names, short and long descriptions of all locally installed packages for the given argument (interpreted as regexp). -=item B<globalsearch what> +With the B<-file> argument searches for files containing C<what> somewhere +in the path, and returning each package with the respective hit. + +=item B<globalsearch [-file] what> -Search the names and short descriptions of all packages available on +Search the names, short and long descriptions of all packages available on the install media. +With the B<-file> argument searches for files containing C<what> somewhere +in the path, and returning each package with the respective hit. + =item B<show [pkg [pkg [...]]]> Shows for each given package the name, category, installation status, |