Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / sysutils / puppet / patches / patch-ad
blob5a76021009a45559a95db0a9263631f7e9064346
1 $NetBSD$
3 Add NetBSD and update support to the pkgin provider.
5 --- lib/puppet/provider/package/pkgin.rb.orig   2013-04-07 00:25:33.000000000 +0000
6 +++ lib/puppet/provider/package/pkgin.rb
7 @@ -5,9 +5,9 @@ Puppet::Type.type(:package).provide :pkg
8  
9    commands :pkgin => "pkgin"
11 -  defaultfor :operatingsystem => :dragonfly
12 +  defaultfor :operatingsystem => [:dragonfly, :netbsd]
14 -  has_feature :installable, :uninstallable
15 +  has_feature :installable, :uninstallable, :versionable, :upgradeable
17    def self.parse_pkgin_line(package, force_status=nil)
19 @@ -59,4 +59,20 @@ Puppet::Type.type(:package).provide :pkg
20    def uninstall
21      pkgin("-y", :remove, resource[:name])
22    end
24 +  def update
25 +    pkgin("-y", :install, resource[:name])
26 +  end
28 +  def latest
29 +    output = pkgin("se", @resource[:name])
30 +    pat = @resource[:name]
32 +    if output =~ /^#{pat}-(\d\S*)\s/
33 +      return $1
34 +    else
35 +      self.err "Could not find latest version of %s" % pat
36 +      return nil
37 +    end
38 +  end
39  end