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

Dominic Cleal dcleal at redhat.com
Tue May 10 08:02:41 UTC 2011


The following commit has been merged in the experimental branch:
commit 485ac3865d54b8a0819a75c7d2eb06f11b7daea7
Author: Dominic Cleal <dcleal at redhat.com>
Date:   Mon Nov 29 12:01:04 2010 +0000

    Changing indentation to 2-spaces as per 2.6+ style

diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
index b80cf74..4e2c0d9 100755
--- a/lib/puppet/provider/package/pkgutil.rb
+++ b/lib/puppet/provider/package/pkgutil.rb
@@ -1,129 +1,129 @@
 # Packaging using Peter Bonivart's pkgutil program.
 Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun do
-    desc "Package management using Peter Bonivart's ``pkgutil`` command on Solaris."
-    pkguti = "pkgutil"
-    if FileTest.executable?("/opt/csw/bin/pkgutil")
-        pkguti = "/opt/csw/bin/pkgutil"
-    end
+  desc "Package management using Peter Bonivart's ``pkgutil`` command on Solaris."
+  pkguti = "pkgutil"
+  if FileTest.executable?("/opt/csw/bin/pkgutil")
+    pkguti = "/opt/csw/bin/pkgutil"
+  end
 
-    confine :operatingsystem => :solaris
+  confine :operatingsystem => :solaris
 
-    commands :pkguti => pkguti
+  commands :pkguti => pkguti
 
-    # This is so stupid, but then, so is blastwave.
-    ENV["PAGER"] = "/usr/bin/cat"
+  # This is so stupid, but then, so is blastwave.
+  ENV["PAGER"] = "/usr/bin/cat"
 
-    def self.extended(mod)
-        unless command(:pkguti) != "pkgutil"
-            raise Puppet::Error,
-                "The pkgutil command is missing; pkgutil packaging unavailable"
-        end
+  def self.extended(mod)
+    unless command(:pkguti) != "pkgutil"
+      raise Puppet::Error,
+        "The pkgutil command is missing; pkgutil packaging unavailable"
+    end
 
-        unless FileTest.exists?("/var/opt/csw/pkgutil/admin")
-            Puppet.notice "It is highly recommended you create '/var/opt/csw/pkgutil/admin'."
-            Puppet.notice "See /var/opt/csw/pkgutil"
-        end
+    unless FileTest.exists?("/var/opt/csw/pkgutil/admin")
+      Puppet.notice "It is highly recommended you create '/var/opt/csw/pkgutil/admin'."
+      Puppet.notice "See /var/opt/csw/pkgutil"
     end
+  end
 
-    def self.instances(hash = {})
-        blastlist(hash).collect do |bhash|
-            bhash.delete(:avail)
-            new(bhash)
-        end
+  def self.instances(hash = {})
+    blastlist(hash).collect do |bhash|
+      bhash.delete(:avail)
+      new(bhash)
     end
+  end
 
-    # Turn our blastwave listing into a bunch of hashes.
-    def self.blastlist(hash)
-        command = ["-c"]
-
-        if hash[:justme]
-            # The --single option speeds up the execution, because it queries
-            # the package managament system for one package only.
-            command << ["--single"]
-            command << hash[:justme]
-        end
-
-        output = pkguti command
-
-        list = output.split("\n").collect do |line|
-            next if line =~ /^#/
-            next if line =~ /installed\s+catalog/  # header of package list
-            next if line =~ /^Checking integrity / # use_gpg
-            next if line =~ /^gpg: /               # gpg verification
-            next if line =~ /^=+> /                # catalog fetch
-            next if line =~ /\d+:\d+:\d+ URL:/     # wget without -q
-
-            parsed = blastsplit(line)
-
-            # When finding one package, ensure we picked up the package line
-            # itself, not any pkgutil noise.
-            next if hash[:justme] and parsed[:name] != hash[:justme]
-
-            parsed
-        end.reject { |h| h.nil? }
-
-        if hash[:justme]
-            return list[-1]
-        else
-            list.reject! { |h|
-                h[:ensure] == :absent
-            }
-            return list
-        end
+  # Turn our blastwave listing into a bunch of hashes.
+  def self.blastlist(hash)
+    command = ["-c"]
 
+    if hash[:justme]
+      # The --single option speeds up the execution, because it queries
+      # the package managament system for one package only.
+      command << ["--single"]
+      command << hash[:justme]
     end
 
-    # Split the different lines into hashes.
-    def self.blastsplit(line)
-        if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
-            hash = {}
-            hash[:name] = $1
-            hash[:ensure] = if $2 == "notinst"
-                :absent
-            else
-                $2
-            end
-            hash[:avail] = $3
-
-            if hash[:avail] == "SAME"
-                hash[:avail] = hash[:ensure]
-            end
-
-            # Use the name method, so it works with subclasses.
-            hash[:provider] = self.name
-
-            return hash
-        else
-            Puppet.warning "Cannot match %s" % line
-            return nil
-        end
-    end
+    output = pkguti command
 
-    def install
-        pkguti "-y", "-i", @resource[:name]
-    end
+    list = output.split("\n").collect do |line|
+      next if line =~ /^#/
+      next if line =~ /installed\s+catalog/  # header of package list
+      next if line =~ /^Checking integrity / # use_gpg
+      next if line =~ /^gpg: /         # gpg verification
+      next if line =~ /^=+> /        # catalog fetch
+      next if line =~ /\d+:\d+:\d+ URL:/   # wget without -q
 
-    # Retrieve the version from the current package file.
-    def latest
-        hash = self.class.blastlist(:justme => @resource[:name])
-        hash[:avail]
-    end
+      parsed = blastsplit(line)
 
-    def query
-        if hash = self.class.blastlist(:justme => @resource[:name])
-            hash
-        else
-            {:ensure => :absent}
-        end
-    end
+      # When finding one package, ensure we picked up the package line
+      # itself, not any pkgutil noise.
+      next if hash[:justme] and parsed[:name] != hash[:justme]
+
+      parsed
+    end.reject { |h| h.nil? }
 
-    # Remove the old package, and install the new one
-    def update
-        pkguti "-y", "-i", @resource[:name]
+    if hash[:justme]
+      return list[-1]
+    else
+      list.reject! { |h|
+        h[:ensure] == :absent
+      }
+      return list
     end
 
-    def uninstall
-        pkguti "-y", "-r", @resource[:name]
+  end
+
+  # Split the different lines into hashes.
+  def self.blastsplit(line)
+    if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
+      hash = {}
+      hash[:name] = $1
+      hash[:ensure] = if $2 == "notinst"
+        :absent
+      else
+        $2
+      end
+      hash[:avail] = $3
+
+      if hash[:avail] == "SAME"
+        hash[:avail] = hash[:ensure]
+      end
+
+      # Use the name method, so it works with subclasses.
+      hash[:provider] = self.name
+
+      return hash
+    else
+      Puppet.warning "Cannot match %s" % line
+      return nil
+    end
+  end
+
+  def install
+    pkguti "-y", "-i", @resource[:name]
+  end
+
+  # Retrieve the version from the current package file.
+  def latest
+    hash = self.class.blastlist(:justme => @resource[:name])
+    hash[:avail]
+  end
+
+  def query
+    if hash = self.class.blastlist(:justme => @resource[:name])
+      hash
+    else
+      {:ensure => :absent}
     end
+  end
+
+  # Remove the old package, and install the new one
+  def update
+    pkguti "-y", "-i", @resource[:name]
+  end
+
+  def uninstall
+    pkguti "-y", "-r", @resource[:name]
+  end
 end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list