summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-08 21:47:09 +0000
committerKarl Berry <karl@freefriends.org>2015-12-08 21:47:09 +0000
commit5db0950ba6b90723a352862042de9231540decfc (patch)
tree9216a8cf931c9faf8342e3cda8f65a1807e395cb /Master
parenta6fd5c09b9e642613317ee3fd06d92be9548fd7b (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')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm11
-rw-r--r--Master/tlpkg/TeXLive/TLPSRC.pm2
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm6
-rwxr-xr-xMaster/tlpkg/bin/tlpfiles39
4 files changed, 28 insertions, 30 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 811da76099b..90738ee0d54 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -815,14 +815,13 @@ containing a file named C<filename>.
# TODO adapt for searching in *all* tags ???
sub find_file {
my ($self,$fn) = @_;
- my @ret;
- foreach my $pkg ($self->list_packages) {
- my @foo = $self->get_package($pkg)->contains_file($fn);
- foreach my $f ($self->get_package($pkg)->contains_file($fn)) {
- push @ret, "$pkg:$f";
+ my @ret = ();
+ for my $pkg ($self->list_packages) {
+ for my $f ($self->get_package($pkg)->contains_file($fn)) {
+ push (@ret, "$pkg:$f");
}
}
- return(@ret);
+ return @ret;
}
=pod
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm
index b83c0d541d2..5505505258b 100644
--- a/Master/tlpkg/TeXLive/TLPSRC.pm
+++ b/Master/tlpkg/TeXLive/TLPSRC.pm
@@ -106,7 +106,7 @@ sub from_file {
# (blank lines are significant in tlpobj, but not tlpsrc)
if ($line =~ /^ /) {
- die "$srcfile: non-continuation indentation not allowed: `$line'";
+ die "$srcfile:$lineno: non-continuation indentation not allowed: `$line'";
}
# remove terminal white space
$line =~ s/\s+$//;
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index a0d09f7abab..b2c74c3a6ca 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -3059,7 +3059,11 @@ sub parse_AddHyphen_line {
return %ret;
}
-
+#
+# return hash of items on AddFormat line LINE (which must not have the
+# leading "execute AddFormat"). If parse fails, hash will contain a key
+# "error" with a message.
+#
sub parse_AddFormat_line {
my $line = shift;
my %ret;
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`"