From 6a603a72de517acee6c82d4d1334a4fc45041091 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 28 May 2010 11:55:26 +0000 Subject: - make TLConfFile behave like kpathsea in the way that continuations of comment lines are not supported - make tlmgr use TLConfFile for reading and writing the configuration file, this way we can now have arbitrary comments in it - TLConfFile: If a line cannot be parsed it is saved as comment and written out as is, but a big fat warning is issued git-svn-id: svn://tug.org/texlive/trunk@18550 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLConfFile.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Master/tlpkg/TeXLive') diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm index 01567d602b2..a85913da003 100644 --- a/Master/tlpkg/TeXLive/TLConfFile.pm +++ b/Master/tlpkg/TeXLive/TLConfFile.pm @@ -270,6 +270,11 @@ sub parse_config_file { next; } } + # ignore continuation after comments, that is the behaviour the + # kpathsea library is using, so we follow it here + if ($data[$l] =~ m/$cc/) { + $data[$l] =~ s/\\$//; + } # continuation line if ($data[$l] =~ m/^(.*)\\$/) { $cont_running = 1; @@ -296,12 +301,15 @@ sub parse_config_file { } # mind that the .*? is making the .* NOT greedy, ie matching as few as # possible. That way we can get rid of the comments at the end of lines - if ($data[$l] =~ m/^\s*([^\s$sep]+)\s*$sep\s*(.*?)(\s*$cc.*)?$/) { + if ($data[$l] =~ m/^\s*([^\s$sep]+)\s*$sep\s*(.*?)(\s*)?($cc.*)?$/) { $config{$l}{'type'} = 'data'; $config{$l}{'key'} = $1; $config{$l}{'value'} = $2; if (defined($3)) { my $postcomment = $3; + if (defined($4)) { + $postcomment .= $4; + } # check that there is actually a comment in the second part of the # line. Otherwise we might add the continuation lines of that # line to the value @@ -312,9 +320,15 @@ sub parse_config_file { next; } # if we are still here, that means we cannot evaluate the config file + # give a BIG FAT WARNING but save the line as comment and continue + # anyway + warn("WARNING WARNING WARNING\n"); warn("Cannot parse config file $file ($cc, $sep)\n"); - warn("Line $l = $data[$l]\n"); - return; + warn("The following line (l.$l) seems to be wrong:\n"); + warn(">>> $data[$l]\n"); + warn("We will treat this line as a comment!\n"); + $config{$l}{'type'} = 'comment'; + $config{$l}{'value'} = $data[$l]; } # save the number of lines in the config hash $config{'lines'} = $lines; -- cgit v1.2.3