darwinport.rb.patch
| /usr/lib/ruby/site_ruby/1.8/puppet/provider/package/darwinport.rb 2009-06-10 13:33:27.000000000 -0700 | ||
|---|---|---|
| 46 | 46 |
def install |
| 47 | 47 |
should = @resource.should(:ensure) |
| 48 | 48 | |
| 49 |
# Seems like you can always say 'upgrade' |
|
| 50 |
output = port "upgrade", @resource[:name]
|
|
| 49 |
# Seems like you can always say 'upgrade' not quite... 'install' seems to be required before you can do 'upgrade'
|
|
| 50 |
output = port "install", @resource[:name]
|
|
| 51 | 51 |
if output =~ /^Error: No port/ |
| 52 | 52 |
raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name] |
| 53 | 53 |
end |
| ... | ... | |
| 65 | 65 |
end |
| 66 | 66 | |
| 67 | 67 |
def latest |
| 68 |
info = port :search, "^#{@resource[:name]}$"
|
|
| 68 |
# info = port :search, "^#{@resource[:name]}$"
|
|
| 69 |
info = port :list, "#{@resource[:name]}"
|
|
| 69 | 70 | |
| 70 | 71 |
if $? != 0 or info =~ /^Error/ |
| 71 | 72 |
return nil |
| 72 | 73 |
end |
| 73 | 74 | |
| 74 | 75 |
ary = info.split(/\s+/) |
| 75 |
version = ary[2].sub(/^@/, '')
|
|
| 76 |
version = ary[1].sub(/^@/, '') # versions are now the second in, not the third ins
|
|
| 76 | 77 | |
| 77 | 78 |
return version |
| 78 | 79 |
end |
| ... | ... | |
| 82 | 83 |
end |
| 83 | 84 | |
| 84 | 85 |
def update |
| 85 |
return install() |
|
| 86 |
should = @resource.should(:ensure) |
|
| 87 | ||
| 88 |
# use 'upgrade' for update mode |
|
| 89 |
output = port "upgrade", @resource[:name] |
|
| 90 |
if output =~ /^Error: No port/ |
|
| 91 |
raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name] |
|
| 92 |
end |
|
| 86 | 93 |
end |
| 87 | 94 |
end |