diff options
author | Norbert Preining <preining@logic.at> | 2008-12-03 23:01:14 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-12-03 23:01:14 +0000 |
commit | e6c1396b6fa9e015460ba9e426428a062422f50c (patch) | |
tree | 0b7b7c2844b6280593276130186e6f2b1fea0690 /Master | |
parent | 358b9a9ad3640189d6db03b12ed3ada31da17e6a (diff) |
make tlmgr list pkg act like show pkg, and add --list to show pkg
git-svn-id: svn://tug.org/texlive/trunk@11509 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 60 | ||||
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr2.pl | 60 |
2 files changed, 114 insertions, 6 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index b15e0847fd2..2c364c0bfa9 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -586,9 +586,13 @@ sub action_show { if ($opt_gui) { action_gui("config"); } + my $opt_list = 0; + Getopt::Long::Configure(@getopt_configure_subopts); + GetOptions("list" => \$opt_list) or pod2usage(2); init_local_db(); my $tlmediatlpdb; foreach my $pkg (@ARGV) { + my $tlpdb = $localtlpdb; my $tlp = $localtlpdb->get_package($pkg); my $installed = 0; if (!$tlp) { @@ -597,6 +601,7 @@ sub action_show { $tlmediatlpdb = $tlmediasrc->tlpdb; } $tlp = $tlmediatlpdb->get_package($pkg); + $tlpdb = $tlmediatlpdb; } else { $installed = 1; } @@ -620,6 +625,39 @@ sub action_show { print "Installed: ", ($installed ? "Yes" : "No"), "\n"; print "Revision: ", $tlp->revision, "\n" if ($installed); print "Collection: ", @colls, "\n" if (@colls); + if ($opt_list) { + print "Included files sorted by type:\n"; + # if the package has a .ARCH dependency we also list the files for + # those packages + my @todo = $tlpdb->expand_dependencies("-only-arch", $tlpdb, ($pkg)); + for my $d (sort @todo) { + my $foo = $tlpdb->get_package($d); + if (!$foo) { + warn "That should not happen, no such package here!"; + next; + } + if ($d ne $pkg) { + print "depending package $d:\n"; + } + if ($foo->runfiles) { + print "run files:\n"; + for my $f (sort $foo->runfiles) { print " $f\n"; } + } + if ($foo->srcfiles) { + print "source files:\n"; + for my $f (sort $foo->srcfiles) { print " $f\n"; } + } + if ($foo->docfiles) { + print "doc files:\n"; + for my $f (sort $foo->docfiles) { print " $f\n"; } + } + # in case we have them + if ($foo->allbinfiles) { + print "bin files (all architectures):\n"; + for my $f (sort $foo->allbinfiles) { print " $f\n"; } + } + } + } print "\n"; } else { printf STDERR "tlmgr: cannot find $pkg\n"; @@ -1486,8 +1524,20 @@ sub action_install { sub action_list { init_local_db(); - my $what = shift @ARGV; - $what || ($what = ""); + # make sure that the @ARGV hash is not changed in case we switch to + # show mode + my ($what) = @ARGV; + if ($what) { + # if the argument to list is either 'collection' or 'scheme' + # we list them, otherwise we go direct into tlmgr show $pkg mode + if ($what !~ m/^(collection|scheme)/i) { + tlwarn("(switching to show mode)\n"); + action_show(); + return; + } + } else { + $what = ""; + } init_tlmedia(); my @whattolist; if ($what =~ m/^collection/i) { @@ -2642,12 +2692,14 @@ local installation. =back -=item B<show I<pkg>...> +=item B<show [--list] I<pkg>...> Shows information about I<pkg>: the name, category, installation status, short and long description. Searches in the remote installation source for the package if it is not locally installed. +If the option B<--list> is given the list of contained files is also +shown, including those for architecture specific dependencies. =item B<list [collections|schemes]> @@ -2656,6 +2708,8 @@ location, prefixing those already installed with "C<i>". With an argument lists only collections or schemes, as requested. +As a convenience if there are arguments other then B<collections> or +B<schemes> those are handled over to the B<show> action (see above). =item B<check [I<option>]... [files|collections|all]> diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index 3ae0ac4594b..e1d4b071563 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -604,9 +604,13 @@ sub action_show { if ($opt_gui) { action_gui("config"); } + my $opt_list = 0; + Getopt::Long::Configure(@getopt_configure_subopts); + GetOptions("list" => \$opt_list) or pod2usage(2); init_local_db(); my $tlmediatlpdb; foreach my $pkg (@ARGV) { + my $tlpdb = $localtlpdb; my $tlp = $localtlpdb->get_package($pkg); my $installed = 0; if (!$tlp) { @@ -615,6 +619,7 @@ sub action_show { $tlmediatlpdb = $tlmediasrc->tlpdb; } $tlp = $tlmediatlpdb->get_package($pkg); + $tlpdb = $tlmediatlpdb; } else { $installed = 1; } @@ -638,6 +643,39 @@ sub action_show { print "Installed: ", ($installed ? "Yes" : "No"), "\n"; print "Revision: ", $tlp->revision, "\n" if ($installed); print "Collection: ", @colls, "\n" if (@colls); + if ($opt_list) { + print "Included files sorted by type:\n"; + # if the package has a .ARCH dependency we also list the files for + # those packages + my @todo = $tlpdb->expand_dependencies("-only-arch", $tlpdb, ($pkg)); + for my $d (sort @todo) { + my $foo = $tlpdb->get_package($d); + if (!$foo) { + warn "That should not happen, no such package here!"; + next; + } + if ($d ne $pkg) { + print "depending package $d:\n"; + } + if ($foo->runfiles) { + print "run files:\n"; + for my $f (sort $foo->runfiles) { print " $f\n"; } + } + if ($foo->srcfiles) { + print "source files:\n"; + for my $f (sort $foo->srcfiles) { print " $f\n"; } + } + if ($foo->docfiles) { + print "doc files:\n"; + for my $f (sort $foo->docfiles) { print " $f\n"; } + } + # in case we have them + if ($foo->allbinfiles) { + print "bin files (all architectures):\n"; + for my $f (sort $foo->allbinfiles) { print " $f\n"; } + } + } + } print "\n"; } else { printf STDERR "tlmgr: cannot find $pkg\n"; @@ -1504,8 +1542,20 @@ sub action_install { sub action_list { init_local_db(); - my $what = shift @ARGV; - $what || ($what = ""); + # make sure that the @ARGV hash is not changed in case we switch to + # show mode + my ($what) = @ARGV; + if ($what) { + # if the argument to list is either 'collection' or 'scheme' + # we list them, otherwise we go direct into tlmgr show $pkg mode + if ($what !~ m/^(collection|scheme)/i) { + tlwarn("(switching to show mode)\n"); + action_show(); + return; + } + } else { + $what = ""; + } init_tlmedia(); my @whattolist; if ($what =~ m/^collection/i) { @@ -2690,12 +2740,14 @@ local installation. =back -=item B<show I<pkg>...> +=item B<show [--list] I<pkg>...> Shows information about I<pkg>: the name, category, installation status, short and long description. Searches in the remote installation source for the package if it is not locally installed. +If the option B<--list> is given the list of contained files is also +shown, including those for architecture specific dependencies. =item B<list [collections|schemes]> @@ -2704,6 +2756,8 @@ location, prefixing those already installed with "C<i>". With an argument lists only collections or schemes, as requested. +As a convenience if there are arguments other then B<collections> or +B<schemes> those are handled over to the B<show> action (see above). =item B<check [I<option>]... [files|collections|all]> |