summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPSRC.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-09-24 01:04:11 +0000
committerKarl Berry <karl@freefriends.org>2008-09-24 01:04:11 +0000
commitd0f969c87db7c6f0a75c59a3a3f56bbf53691df1 (patch)
tree093c388891c3a6647a67adcbf73a60f473198f52 /Master/tlpkg/TeXLive/TLPSRC.pm
parent4ebeca0a54e38b5e06f5046c61c73526b6868f8b (diff)
(from_file): support continuation lines with a
trailing \. git-svn-id: svn://tug.org/texlive/trunk@10708 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPSRC.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPSRC.pm63
1 files changed, 43 insertions, 20 deletions
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm
index 640db804533..2240c374e96 100644
--- a/Master/tlpkg/TeXLive/TLPSRC.pm
+++ b/Master/tlpkg/TeXLive/TLPSRC.pm
@@ -68,14 +68,27 @@ sub from_file
my (@runpatterns, @docpatterns, @binpatterns, @srcpatterns);
my $started = 0;
my $finished = 0;
+ my $savedline = "";
foreach my $line (@lines) {
+ # we allow continuation lines in tlpsrc files, i.e., lines with a \ at
+ # the end
+ if ($line =~ /^(.*)\\$/) {
+ $savedline .= $1;
+ next;
+ }
+ if ($savedline ne "") {
+ # we are in a continuation line
+ $line = "$savedline$line";
+ $savedline = "";
+ }
+
$line =~ /^\s*#/ && next; # skip comment lines
next if $line =~ /^\s*$/; # skip blank lines
# (blank lines are significant in tlpobj, but not tlpsrc)
if ($line =~ /^ /) {
- die "$srcfile: continuation line not allowed in tlpsrc: $line\n";
+ die "$srcfile: non-continuation indentation not allowed: `$line'";
}
# names of source packages can either be
# - normal names: ^[-\w]+$
@@ -83,43 +96,43 @@ sub from_file
# - normal texlive specific packages: ^texlive.*\..*$
# - configuration texlive specific packages: ^00texlive.*\..*$
if ($line =~ /^name\s*([-\w]+(\.win32)?|00texlive.*|texlive\..*)$/) {
- $name = "$1";
- $started && die("$srcfile: tlpsrc cannot have two name directives");
+ $name = $1;
+ $started && die "$srcfile: second name directive not allowed: $name";
$started = 1;
} else {
- $started || die("$srcfile: first tlpsrc directive must be 'name'");
+ $started || die "$srcfile: first directive must be `name', not $line";
if ($line =~ /^shortdesc\s*(.*)\s*$/) {
- $shortdesc = "$1";
+ $shortdesc = $1;
next;
} elsif ($line =~ /^category\s+$CategoriesRegexp$/) {
- $category = "$1";
+ $category = $1;
next;
} elsif ($line =~ /^longdesc\s+(.*)\s*$/) {
$longdesc .= "$1 ";
next;
} elsif ($line =~ /^catalogue\s+(.*)\s*$/) {
- $catalogue = "$1";
+ $catalogue = $1;
next;
} elsif ($line =~ /^runpattern\s+(.*)\s*$/) {
- push @runpatterns, "$1" if ("$1" ne "");
+ push @runpatterns, $1 if ($1 ne "");
next;
} elsif ($line =~ /^srcpattern\s+(.*)\s*$/) {
- push @srcpatterns, "$1" if ("$1" ne "");
+ push @srcpatterns, $1 if ($1 ne "");
next;
} elsif ($line =~ /^docpattern\s+(.*)\s*$/) {
- push @docpatterns, "$1" if ("$1" ne "");
+ push @docpatterns, $1 if ($1 ne "");
next;
} elsif ($line =~ /^binpattern\s+(.*)\s*$/) {
- push @binpatterns, "$1" if ("$1" ne "");
+ push @binpatterns, $1 if ($1 ne "");
next;
} elsif ($line =~ /^execute\s+(.*)\s*$/) {
- push @executes, "$1" if ("$1" ne "");
+ push @executes, $1 if ($1 ne "");
next;
} elsif ($line =~ /^depend\s+(.*)\s*$/) {
- push @depends, "$1" if ("$1" ne "");
+ push @depends, $1 if ($1 ne "");
next;
} else {
- tlwarn("$srcfile: unknown tlpsrc directive, please fix: $line\n");
+ tlwarn("$srcfile:$.: unknown tlpsrc directive, please fix: $line\n");
}
}
}
@@ -515,20 +528,30 @@ C<TeXLive::TLPSRC> -- TeX Live Package Source access module
=head1 DESCRIPTION
The C<TeXLive::TLPSRC> module provide access to TeX Live Package Source
-files, which contains all the information which cannot be automatically
-derived from the files in the TeX Live subversion repository.
+files, which contain all the information which cannot be automatically
+derived from the files in the TeX Live subversion repository. In other
+words, these files are hand-maintained.
=head1 FILE SPECIFICATION
-A C<tlpsrc> file has to consist of non-empty lines (except that initial
-and final empty lines are ignored) of the form
+A C<tlpsrc> file has to consist of non-indented lines of the form:
-I<key value>
+ I<key value>
where I<key> can be C<name>, C<category>, C<shortdesc>, C<longdesc>,
C<catalogue>, C<runpattern>, C<srcpattern>, C<docpattern>, C<binpattern>,
C<execute>, or C<depend>.
+Continuation lines are supported with a trailing backslash. That is, if
+the C<.tlpsrc> file contains two physical lines like this:
+
+ foo\
+ bar
+
+they are concatenated into C<foobar>. The newline is removed; no other
+whitespace is added or removed, so typically the continuation line would
+start with one or more spaces.
+
The interpretation of the respective I<values> are:
=over 4
@@ -538,7 +561,7 @@ The interpretation of the respective I<values> are:
identifies the package, C<value> must consist only of C<[-_a-zA-Z0-9]>,
i.e., with what Perl considers a C<\w>.
-There are 3 exceptions to this rule:
+There are three exceptions to this rule:
=over 8