From d0f969c87db7c6f0a75c59a3a3f56bbf53691df1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 24 Sep 2008 01:04:11 +0000 Subject: (from_file): support continuation lines with a trailing \. git-svn-id: svn://tug.org/texlive/trunk@10708 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPSRC.pm | 63 ++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPSRC.pm') 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 -- TeX Live Package Source access module =head1 DESCRIPTION The C 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 file has to consist of non-empty lines (except that initial -and final empty lines are ignored) of the form +A C file has to consist of non-indented lines of the form: -I + I where I can be C, C, C, C, C, C, C, C, C, C, or C. +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. 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 are: =over 4 @@ -538,7 +561,7 @@ The interpretation of the respective I are: identifies the package, C 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 -- cgit v1.2.3