summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2013-04-16 08:17:23 +0000
committerNorbert Preining <preining@logic.at>2013-04-16 08:17:23 +0000
commit109db6732d36505c8b8615d9aa483e0f889c22bd (patch)
tree9d20c6b17395cccaaa608e4bf378ce9a0a39f69f /Master/tlpkg/TeXLive
parentbffd3dfd2a934cde7389a5a6517bd1ad284113eb (diff)
allow for variables in tlpsrc files
git-svn-id: svn://tug.org/texlive/trunk@29969 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLPSRC.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm
index a2faf894386..a2a7e036a7e 100644
--- a/Master/tlpkg/TeXLive/TLPSRC.pm
+++ b/Master/tlpkg/TeXLive/TLPSRC.pm
@@ -83,6 +83,7 @@ sub from_file {
my $foundnametag = 0;
my $finished = 0;
my $savedline = "";
+ my %tlpvars;
my $lineno = 0;
for my $line (@lines) {
@@ -119,6 +120,12 @@ sub from_file {
$foundnametag && die "$srcfile: second name directive not allowed: $name";
$foundnametag = 1;
} else {
+ # expand tlpvars while reading in
+ # that means we have to respect *order* and define variables
+ # first in the tlpsrc file
+ for my $k (keys %tlpvars) {
+ $line =~ s/\$\{\Q$k\E\}/$tlpvars{$k}/g;
+ }
# we default to the file name as package name
# $started || die "$srcfile: first directive must be `name', not $line";
if ($line =~ /^shortdesc\s*(.*)$/) {
@@ -160,6 +167,9 @@ sub from_file {
} elsif ($line =~ /^postaction\s+(.*)$/) {
push @postactions, $1 if ($1 ne "");
next;
+ } elsif ($line =~ /^tlpsetvar\s+([-a-zA-Z_0-9]*)\s+(.*)$/) {
+ $tlpvars{$1} = $2;
+ next;
} else {
tlwarn("$srcfile:$lineno: unknown tlpsrc directive, fix fix: $line\n");
}