summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-10-22 02:47:27 +0000
committerNorbert Preining <preining@logic.at>2010-10-22 02:47:27 +0000
commita9dfa5807a2a97e8cb2f23d7bf7fd04b52205f78 (patch)
tree3047a808ea1cf298a8112bf836784dfbd3468724 /Master/texmf
parent66e281b91377079c641c950e113c05b282c156d6 (diff)
taxonomy search and list support
git-svn-id: svn://tug.org/texlive/trunk@20153 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl181
1 files changed, 169 insertions, 12 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 9c3cf4a4583..59923ea66d4 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -166,8 +166,16 @@ sub main {
"search" => { "global" => 1,
"word" => 1,
"file" => 1,
+ "keyword" => 1,
+ "list" => 1,
+ "characterization" => 1,
+ "functionality" => 1,
"taxonomy" => 1 },
- "show" => { "list" => 1 },
+ "show" => { "list" => 1,
+ "taxonomy" => 1,
+ "keyword" => 1,
+ "characterization" => 1,
+ "functionality" => 1 },
"uninstall" => { "force" => 1 },
"update" => { "no-depends" => 1,
"no-depends-at-all" => 1,
@@ -919,6 +927,14 @@ sub action_paper {
#
sub action_show {
init_local_db();
+ my $taxonomy;
+ if ($opts{"taxonomy"} || $opts{"characterization"} || $opts{"functionality"}
+ || $opts{"keyword"}) {
+ $taxonomy = load_taxonomy_datafile();
+ if (!defined($taxonomy)) {
+ tlwarn("tlmgr: Cannot load taxonomy file, showing taxonomies not supported.\n");
+ }
+ }
foreach my $pkg (@ARGV) {
my $tlpdb = $localtlpdb;
my $tlp = $localtlpdb->get_package($pkg);
@@ -961,6 +977,36 @@ sub action_show {
print "cat-license: ", $tlp->cataloguedata->{'license'}, "\n"
if $tlp->cataloguedata->{'license'};
print "collection: ", @colls, "\n" if (@colls);
+ if ($opts{"keyword"} || $opts{"taxonomy"}) {
+ print "keywords: ";
+ if (defined($taxonomy->{'by-package'}{'keyword'}{$pkg})) {
+ print join(', ',@{$taxonomy->{'by-package'}{'keyword'}{$pkg}}), "\n";
+ } else {
+ print "(none found)\n";
+ }
+ }
+ if ($opts{"functionality"} || $opts{"taxonomy"}) {
+ print "function: ";
+ if (defined($taxonomy->{'by-package'}{'functionality'}{$pkg})) {
+ print join(', ',@{$taxonomy->{'by-package'}{'functionality'}{$pkg}}), "\n";
+ } else {
+ print "(none found)\n";
+ }
+ }
+ if ($opts{"characterization"} || $opts{"taxonomy"}) {
+ print "primary characterization: ";
+ if (defined($taxonomy->{'by-package'}{'primary'}{$pkg})) {
+ print $taxonomy->{'by-package'}{'primary'}{$pkg}, "\n";
+ } else {
+ print "(none found)\n";
+ }
+ print "secondary characterization: ";
+ if (defined($taxonomy->{'by-package'}{'secondary'}{$pkg})) {
+ print $taxonomy->{'by-package'}{'secondary'}{$pkg}, "\n";
+ } else {
+ print "(none found)\n";
+ }
+ }
if ($opts{"list"}) {
if ($tlp->category eq "Collection" || $tlp->category eq "Scheme") {
# in the case of collections of schemes we list the deps
@@ -1142,13 +1188,34 @@ sub load_taxonomy_datafile {
return $taxonomy;
}
+sub walk_level_tree {
+ my $cp = shift;
+ my $prestring = shift;
+ my $print_packages = shift;
+ if (defined($cp->{'_packages_'})) {
+ print "$prestring\n";
+ if ($print_packages) {
+ my @pkgs = sort @{$cp->{'_packages_'}};
+ print "\t@pkgs\n";
+ }
+ }
+ for my $cz (keys %$cp) {
+ if ($cz ne '_packages_') {
+ my $nextstring = "$prestring > $cz";
+ my $np = $cp->{$cz};
+ &walk_level_tree($np,$nextstring);
+ }
+ }
+}
+
sub action_search {
my $r = shift @ARGV;
my $ret = "";
my $tlpdb;
my $taxonomy;
#
- if (!defined($r) || !$r) {
+ if (!$opts{"list"} && (!defined($r) || !$r)) {
+
tlwarn("tlmgr: nothing to search for.\n");
return;
}
@@ -1157,7 +1224,13 @@ sub action_search {
return;
}
# check the arguments
- if (exists($opts{"file"}) && exists($opts{"taxonomy"})) {
+ my $search_type_nr = 0;
+ $search_type_nr++ if $opts{"file"};
+ $search_type_nr++ if $opts{"taxonomy"};
+ $search_type_nr++ if $opts{"characterization"};
+ $search_type_nr++ if $opts{"functionality"};
+ $search_type_nr++ if $opts{"keyword"};
+ if ($search_type_nr > 1) {
tlwarn("tlmgr: please specify only one thing to search for!\n");
return;
}
@@ -1168,10 +1241,32 @@ sub action_search {
} else {
$tlpdb = $localtlpdb;
}
- if ($opts{"taxonomy"}) {
+ if ($opts{"taxonomy"} || $opts{"characterization"} || $opts{"functionality"}
+ || $opts{"keyword"}) {
$taxonomy = load_taxonomy_datafile();
if (!defined($taxonomy)) {
- tlwarn("tlmgr: Cannot load taxonomy file, searching for taxonomies not supported.\n");
+ tlwarn("tlmgr: Cannot load taxonomy file, searching/listing for taxonomies not supported.\n");
+ return;
+ }
+ if ($opts{"list"}) {
+ if ($opts{"keyword"} || $opts{"taxonomy"}) {
+ print "Keywords:\n";
+ for (sort keys %{$taxonomy->{'by-taxonomy'}{'keyword'}}) {
+ print "\t$_\n";
+ }
+ print "\n";
+ }
+ if ($opts{"functionality"} || $opts{"taxonomy"}) {
+ print "Functionalities:\n";
+ &walk_level_tree($taxonomy->{'by-taxonomy'}{'functionality'}, "", 0);
+ print "\n";
+ }
+ if ($opts{"characterization"} || $opts{"taxonomy"}) {
+ # Assume all possible characterizations occur under the primary ones!
+ print "Characterizations:\n";
+ &walk_level_tree($taxonomy->{'by-taxonomy'}{'primary'}, "", 0);
+ print "\n";
+ }
return;
}
}
@@ -1196,12 +1291,26 @@ sub action_search {
if ($opts{"taxonomy"}) {
$t = "$t" . join('\n', @{$taxonomy->{'by-package'}{'keyword'}{$pkg}})
if (defined($taxonomy->{'by-package'}{'keyword'}{$pkg}));
+ $t .= "\n";
+ $t = "$t$taxonomy->{'by-package'}{'primary'}{$pkg}\n"
+ if (defined($taxonomy->{'by-package'}{'primary'}{$pkg}));
+ $t .= "\n";
+ $t = "$t$taxonomy->{'by-package'}{'secondary'}{$pkg}\n"
+ if (defined($taxonomy->{'by-package'}{'secondary'}{$pkg}));
+ $t .= "\n";
+ $t = "$t" . join('\n', @{$taxonomy->{'by-package'}{'functionality'}{$pkg}})
+ if (defined($taxonomy->{'by-package'}{'functionality'}{$pkg}));
+ } elsif ($opts{"keyword"}) {
+ $t = "$t" . join('\n', @{$taxonomy->{'by-package'}{'keyword'}{$pkg}})
+ if (defined($taxonomy->{'by-package'}{'keyword'}{$pkg}));
+ } elsif ($opts{"functionality"}) {
+ $t = "$t" . join('\n', @{$taxonomy->{'by-package'}{'functionality'}{$pkg}})
+ if (defined($taxonomy->{'by-package'}{'functionality'}{$pkg}));
+ } elsif ($opts{"characterization"}) {
$t = "$t$taxonomy->{'by-package'}{'primary'}{$pkg}\n"
if (defined($taxonomy->{'by-package'}{'primary'}{$pkg}));
$t = "$t$taxonomy->{'by-package'}{'secondary'}{$pkg}\n"
if (defined($taxonomy->{'by-package'}{'secondary'}{$pkg}));
- $t = "$t" . join('\n', @{$taxonomy->{'by-package'}{'function'}{$pkg}})
- if (defined($taxonomy->{'by-package'}{'function'}{$pkg}));
} else {
$t = "$pkg\n";
$t = "$t" . $tlp->shortdesc . "\n"
@@ -1215,7 +1324,7 @@ sub action_search {
if ($opts{"word"}) {
$pat = '\W' . $r . '\W';
}
- if ($t =~ m/$pat/) {
+ if ($t =~ m/$pat/i) {
$ret .= " $pkg - " . $shortdesc . "\n";
}
}
@@ -1247,7 +1356,6 @@ sub get_available_backups {
next if (-d $dirent);
next if ($dirent !~ m/^(.*)\.r([0-9]+)\.tar\.xz$/);
if (!$do_stat) {
- print "not doing stats!\n";
$backups{$1}->{$2} = 1;
next;
}
@@ -5428,6 +5536,12 @@ C<--print-arch> is a synonym.
=head2 search [I<options>] --taxonomy I<what>
+=head2 search [I<options>] --keyword I<what>
+
+=head2 search [I<options>] --functionality I<what>
+
+=head2 search [I<options>] --characterization I<what>
+
By default searches the names, short and long descriptions of all
locally installed packages for the given argument (interpreted as
regexp).
@@ -5447,9 +5561,17 @@ Restrict the search to match only full words. As an example searching
for C<table> with this option will not output packages containing
the the word C<tables> unless they also contain the word C<table>.
+=item B<--list>
+
+If a search for any (or all) taxonomies is done by given either
+B<--taxonomy>, B<--keyword>, B<--functionality>, or B<--characterization>,
+then instead of actually searching for packages, simply lists the
+keywords, functionalities, characterizations, or all of them.
+
=back
-Other search options are selected by adding either B<--file> or B<--taxonomy>.
+Other search options are selected by adding either B<--file>, B<--taxonomy>,
+B<--keyword>, B<--functionality>, or B<--characterization>.
=over 4
@@ -5459,8 +5581,15 @@ List all filenames containing I<what>.
=item B<--taxonomy>
+=item B<--keyword>
+
+=item B<--functionality>
+
+=item B<--characterization>
+
Searches in the list of keywords, and its characterization and functional
-specifications (MORE DETAILS NEEDED) instead of the package descriptions.
+specifications instead of the package descriptions.
+See L</"TAXONOMIES"> below for details.
=item B<--extended>
@@ -5468,7 +5597,7 @@ Not implemented yet.
=back
-=head2 show [--list] I<pkg>...
+=head2 show [I<options>] I<pkg>...
Display information about I<pkg>: the name, category, installation status,
short and long description. Searches in the remote installation source
@@ -5478,11 +5607,33 @@ It also displays the information taken from the TeX Catalogue (license,
date, version), but note that there is a high probability that this
information is slightly off due to timing issues.
+Options:
+
+=over4
+
+=item B<--list>
+
If the option C<--list> is given with a package, the list of contained
files is also shown, including those for platform-specific
dependencies. When given with schemes and collections, C<--list>
outputs their dependencies in a similar way.
+=item B<--taxonomy>
+
+=item B<--keyword>
+
+=item B<--functionality>
+
+=item B<--characterization>
+
+In addition to the normal data displayed, also display the various
+taxonomies.
+See L</"TAXONOMIES"> below for details.
+
+
+=back
+
+
=head2 list [--only-installed] [collections|schemes|I<pkg>...]
With no argument, lists all packages available at the package
@@ -5760,6 +5911,12 @@ command line options of C<tlmgr>. C<gui_expertmode> switches between
the full GUI and a simplified with only the important and mostly used
settings.
+=head1 TAXONOMIES
+
+tlmgr allows searching and listing of various taxonomies as provided
+by newer version of the TeX Catalogue.
+
+MORE INFORMATION NEEDED.
=head1 GUI