mirror of
https://git.freebsd.org/ports.git
synced 2025-06-06 13:20:32 -04:00
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.
This commit is contained in:
parent
589a9bbf0e
commit
d7e662de4c
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=102311
1 changed files with 36 additions and 14 deletions
|
@ -42,29 +42,51 @@ class Mtree
|
||||||
@paths = []
|
@paths = []
|
||||||
@curlevel = []
|
@curlevel = []
|
||||||
@strip = strip.to_i
|
@strip = strip.to_i
|
||||||
@cont = false
|
@curline = ''
|
||||||
|
@global_settings = {}
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
def parse_line(line)
|
def parse_line(line)
|
||||||
line.chomp!
|
line.chomp!
|
||||||
spline = line.split
|
if line.empty? || line[0, 1] == '#'
|
||||||
oldcont = @cont
|
return
|
||||||
@cont = line[-1, 1] == "\\"
|
|
||||||
case spline[0]
|
|
||||||
when nil
|
|
||||||
when /^[\/#]/
|
|
||||||
# ignore "command" lines and comments
|
|
||||||
when '..'
|
|
||||||
if oldcont
|
|
||||||
raise 'continued line has a .. directive?!'
|
|
||||||
end
|
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?
|
if @curlevel.pop.nil?
|
||||||
raise '".." with no previous directory'
|
raise '".." with no previous directory'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if !oldcont
|
spline = line.split()
|
||||||
@curlevel.push(spline[0])
|
path = spline[0]
|
||||||
@paths.push(@curlevel.dup)
|
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
|
||||||
end
|
end
|
||||||
self
|
self
|
||||||
|
|
Loading…
Add table
Reference in a new issue