[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Juerg Walz jwalz at pobox.com
Tue May 10 08:05:09 UTC 2011


The following commit has been merged in the experimental branch:
commit 15a53f0ac79cb3f164750d53219d02ad6515f02c
Author: Juerg Walz <jwalz at pobox.com>
Date:   Tue Feb 22 09:24:03 2011 +0800

    (#4258) pkgutil provider: misc enhancements
    
    Several enhancements and bug-fixes for the pkgutil package
    provider:
    
    - handle "Not in catalog"
    - fix "SAME" version detection
    - allow short package name (w/o CSW) to match
      (-> no need to specify a different package name for different
      operating systems, ex. "ruby")
    - use the "-u" command line switch for updates

diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
index f0900dc..0e2056b 100755
--- a/lib/puppet/provider/package/pkgutil.rb
+++ b/lib/puppet/provider/package/pkgutil.rb
@@ -51,12 +51,12 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
       next if line =~ /^=+> /                # catalog fetch
       next if line =~ /\d+:\d+:\d+ URL:/     # wget without -q
 
-      pkgsplit(line)
+      pkgsplit(line, hash[:justme])
     end.reject { |h| h.nil? }
 
     if hash[:justme]
       # Ensure we picked up the package line, not any pkgutil noise.
-      list.reject! { |h| h[:name] != hash[:justme] }
+      list.reject! { |h| h[:name] !~ /#{hash[:justme]}$/ }
       return list[-1]
     else
       list.reject! { |h| h[:ensure] == :absent }
@@ -66,8 +66,11 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
   end
 
   # Split the different lines into hashes.
-  def self.pkgsplit(line)
-    if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
+  def self.pkgsplit(line, justme)
+    if line == "Not in catalog"
+      Puppet.warning "Package not in pkgutil catalog: %s" % justme
+      return nil
+    elsif line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
       hash = {}
       hash[:name] = $1
       hash[:ensure] = if $2 == "notinst"
@@ -77,7 +80,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
       end
       hash[:avail] = $3
 
-      if hash[:avail] == "SAME"
+      if hash[:avail] =~ /^SAME\s*$/
         hash[:avail] = hash[:ensure]
       end
 
@@ -110,7 +113,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
   end
 
   def update
-    pkguti "-y", "-i", @resource[:name]
+    pkguti "-y", "-u", @resource[:name]
   end
 
   def uninstall

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list