diff options
author | green <green@FreeBSD.org> | 2004-02-27 21:01:02 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-02-27 21:01:02 +0000 |
commit | 3360398a0f9477fa103897806026e581cfb99188 (patch) | |
tree | 67381ac3fd0f91ea9e2e1eee534373215f981947 /Tools/scripts | |
parent | 8a8e2ef888949212a992da7713f2983cddac4f45 (diff) | |
download | FreeBSD-ports-3360398a0f9477fa103897806026e581cfb99188.zip FreeBSD-ports-3360398a0f9477fa103897806026e581cfb99188.tar.gz |
Update "plist" to understand the rest of the mtree(5) file format,
thus fixing the extra-@dirrm-problem once the base mtree files
document the extra symlinks that are part of the local/etc. trees.
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/plist | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/Tools/scripts/plist b/Tools/scripts/plist index 92e953e..6a903ad 100755 --- a/Tools/scripts/plist +++ b/Tools/scripts/plist @@ -42,29 +42,51 @@ class Mtree @paths = [] @curlevel = [] @strip = strip.to_i - @cont = false + @curline = '' + @global_settings = {} self end def parse_line(line) line.chomp! - spline = line.split - oldcont = @cont - @cont = line[-1, 1] == "\\" - case spline[0] - when nil - when /^[\/#]/ - # ignore "command" lines and comments - when '..' - if oldcont - raise 'continued line has a .. directive?!' + if line.empty? || line[0, 1] == '#' + return + end + if line[-1, 1] == "\\" + @curline.concat(line[0..-2]) + next + end + line = @curline + line + @curline = '' + case line[/\S.+/] + when /^\/(\S+)/ + case $1 + when 'set' + $'.split.each {|setting| + key, value, = setting.split(/=/) + @global_settings[key] = value + } + when 'unset' + $'.split.each {|setting| @global_settings.delete(setting)} + else + raise "invalid command \"#{$1}\"" end + when '..' if @curlevel.pop.nil? raise '".." with no previous directory' end else - if !oldcont - @curlevel.push(spline[0]) - @paths.push(@curlevel.dup) + spline = line.split() + path = spline[0] + settings = @global_settings.dup + if spline.size > 1 + spline[1..-1].each {|setting| + key, value, = setting.split(/=/) + settings[key] = value + } + end + @paths.push(@curlevel + [path]) + if settings['type'] == nil || settings['type'] == 'dir' + @curlevel.push(path) end end self |