summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2015-05-09 02:43:37 +0000
committerNorbert Preining <preining@logic.at>2015-05-09 02:43:37 +0000
commit85ab9843cc32fb7c92ecd75fba75713f7c41adbd (patch)
tree83ed3f80f4f9a0ede4af485154e3559c8229e76e /Master/texmf-dist
parentf50edc46cb478a2adcbe2edef090cf0416094bba (diff)
action info: do a search if a package is not found
git-svn-id: svn://tug.org/texlive/trunk@37289 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl88
1 files changed, 61 insertions, 27 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 8c27adde603..50d1f9d2955 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -1457,8 +1457,14 @@ sub action_info {
next;
}
}
- tlwarn("$prg: cannot find package $pkg\n");
- $ret |= $F_WARNING;
+ # we didn't find a package like this, so use search
+ info("$prg: cannot find package $pkg, searching for other matches:\n");
+ my ($foundfile, $founddesc) = search_tlpdb($remotetlpdb, $pkg, 1, 1, 0);
+ print "\nPackages containing \`$pkg\' in their title/description:\n";
+ print $founddesc;
+ print "\nPackages containing files matching \`$pkg\':\n";
+ print $foundfile;
+ #$ret |= $F_WARNING;
next;
}
# we want to also show the source if it is known
@@ -1634,45 +1640,70 @@ sub action_search {
$tlpdb = $localtlpdb;
}
+ my ($foundfile, $founddesc) = search_tlpdb($tlpdb, $r,
+ $opts{'file'} || $opts{'all'},
+ (!$opts{'file'} || $opts{'all'}),
+ $opts{'word'});
+
+ print $founddesc;
+ print $foundfile;
+
+ return ($F_OK | $F_NOPOSTACTION);
+}
+
+sub search_tlpdb {
+ my ($tlpdb, $what, $dofile, $dodesc, $inword) = @_;
+ my $retfile = '';
+ my $retdesc = '';
foreach my $pkg ($tlpdb->list_packages) {
my $tlp = $tlpdb->get_package($pkg);
# --file or --all -> search (full) file names
- if ($opts{"file"} || $opts{"all"}) {
- my @files = $tlp->all_files;
- if ($tlp->relocated) {
- for (@files) { s:^$RelocPrefix/:$RelocTree/:; }
- }
- my @ret = grep(m;$r;, @files);
+ if ($dofile) {
+ my @ret = search_pkg_files($tlp, $what);
if (@ret) {
- print "$pkg:\n";
+ $retfile .= "$pkg:\n";
foreach (@ret) {
- print "\t$_\n";
+ $retfile .= "\t$_\n";
}
}
}
#
# no options or --all -> search package names/descriptions
- if ($search_type_nr == 0 || $opts{"all"}) {
+ if ($dodesc) {
next if ($pkg =~ m/\./);
- # glom description strings together for one search
- my $t = "$pkg\n";
- $t = $t . $tlp->shortdesc . "\n" if (defined($tlp->shortdesc));
- $t = $t . $tlp->longdesc . "\n" if (defined($tlp->longdesc));
- my $pat = $r;
- $pat = '\W' . $r . '\W' if ($opts{"word"});
- my $matched = "";
- if ($t =~ m/$pat/i) {
- my $shortdesc = $tlp->shortdesc || "";
- $matched .= " $pkg - $shortdesc\n";
- }
- print $matched;
+ my $matched = search_pkg_desc($tlp, $what, $inword);
+ $retdesc .= "$matched\n" if ($matched);
}
}
+ return($retfile, $retdesc);
+}
- return ($F_OK | $F_NOPOSTACTION);
+sub search_pkg_desc {
+ my ($tlp, $what, $inword) = @_;
+ my $pkg = $tlp->name;
+ my $t = "$pkg\n";
+ $t = $t . $tlp->shortdesc . "\n" if (defined($tlp->shortdesc));
+ $t = $t . $tlp->longdesc . "\n" if (defined($tlp->longdesc));
+ my $pat = $what;
+ $pat = '\W' . $what . '\W' if ($inword);
+ my $matched = "";
+ if ($t =~ m/$pat/i) {
+ my $shortdesc = $tlp->shortdesc || "";
+ $matched .= "$pkg - $shortdesc";
+ }
+ return $matched;
}
+sub search_pkg_files {
+ my ($tlp, $what) = @_;
+ my @files = $tlp->all_files;
+ if ($tlp->relocated) {
+ for (@files) { s:^$RelocPrefix/:$RelocTree/:; }
+ }
+ my @ret = grep(m;$what;, @files);
+ return @ret;
+}
# RESTORE
#
@@ -6213,10 +6244,10 @@ Report what would be updated without actually updating anything.
Make your local TeX installation correspond to what is in the package
repository (typically useful when updating from CTAN).
-=item C<tlmgr info> I<pkg>
+=item C<tlmgr info> I<what>
-Display detailed information about I<pkg>, such as the installation
-status and description.
+Display detailed information about a package I<what>, such as the installation
+status and description, of searches for I<what> in all packages.
=back
@@ -6669,6 +6700,9 @@ category, short and long description, installation status, and TeX Live
revision number. If I<pkg> is not locally installed, searches in the
remote installation source.
+If I<pkg> is not found locally or remotely, the search action is used
+and lists matching packages and files.
+
It also displays information taken from the TeX Catalogue, namely the
package version, date, and license. Consider these, especially the
package version, as approximations only, due to timing skew of the