From 109db6732d36505c8b8615d9aa483e0f889c22bd Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 16 Apr 2013 08:17:23 +0000 Subject: allow for variables in tlpsrc files git-svn-id: svn://tug.org/texlive/trunk@29969 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPSRC.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Master/tlpkg/TeXLive') 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"); } -- cgit v1.2.3