diff options
author | Norbert Preining <preining@logic.at> | 2010-05-28 11:55:26 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-05-28 11:55:26 +0000 |
commit | 6a603a72de517acee6c82d4d1334a4fc45041091 (patch) | |
tree | f88969144774008b2a5b956757eb50cd456febba /Master/tlpkg/TeXLive/TLConfFile.pm | |
parent | a0cb3ae37b51b9af9b271a199f241fc0a2f92c6e (diff) |
- 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
Diffstat (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfFile.pm | 20 |
1 files changed, 17 insertions, 3 deletions
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; |