diff options
author | stas <stas@FreeBSD.org> | 2011-08-23 16:42:31 +0800 |
---|---|---|
committer | stas <stas@FreeBSD.org> | 2011-08-23 16:42:31 +0800 |
commit | 9f57bd2f23e21ec2990280a2dccc2ac9ac28536e (patch) | |
tree | a0708d21c1532e6bc28395306b47ea83d1bd5195 /Tools | |
parent | a8973b5cb00355fd5cdfb709f1c5a25072120620 (diff) | |
download | freebsd-ports-gnome-9f57bd2f23e21ec2990280a2dccc2ac9ac28536e.tar.gz freebsd-ports-gnome-9f57bd2f23e21ec2990280a2dccc2ac9ac28536e.tar.zst freebsd-ports-gnome-9f57bd2f23e21ec2990280a2dccc2ac9ac28536e.zip |
- Make it work with ruby 1.9.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/plist | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Tools/scripts/plist b/Tools/scripts/plist index 6a903ad15f33..72c3ffe38118 100755 --- a/Tools/scripts/plist +++ b/Tools/scripts/plist @@ -53,7 +53,7 @@ class Mtree end if line[-1, 1] == "\\" @curline.concat(line[0..-2]) - next + return end line = @curline + line @curline = '' @@ -104,8 +104,7 @@ class Mtree end if __FILE__ == $0 - require 'getopts' - if !getopts('Md', 'm:') || ARGV.size != 1 + def usage $stderr.print <<-USAGE_EOF usage: #{$0} [-Md] [-m mtree] somepath Generate a pkg-plist to stdout given a previously empty somepath which @@ -116,9 +115,21 @@ usage: #{$0} [-Md] [-m mtree] somepath USAGE_EOF exit 1 end - mtree = $OPT_m || '/etc/mtree/BSD.local.dist' - pl = Plist.new(!$OPT_M, Mtree.read(mtree).paths).make(ARGV[0]) - if $OPT_d + + require 'optparse' + + begin + params = ARGV.getopts('Md', 'm:') + rescue OptionParser::ParseError => e + $stderr.puts e + usage + end + if ARGV.size != 1 + usage + end + mtree = params[:m] || '/etc/mtree/BSD.local.dist' + pl = Plist.new(!params[:M], Mtree.read(mtree).paths).make(ARGV[0]) + if params[:d] plnotdirrm = [] pldirrm = [] pl.each {|ent| |