[csw-devel] SF.net SVN: gar:[6663] csw/mgar/pkg/puppet/trunk
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Oct 2 14:00:32 CEST 2009
Revision: 6663
http://gar.svn.sourceforge.net/gar/?rev=6663&view=rev
Author: wahwah
Date: 2009-10-02 12:00:32 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
puppet: support for pkgutil
Modified Paths:
--------------
csw/mgar/pkg/puppet/trunk/Makefile
csw/mgar/pkg/puppet/trunk/checksums
Added Paths:
-----------
csw/mgar/pkg/puppet/trunk/files/0001-pkgutil-provider.patch
csw/mgar/pkg/puppet/trunk/files/0002-pkgutil-specific-command-line-opts.patch
Modified: csw/mgar/pkg/puppet/trunk/Makefile
===================================================================
--- csw/mgar/pkg/puppet/trunk/Makefile 2009-10-02 11:04:40 UTC (rev 6662)
+++ csw/mgar/pkg/puppet/trunk/Makefile 2009-10-02 12:00:32 UTC (rev 6663)
@@ -52,6 +52,9 @@
TEST_SCRIPTS =
INSTALL_SCRIPTS = puppet
+PATCHFILES = 0001-pkgutil-provider.patch
+PATCHFILES += 0002-pkgutil-specific-command-line-opts.patch
+
include gar/category.mk
install-puppet:
Modified: csw/mgar/pkg/puppet/trunk/checksums
===================================================================
--- csw/mgar/pkg/puppet/trunk/checksums 2009-10-02 11:04:40 UTC (rev 6662)
+++ csw/mgar/pkg/puppet/trunk/checksums 2009-10-02 12:00:32 UTC (rev 6663)
@@ -1,4 +1,6 @@
-7331526709cf8cbce59421157068c184 download/cswpuppetd
-066f9053e1342b19cf83f3f78ce2259c download/cswpuppetmasterd
+cbf89ddcce76bfbce3b92aa4599f4e4c download/0001-pkgutil-provider.patch
+4bf70f19b9a69bf00590d0e639f4e344 download/0002-pkgutil-specific-command-line-opts.patch
+71174fc47265e5c81a0e32366563e5e4 download/cswpuppetd
+fd5e49b7d2b7d288d5beb224d0cfa855 download/cswpuppetmasterd
3ab0d4f9801075bc78b68b766b496fc7 download/cswusergroup
288d46dee00acad64d0f3ecc6d8ba6fa download/puppet-0.24.8.tgz
Added: csw/mgar/pkg/puppet/trunk/files/0001-pkgutil-provider.patch
===================================================================
--- csw/mgar/pkg/puppet/trunk/files/0001-pkgutil-provider.patch (rev 0)
+++ csw/mgar/pkg/puppet/trunk/files/0001-pkgutil-provider.patch 2009-10-02 12:00:32 UTC (rev 6663)
@@ -0,0 +1,131 @@
+From e1c96e313d15f21857a2dd098534de374e8f765d Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Maciej=20Blizi=C5=84ski?= <blizinski at google.com>
+Date: Fri, 2 Oct 2009 11:46:59 +0100
+Subject: [PATCH 1/2] pkgutil provider
+
+---
+ lib/puppet/provider/package/pkgutil.rb | 112 ++++++++++++++++++++++++++++++++
+ 1 files changed, 112 insertions(+), 0 deletions(-)
+ create mode 100755 lib/puppet/provider/package/pkgutil.rb
+
+diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
+new file mode 100755
+index 0000000..9242cb1
+--- /dev/null
++++ b/lib/puppet/provider/package/pkgutil.rb
+@@ -0,0 +1,112 @@
++# Packaging using Blastwave's pkgutil program.
++Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun do
++ desc "Package management using ``pkgutil`` command on Solaris."
++ pkgutil = "pkgutil"
++ if FileTest.executable?("/opt/csw/bin/pkgutil")
++ pkgutil = "/opt/csw/bin/pkgutil"
++ end
++
++ confine :operatingsystem => :solaris
++
++ commands :pkgutil => pkgutil
++
++ # This is so stupid, but then, so is blastwave.
++ ENV["PAGER"] = "/usr/bin/cat"
++
++ def self.extended(mod)
++ unless command(:pkgutil) != "pkgutil"
++ raise Puppet::Error,
++ "The pkgutil command is missing; blastwave packaging unavailable"
++ end
++ 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]
++ command << hash[:justme]
++ end
++
++ output = pkgutil command
++
++ list = output.split("\n").collect do |line|
++ next if line =~ /^#/
++ next if line =~ /^WARNING/
++ next if line =~ /localrev\s+remoterev/
++
++ blastsplit(line)
++ end.reject { |h| h.nil? }
++
++ if hash[:justme]
++ return list[0]
++ else
++ list.reject! { |h|
++ h[:ensure] == :absent
++ }
++ return list
++ end
++
++ end
++
++ # Split the different lines into hashes.
++ def self.blastsplit(line)
++ if line =~ /\s*(\S+)\s+((\[Not installed\])|(\S+))\s+(\S+)/
++ hash = {}
++ hash[:name] = $1
++ hash[:ensure] = if $2 == "[Not installed]"
++ :absent
++ else
++ $2
++ end
++ hash[:avail] = $5
++
++ 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
++ pkgutil "-y", :install, @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
++ pkgutil "-y", :upgrade, @resource[:name]
++ end
++
++ def uninstall
++ pkgutil "-y", :remove, @resource[:name]
++ end
++end
++
+--
+1.6.3.2
+
Added: csw/mgar/pkg/puppet/trunk/files/0002-pkgutil-specific-command-line-opts.patch
===================================================================
--- csw/mgar/pkg/puppet/trunk/files/0002-pkgutil-specific-command-line-opts.patch (rev 0)
+++ csw/mgar/pkg/puppet/trunk/files/0002-pkgutil-specific-command-line-opts.patch 2009-10-02 12:00:32 UTC (rev 6663)
@@ -0,0 +1,39 @@
+From ff82126b6566776f7b988a84c00c7552edde9db1 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Maciej=20Blizi=C5=84ski?= <blizinski at google.com>
+Date: Fri, 2 Oct 2009 12:27:44 +0100
+Subject: [PATCH 2/2] pkgutil-specific command line opts
+
+---
+ lib/puppet/provider/package/pkgutil.rb | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
+index 9242cb1..8d8551b 100755
+--- a/lib/puppet/provider/package/pkgutil.rb
++++ b/lib/puppet/provider/package/pkgutil.rb
+@@ -83,7 +83,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
+ end
+
+ def install
+- pkgutil "-y", :install, @resource[:name]
++ pkgutil "-y", "--install", @resource[:name]
+ end
+
+ # Retrieve the version from the current package file.
+@@ -102,11 +102,11 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
+
+ # Remove the old package, and install the new one
+ def update
+- pkgutil "-y", :upgrade, @resource[:name]
++ pkgutil "-y", "--upgrade", @resource[:name]
+ end
+
+ def uninstall
+- pkgutil "-y", :remove, @resource[:name]
++ pkgutil "-y", "--remove", @resource[:name]
+ end
+ end
+
+--
+1.6.3.2
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list