diff options
author | Karl Berry <karl@freefriends.org> | 2015-12-08 21:47:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-12-08 21:47:09 +0000 |
commit | 5db0950ba6b90723a352862042de9231540decfc (patch) | |
tree | 9216a8cf931c9faf8342e3cda8f65a1807e395cb /Master/tlpkg/bin/tlpfiles | |
parent | a6fd5c09b9e642613317ee3fd06d92be9548fd7b (diff) |
* bin/tlpfiles: doc tweaks.
* TeXLive/TLPDB.pm (find_file): no need for @foo.
* TeXLive/TLPSRC.pm (): include $lineno in non-continuation error.
* TeXLive/TLUtils.pm (parseAddFormatLine_line): doc.
git-svn-id: svn://tug.org/texlive/trunk@39054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/tlpfiles')
-rwxr-xr-x | Master/tlpkg/bin/tlpfiles | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/Master/tlpkg/bin/tlpfiles b/Master/tlpkg/bin/tlpfiles index f56a2a1354b..8367bd54172 100755 --- a/Master/tlpkg/bin/tlpfiles +++ b/Master/tlpkg/bin/tlpfiles @@ -1,6 +1,6 @@ #!/usr/bin/env perl # $Id$ -# Copyright 2007, 2008, 2009 Karl Berry. +# Copyright 2007-2015 Karl Berry. # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -31,16 +31,15 @@ my $opt_help = 0; my $opt_fullpath = 0; TeXLive::TLUtils::process_logging_options (); -GetOptions ("pkgof=s" => \@opt_pkgof, +GetOptions ("pkgof=s" => \@opt_pkgof, "fullpath" => \$opt_fullpath, - "help|?" => \$opt_help) or pod2usage (2); + "help|?" => \$opt_help) or pod2usage (2); pod2usage ("-exitstatus" => 0, "-verbose" => 2) if $opt_help; exit (&main ()); -sub main -{ +sub main { my $Master = "$mydir/../.."; # xx TLPDB should default my $tlpdb_path = "$Master/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb"; @@ -70,8 +69,7 @@ sub main # Report which package(s) the given files belong to. # -sub do_pkgof -{ +sub do_pkgof { my ($tlpdb,@files) = @_; @files = split (/\s/, "@files"); @@ -86,22 +84,20 @@ sub do_pkgof # return package to which FILE belongs, or undef. # -# any directory part of FILE is stripped. If there are multiple -# packages holding files by the same name, all are returned, -# space-separated. +# If $opt_fullpath is not set, any directory part of FILE is stripped. +# If there are multiple packages holding files by the same name, all are +# returned, space-separated. If $opt_fullpath is set, we compare the +# whole path as given. # -# Because this strange inverse operation is not needed for anything -# else, we don't attempt to implement it in the usual modules. Instead, -# we read the raw tlpdb file. +# We read the raw tlpdb file instead of using, e.g., TLPDB::find_file +# which is slow, but it's probably still a mistake. # -sub find_pkg_of_file -{ +sub find_pkg_of_file { my ($tlpdb,$file) = @_; if (! keys %DB_BY_FILE) { local *FILE; - $FILE = $tlpdb; - open (FILE) || die "open($FILE) failed: $!"; + open (FILE, $tlpdb) || die "open($tlpdb) failed: $!"; my $pkg; while (<FILE>) { chomp; @@ -120,7 +116,7 @@ sub find_pkg_of_file $DB_BY_FILE{$dbfile} .= "$pkg "; } } - close (FILE) || warn "close($FILE) failed: $!"; + close (FILE) || warn "close($tlpdb) failed: $!"; } if (!$opt_fullpath) { @@ -154,9 +150,8 @@ Output the TeX Live package(s) in which each I<file> is contained. =item B<-fullpath> -By default C<-pkgof> uses only the basename of I<file> for comparison. -With this option given, comparision/search is based on the full path -names. +By default, C<-pkgof> uses only the basename of I<file> for comparison. +With this option, the comparison is based on the full path names. =item B<-help> @@ -183,7 +178,7 @@ In the second form, with the C<-pkgof> option, return the TeX Live package in which each given I<FILE> is contained, or C<-> if no package can be found. The files may be given as a single whitespace-separated argument, or the C<-pkgof> option may be given more than once, or both. -Example invocation, given the list of files to search for in C</tmp/f>: +Example invocation, given a list of files to search for in C</tmp/f>: tlpfiles --pkgof "`cat /tmp/f`" |