From f8fda7824b2b8cdebc2f57a8dc1aefdec29b14e9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 5 Jul 2018 21:20:15 +0000 Subject: TLPSRC.pm (from_file): do ${PKGNAME} expansion here, like user vars. TLTREE.pm (get_matching_files): remove PKGNAME var handling. *.tlpsrc: use ${PKGNAME} for a couple of .map files; dozens more could be done. git-svn-id: svn://tug.org/texlive/trunk@48145 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPSRC.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPSRC.pm') diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm index bab1da115a6..218a7baf279 100644 --- a/Master/tlpkg/TeXLive/TLPSRC.pm +++ b/Master/tlpkg/TeXLive/TLPSRC.pm @@ -65,7 +65,6 @@ sub from_file { close(TMP); my $name = $pkgname; - # default category = Package my $category = "Package"; my $shortdesc = ""; my $longdesc= ""; @@ -77,6 +76,7 @@ sub from_file { my $finished = 0; my $savedline = ""; my %tlpvars; + $tlpvars{"PKGNAME"} = $name; my $lineno = 0; for my $line (@lines) { @@ -107,18 +107,20 @@ sub from_file { # that means we have to respect *order* and define variables # as we read the tlpsrc file. if ($line !~ /^(short|long)desc\s/) { + #debug: my $origline = $line; for my $k (keys %tlpvars) { $line =~ s/\$\{\Q$k\E\}/$tlpvars{$k}/g; } # check that no variables remain unexpanded, or rather, for any # remaining $ (which we don't otherwise allow in tlpsrc files, so - # should never occur) ... except for ${ARCH} and ${PKGNAME} which - # we specially expand. (Sigh: we distribute one file dvi$pdf.bat, but - # fortunately we match it with a directory.) + # should never occur) ... except for ${ARCH} which we specially + # expand in TLTREE.pm. (Sigh: we distribute one file dvi$pdf.bat, + # but fortunately it is matched by a directory.) # - (my $testline = $line) =~ s,\$\{(ARCH|PKGNAME)\},,g; + (my $testline = $line) =~ s,\$\{ARCH\},,g; $testline =~ /\$/ && die "$srcfile:$lineno: variable undefined or syntax error: $line\n"; + #debug: warn "new line $line, from $origline\n" if $origline ne $line; } # end variable expansion. # names of source packages can either be @@ -133,6 +135,10 @@ sub from_file { . "(have $name)\n"; $name = $1; $foundnametag = 1; + # let's assume that $PKGNAME doesn't occur before any name + # directive (which would result in different expansions); there is + # no need for it in practice. + $tlpvars{"PKGNAME"} = $name; } elsif ($line =~ /^category\s+$CategoriesRegexp$/) { $category = $1; -- cgit v1.2.3