Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Mar 2011 18:48:38 -0800 (PST)
From:      Russell Jackson <raj@csub.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/155451: [maintainer-update] sysutils/puppet: update to 2.6.6
Message-ID:  <201103110248.p2B2mc7u067768@puppet0.csub.edu>
Resent-Message-ID: <201103110330.p2B3UHsO053045@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         155451
>Category:       ports
>Synopsis:       [maintainer-update] sysutils/puppet: update to 2.6.6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 11 03:30:17 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Russell Jackson
>Release:        FreeBSD 7.1-RELEASE amd64
>Organization:
California State University Bakersfield
>Environment:
>Description:

 * Update port to 2.6.6 release.
 * Add optional patch to use new package provider.
 * Install sample auth.conf by default.

>How-To-Repeat:
>Fix:

diff --git a/puppet/Makefile b/puppet/Makefile
index 620dabb..ffb706c 100644
--- a/puppet/Makefile
+++ b/puppet/Makefile
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	puppet
-PORTVERSION=	2.6.4
+PORTVERSION=	2.6.6
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www.puppetlabs.com/downloads/puppet/
 
@@ -39,7 +39,8 @@ MAN5=	puppet.conf.5
 MAN8=	filebucket.8 pi.8 puppet.8 puppetca.8 puppetd.8 \
 	puppetdoc.8 puppetmasterd.8 puppetrun.8 ralsh.8 puppetqd.8
 
-OPTIONS=	MONGREL		"Run puppet server as a mongrel service"	Off
+OPTIONS=	MONGREL		"Run puppet server as a mongrel service"	Off \
+		PACKAGE_ORIGIN	"Use port origin as package name"		On
 
 .include <bsd.port.options.mk>
 
@@ -47,6 +48,10 @@ OPTIONS=	MONGREL		"Run puppet server as a mongrel service"	Off
 RUN_DEPENDS+=	rubygem-mongrel>=0:${PORTSDIR}/www/rubygem-mongrel
 .endif
 
+.if defined(WITH_PACKAGE_ORIGIN)
+EXTRA_PATCHES+=	${FILESDIR}/optpatch-package_origin
+.endif
+
 .include <bsd.port.pre.mk>
 
 post-patch:
@@ -71,6 +76,7 @@ do-install:
 
 post-install:
 	${INSTALL} -d ${ETCDIR}
+	${INSTALL} -m 0644 ${WRKSRC}/conf/auth.conf ${ETCDIR}/auth.conf-dist
 	${RUBY} -I ${RUBY_SITELIBDIR} ${PREFIX}/sbin/puppetmasterd \
 		--confdir=${ETCDIR} \
 		--rundir=${PUPPET_RUNDIR} \
@@ -90,7 +96,6 @@ post-install:
 .endif
 .if !defined(NOPORTEXAMPLES)
 	cd ${WRKSRC}/examples/ && ${COPYTREE_SHARE} . ${EXAMPLESDIR}
-	${INSTALL} ${WRKSRC}/conf/auth.conf ${EXAMPLESDIR}/etc
 .endif
 	@${CAT} ${PKGMESSAGE}
 
diff --git a/puppet/distinfo b/puppet/distinfo
index e04f340..ed0859f 100644
--- a/puppet/distinfo
+++ b/puppet/distinfo
@@ -1,2 +1,2 @@
-SHA256 (puppet-2.6.4.tar.gz) = 349f9b320330a3546619d4236fa30dd52af327f17767d9762f6f70465bcdaa1f
-SIZE (puppet-2.6.4.tar.gz) = 1500339
+SHA256 (puppet-2.6.6.tar.gz) = bc613c2764345947268a080ca0595aa6d4dbb0b9eab65d1476ff6542caf1647a
+SIZE (puppet-2.6.6.tar.gz) = 1514638
diff --git a/puppet/files/optpatch-package_origin b/puppet/files/optpatch-package_origin
new file mode 100644
index 0000000..f47dc94
--- /dev/null
+++ b/puppet/files/optpatch-package_origin
@@ -0,0 +1,113 @@
+diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb
+index e10a20b..fbda52d 100755
+--- lib/puppet/provider/package/freebsd.rb
++++ lib/puppet/provider/package/freebsd.rb
+@@ -1,36 +1,79 @@
+ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
+-  desc "The specific form of package management on FreeBSD.  This is an
+-    extremely quirky packaging system, in that it freely mixes between
+-    ports and packages.  Apparently all of the tools are written in Ruby,
+-    so there are plans to rewrite this support to directly use those
+-    libraries."
++  include Puppet::Util::Execution
+ 
+-  commands :pkginfo => "/usr/sbin/pkg_info",
+-    :pkgadd => "/usr/sbin/pkg_add",
+-    :pkgdelete => "/usr/sbin/pkg_delete"
++  desc "The specific form of package management on FreeBSD. Resource names must be
++  specified as the port origin: <port_category>/<port_name>."
++
++  commands :pkginfo    => "/usr/sbin/pkg_info",
++           :pkgadd     => "/usr/sbin/pkg_add",
++           :pkgdelete  => "/usr/sbin/pkg_delete"
+ 
+   confine :operatingsystem => :freebsd
++  defaultfor :operatingsystem => :freebsd
++
++  def self.instances
++    packages = []
++    
++    output = pkginfo "-aoQ"
++    output.split("\n").each do |data|
++      lhs, pkg_origin = data.split(":")
++      pkg_name = lhs.split("-").slice(0..-2).join("-")
++      pkg_version = lhs.split("-")[-1]
++
++      packages << new({
++        :provider => self.name,
++        :name     => pkg_origin,
++        :ensure   => pkg_version,
++      })
++    end
+ 
+-  def self.listcmd
+-    command(:pkginfo)
++    packages
+   end
+ 
+   def install
+     should = @resource.should(:ensure)
++  
++    origin = {}
++    [:category, :name].zip(@resource[:name].split("/")).each { |a,b| origin[a] = b }
++    Puppet.debug "origin => #{origin.inspect}"
++    if origin[:name] == nil
++      raise Puppet::Error.new "package name must be in origin format: <category>/<name>"
++    end
++
++    # source parameter is set
++    if @resource[:source]
++      source = URI.parse(@resource[:source])
++      Puppet.debug "source => #{source.inspect}"
+ 
+-    if @resource[:source] =~ /\/$/
+-      if @resource[:source] =~ /^(ftp|https?):/
+-        Puppet::Util::Execution::withenv :PACKAGESITE => @resource[:source] do
+-          pkgadd "-r", @resource[:name]
++      # URI is for local file path.
++      if (source.scheme == "file" || source.scheme == nil) && source.path
++        # Pass pkg_add only the URI path.
++        pkgadd source.path
++
++      # URI scheme is something other than 'file'.
++      elsif source.scheme && source.host && source.path
++        if source.path.end_with?(".tbz") # URI references a package.
++          # Pass pkg_add the entire URI.
++          pkgadd source.to_s
++        else # Assume URI references a directory.
++          # Set PACKAGESITE in execution environment to source URI.
++          # Pass pkg_add the origin name.
++          withenv :PACKAGESITE => source.path.end_with?("/") ? source.to_s : source.to_s << "/" do
++            Puppet.debug "ENV['PACKAGESITE'] => #{ENV['PACKAGESITE']}"
++            pkgadd "-rf", origin[:name]
++          end
+         end
++
++      # URI is not usable by pkg_add
+       else
+-        Puppet::Util::Execution::withenv :PKG_PATH => @resource[:source] do
+-          pkgadd @resource[:name]
+-        end
++        raise Puppet::Error.new "source URI is inappropriate: #{source.inspect}"
+       end
++
++    # source parameter is not set.
+     else
+-      Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}" if @resource[:source]
+-      pkgadd "-r", @resource[:name]
++      # fetch package using default PACKAGESITE directory logic.
++      # Pass pkg_add the origin name.
++      pkgadd "-rf", origin[:name]
+     end
+   end
+ 
+@@ -44,7 +87,7 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
+   end
+ 
+   def uninstall
+-    pkgdelete "#{@resource[:name]}-#{@resource.should(:ensure)}"
++    output = pkginfo "-qO", @resource[:name]
++    output.split("\n").each { |pkg_name| pkgdelete([pkg_name]) }
+   end
+ end
+-
diff --git a/puppet/files/patch-demote_ports_provider b/puppet/files/patch-demote_ports_provider
new file mode 100644
index 0000000..6e5245f
--- /dev/null
+++ b/puppet/files/patch-demote_ports_provider
@@ -0,0 +1,13 @@
+diff --git a/lib/puppet/provider/package/ports.rb b/lib/puppet/provider/package/ports.rb
+index c802092..1f2ed43 100755
+--- lib/puppet/provider/package/ports.rb
++++ lib/puppet/provider/package/ports.rb
+@@ -6,8 +6,6 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
+     :portuninstall => "/usr/local/sbin/pkg_deinstall",
+     :portinfo => "/usr/sbin/pkg_info"
+ 
+-  defaultfor :operatingsystem => :freebsd
+-
+   # I hate ports
+   %w{INTERACTIVE UNAME}.each do |var|
+     ENV.delete(var) if ENV.include?(var)
diff --git a/puppet/files/patch-git_2.6.x-16f841ed5674ef8c0782c1d8d92c5fddc4376435 b/puppet/files/patch-git_2.6.x-16f841ed5674ef8c0782c1d8d92c5fddc4376435
deleted file mode 100644
index 873c78a..0000000
--- a/puppet/files/patch-git_2.6.x-16f841ed5674ef8c0782c1d8d92c5fddc4376435
+++ /dev/null
@@ -1,120 +0,0 @@
-commit 16f841ed5674ef8c0782c1d8d92c5fddc4376435
-Author: Russell Jackson <raj@fbsd.csub.edu>
-Date:   Wed Jul 28 18:20:10 2010 -0700
-
-    ports provider broken. Removed.
-    Use "freebsd" provider by default on FreeBSD.
-
-diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb
-index 2f012a4..6664223 100755
---- lib/puppet/provider/package/freebsd.rb
-+++ lib/puppet/provider/package/freebsd.rb
-@@ -10,6 +10,7 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
-     :pkgdelete => "/usr/sbin/pkg_delete"
- 
-   confine :operatingsystem => :freebsd
-+  defaultfor :operatingsystem => :freebsd
- 
-   def self.listcmd
-     command(:pkginfo)
-diff --git a/lib/puppet/provider/package/ports.rb b/lib/puppet/provider/package/ports.rb
-deleted file mode 100755
-index c802092..0000000
---- lib/puppet/provider/package/ports.rb
-+++ /dev/null
-@@ -1,95 +0,0 @@
--Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :freebsd do
--  desc "Support for FreeBSD's ports.  Again, this still mixes packages and ports."
--
--  commands :portupgrade => "/usr/local/sbin/portupgrade",
--    :portversion => "/usr/local/sbin/portversion",
--    :portuninstall => "/usr/local/sbin/pkg_deinstall",
--    :portinfo => "/usr/sbin/pkg_info"
--
--  defaultfor :operatingsystem => :freebsd
--
--  # I hate ports
--  %w{INTERACTIVE UNAME}.each do |var|
--    ENV.delete(var) if ENV.include?(var)
--  end
--
--  def install
--    # -N: install if the package is missing, otherwise upgrade
--    # -M: yes, we're a batch, so don't ask any questions
--    cmd = %w{-N -M BATCH=yes} << @resource[:name]
--
--    output = portupgrade(*cmd)
--    if output =~ /\*\* No such /
--      raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}"
--    end
--  end
--
--  # If there are multiple packages, we only use the last one
--  def latest
--    cmd = ["-v", @resource[:name]]
--
--    begin
--      output = portversion(*cmd)
--    rescue Puppet::ExecutionFailure
--      raise Puppet::Error.new(output)
--    end
--    line = output.split("\n").pop
--
--    unless line =~ /^(\S+)\s+(\S)\s+(.+)$/
--      # There's no "latest" version, so just return a placeholder
--      return :latest
--    end
--
--    pkgstuff = $1
--    match = $2
--    info = $3
--
--    unless pkgstuff =~ /^(\S+)-([^-\s]+)$/
--      raise Puppet::Error,
--        "Could not match package info '#{pkgstuff}'"
--    end
--
--    name, version = $1, $2
--
--    if match == "=" or match == ">"
--      # we're up to date or more recent
--      return version
--    end
--
--    # Else, we need to be updated; we need to pull out the new version
--
--    unless info =~ /\((\w+) has (.+)\)/
--      raise Puppet::Error,
--        "Could not match version info '#{info}'"
--    end
--
--    source, newversion = $1, $2
--
--    debug "Newer version in #{source}"
--    newversion
--  end
--
--  def query
--    # support portorigin_glob such as "mail/postfix"
--    name = self.name
--    if name =~ /\//
--      name = self.name.split(/\//).slice(1)
--    end
--    self.class.instances.each do |instance|
--      if instance.name == name
--        return instance.properties
--      end
--    end
--
--    nil
--  end
--
--  def uninstall
--    portuninstall @resource[:name]
--  end
--
--  def update
--    install
--  end
--end
--
diff --git a/puppet/pkg-plist b/puppet/pkg-plist
index 4d6514c..9731b8d 100644
--- a/puppet/pkg-plist
+++ b/puppet/pkg-plist
@@ -10,4 +10,5 @@ sbin/puppetmasterd
 sbin/puppetqd
 sbin/puppetrun
 %%ETCDIR%%/puppet.conf-dist
-@dirrmtry %%ETCDIR%%
+%%ETCDIR%%/auth.conf-dist
+@dirrmtry etc/puppet
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103110248.p2B2mc7u067768>