aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authormmoll <mmoll@FreeBSD.org>2015-12-13 01:31:17 +0800
committermmoll <mmoll@FreeBSD.org>2015-12-13 01:31:17 +0800
commit6f87b88713a87138e476b1d5b90d10ee965cf524 (patch)
tree5df6800ef57fac4ac9a8405ea5803e556bbaed60 /sysutils
parentd79e78842d91ff2f75aecdf3eb2ba9108d03383c (diff)
downloadfreebsd-ports-gnome-6f87b88713a87138e476b1d5b90d10ee965cf524.tar.gz
freebsd-ports-gnome-6f87b88713a87138e476b1d5b90d10ee965cf524.tar.zst
freebsd-ports-gnome-6f87b88713a87138e476b1d5b90d10ee965cf524.zip
sysutils/puppet: refresh pkgng provider and remove pkg_* patches
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/puppet/Makefile22
-rw-r--r--sysutils/puppet/files/optpatch-package_origin197
-rw-r--r--sysutils/puppet/files/optpatch-package_root11
-rw-r--r--sysutils/puppet/files/patch-lib_puppet_provider_package_pkgng.rb50
4 files changed, 22 insertions, 258 deletions
diff --git a/sysutils/puppet/Makefile b/sysutils/puppet/Makefile
index 68e0d964274f..ecb503580221 100644
--- a/sysutils/puppet/Makefile
+++ b/sysutils/puppet/Makefile
@@ -3,6 +3,7 @@
PORTNAME= puppet
PORTVERSION= 3.8.4
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://downloads.puppetlabs.com/puppet/
@@ -32,30 +33,9 @@ SUB_FILES+= pkg-message
SUB_LIST= RUBY=${RUBY}
OPTIONS_DEFINE= DOCS EXAMPLES
-OPTIONS_DEFAULT= PACKAGE_ORIGIN
-OPTIONS_RADIO= PATCHES
-OPTIONS_RADIO_PATCHES= PACKAGE_ORIGIN PACKAGE_ROOT
-PACKAGE_ORIGIN_DESC= Use port origin as package name
-PACKAGE_ROOT_DESC= Use PACKAGEROOT instead of PACKAGESITE
-PATCHES_DESC= Optional exclusive patches
-
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MPACKAGE_ROOT}
-.if ! ${PORT_OPTIONS:MPACKAGE_ORIGIN}
-EXTRA_PATCHES+= ${FILESDIR}/optpatch-package_root
-.else
-BROKEN= PACKAGE_ROOT option patch is incompatible with PACKAGE_ORIGIN patch.
-.endif
-.endif
.include <bsd.port.pre.mk>
-.if ${PORT_OPTIONS:MPACKAGE_ORIGIN}
-EXTRA_PATCHES+= ${FILESDIR}/optpatch-package_origin
-RUN_DEPENDS+= rubygem-bzip2-ruby>=0:${PORTSDIR}/archivers/rubygem-bzip2-ruby
-.endif
-
post-patch:
@${REINPLACE_CMD} -e "s|/etc/puppet|${ETCDIR}|" \
${WRKSRC}/install.rb \
diff --git a/sysutils/puppet/files/optpatch-package_origin b/sysutils/puppet/files/optpatch-package_origin
deleted file mode 100644
index c087c85d7960..000000000000
--- a/sysutils/puppet/files/optpatch-package_origin
+++ /dev/null
@@ -1,197 +0,0 @@
---- lib/puppet/provider/package/freebsd.rb.ori 2013-09-19 14:43:54.000000000 -0600
-+++ lib/puppet/provider/package/freebsd.rb 2013-09-19 14:40:09.000000000 -0600
-@@ -1,35 +1,163 @@
--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."
--
-- commands :pkginfo => "/usr/sbin/pkg_info",
-- :pkgadd => "/usr/sbin/pkg_add",
-- :pkgdelete => "/usr/sbin/pkg_delete"
-+require 'open-uri'
-+require 'net/ftp'
-+require 'bzip2'
-+
-+Puppet::Type.type(:package).provide :freebsd, :parent => Puppet::Provider::Package do
-+ include Puppet::Util::Execution
-+
-+ 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.listcmd
-- command(:pkginfo)
-+ class_variable_set(:@@lock, Mutex.new)
-+ class_variable_set(:@@ports_index, nil)
-+
-+ # fix bug in URI::FTP merge method that tries to set typecode
-+ # even when other is a string.
-+ class URI::FTP
-+ def merge(other)
-+ tmp = super(other)
-+ if self != tmp
-+ tmp.set_typecode(other.typecode) rescue NoMethodError
-+ end
-+ return tmp
-+ end
- end
-
-- def install
-- if @resource[:source] =~ /\/$/
-- if @resource[:source] =~ /^(ftp|https?):/
-- Puppet::Util.withenv :PACKAGESITE => @resource[:source] do
-- pkgadd "-r", @resource[:name]
-+ def self.parse_pkg_string(pkg_string)
-+ {
-+ :pkg_name => pkg_string.split("-").slice(0..-2).join("-"),
-+ :pkg_version => pkg_string.split("-")[-1],
-+ }
-+ end
-+
-+ def self.unparse_pkg_info(pkg_info)
-+ [:pkg_name, :pkg_version].map { |key| pkg_info[key] }.join("-")
-+ end
-+
-+ def self.parse_origin(origin_path)
-+ begin
-+ origin = {
-+ :port_category => origin_path.split("/").fetch(-2),
-+ :port_name => origin_path.split("/").fetch(-1),
-+ }
-+ rescue IndexError
-+ raise Puppet::Error.new "#{origin_path}: not in required origin format: .*/<port_category>/<port_name>"
-+ end
-+ origin
-+ end
-+
-+ def self.instances
-+ packages = []
-+ output = pkginfo "-aoQ"
-+ output.split("\n").each do |data|
-+ pkg_string, pkg_origin = data.split(":")
-+ pkg_info = self.parse_pkg_string(pkg_string)
-+
-+ packages << new({
-+ :provider => self.name,
-+ :name => pkg_origin,
-+ :ensure => pkg_info[:pkg_version],
-+ })
-+ end
-+ packages
-+ end
-+
-+ def ports_index
-+ @@lock.synchronize do
-+ if @@ports_index.nil?
-+ @@ports_index = {}
-+ uri = source.merge "INDEX.bz2"
-+ Puppet.debug "Fetching INDEX: #{uri.inspect}"
-+ begin
-+ Bzip2::Reader.open(uri) do |f|
-+ while (line = f.gets)
-+ fields = line.split("|")
-+ pkg_info = self.class.parse_pkg_string(fields[0])
-+ origin = self.class.parse_origin(fields[1])
-+ @@ports_index[origin] = pkg_info
-+ end
-+ end
-+ rescue IOError, OpenURI::HTTPError, Net::FTPError
-+ @@ports_index = nil
-+ raise Puppet::Error.new "Could not fetch ports INDEX: #{$!}"
- end
-- else
-- Puppet::Util.withenv :PKG_PATH => @resource[:source] do
-- pkgadd @resource[:name]
-+ end
-+ end
-+ @@ports_index
-+ end
-+
-+ def uri_path
-+ Facter.loadfacts
-+ File.join(
-+ "/", "pub", "FreeBSD", "ports",
-+ Facter.value(:hardwareisa),
-+ [
-+ "packages",
-+ Facter.value(:kernelmajversion).split(".")[0],
-+ "stable",
-+ ].join("-")
-+ ) << "/"
-+ end
-+
-+ def source
-+ if !defined? @source
-+ if @resource[:source]
-+ @source = URI.parse(@resource[:source])
-+ if @source.path.empty?
-+ @source.merge! uri_path
- end
-+ else # source parameter not set; build default source URI
-+ @source = URI::FTP.build({
-+ :host => "ftp.freebsd.org",
-+ :path => uri_path,
-+ })
- end
-+ Puppet.debug "Package: #{@resource[:name]}: source => #{@source.inspect}"
-+ end
-+ @source
-+ end
-+
-+ def origin
-+ if !defined? @origin
-+ @origin = self.class.parse_origin(@resource[:name])
-+ Puppet.debug "Package: #{@resource[:name]}: origin => #{@origin.inspect}"
-+ end
-+ @origin
-+ end
-+
-+ def package_uri
-+ begin
-+ pkg_name = self.class.unparse_pkg_info(ports_index.fetch(origin))
-+ rescue IndexError
-+ raise Puppet::Error.new "package not found in INDEX"
-+ end
-+ uri = source.merge File.join("All", pkg_name + ".tbz")
-+ Puppet.debug "Package: #{@resource[:name]}: package_uri => #{uri.inspect}"
-+ uri
-+ end
-+
-+ def install
-+ should = @resource.should(:ensure)
-+ origin # call origin so we check the package name for correctness early
-+
-+ # Source URI is for local file path.
-+ if !source.absolute? or source.scheme == "file"
-+ pkgadd source.path
-+ # Source URI is to specific package file
-+ elsif source.absolute? && source.path.end_with?(".tbz")
-+ pkgadd source.to_s
-+ # Source URI is to a package repository
- else
-- Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}" if @resource[:source]
-- pkgadd "-r", @resource[:name]
-+ pkgadd "-f", package_uri.to_s
- end
-+ nil
- end
-
- def query
-@@ -42,6 +170,7 @@
- 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/sysutils/puppet/files/optpatch-package_root b/sysutils/puppet/files/optpatch-package_root
deleted file mode 100644
index 489ab5d0b5ed..000000000000
--- a/sysutils/puppet/files/optpatch-package_root
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/puppet/provider/package/freebsd.rb.orig 2012-10-21 14:45:57.110106541 -0400
-+++ lib/puppet/provider/package/freebsd.rb 2012-10-21 14:47:41.281104749 -0400
-@@ -20,7 +20,7 @@
-
- if @resource[:source] =~ /\/$/
- if @resource[:source] =~ /^(ftp|https?):/
-- Puppet::Util.withenv :PACKAGESITE => @resource[:source] do
-+ Puppet::Util.withenv :PACKAGEROOT => @resource[:source] do
- pkgadd "-r", @resource[:name]
- end
- else
diff --git a/sysutils/puppet/files/patch-lib_puppet_provider_package_pkgng.rb b/sysutils/puppet/files/patch-lib_puppet_provider_package_pkgng.rb
index 2f11e1efc416..bd310d35c0a7 100644
--- a/sysutils/puppet/files/patch-lib_puppet_provider_package_pkgng.rb
+++ b/sysutils/puppet/files/patch-lib_puppet_provider_package_pkgng.rb
@@ -1,6 +1,6 @@
--- /dev/null
+++ lib/puppet/provider/package/pkgng.rb
-@@ -0,0 +1,150 @@
+@@ -0,0 +1,142 @@
+require 'puppet/provider/package'
+
+Puppet::Type.type(:package).provide :pkgng, :parent => Puppet::Provider::Package do
@@ -16,13 +16,11 @@
+ has_feature :upgradeable
+
+ def self.get_query
-+ @pkg_query = @pkg_query || pkg(['query', '-a', '%n %v %o'])
-+ @pkg_query
++ pkg(['query', '-a', '%n %v %o'])
+ end
+
+ def self.get_version_list
-+ @version_list = @version_list || pkg(['version', '-voRL='])
-+ @version_list
++ @version_info_list ||= pkg(['version', '-voRL='])
+ end
+
+ def self.get_latest_version(origin)
@@ -84,19 +82,20 @@
+ source = resource[:source]
+ source = URI(source) unless source.nil?
+
-+ # If resource[:name] is actually an origin (e.g. 'www/curl' instead of
-+ # just 'curl'), drop the category prefix. pkgng doesn't support version
-+ # pinning with the origin syntax (pkg install curl-1.2.3 is valid, but
-+ # pkg install www/curl-1.2.3 is not).
-+ if resource[:name] =~ /\//
-+ installname = resource[:name].split('/')[1]
-+ else
-+ installname = resource[:name]
-+ end
-+
+ # Ensure we handle the version
-+ if resource[:ensure] =~ /\./
-+ installname += '-' + resource[:ensure]
++ case resource[:ensure]
++ when true, false, Symbol
++ installname = resource[:name]
++ else
++ # If resource[:name] is actually an origin (e.g. 'www/curl' instead of
++ # just 'curl'), drop the category prefix. pkgng doesn't support version
++ # pinning with the origin syntax (pkg install curl-1.2.3 is valid, but
++ # pkg install www/curl-1.2.3 is not).
++ if resource[:name] =~ /\//
++ installname = resource[:name].split('/')[1] + '-' + resource[:ensure]
++ else
++ installname = resource[:name] + '-' + resource[:ensure]
++ end
+ end
+
+ if not source # install using default repo logic
@@ -107,6 +106,7 @@
+ else # add package located at URL
+ args = ['add', '-q', source.to_s]
+ end
++
+ pkg(args)
+ end
+
@@ -115,7 +115,6 @@
+ end
+
+ def query
-+ debug @property_hash
+ if @property_hash[:ensure] == nil
+ return nil
+ else
@@ -125,22 +124,11 @@
+ end
+
+ def version
-+ debug @property_hash[:version].inspect
+ @property_hash[:version]
+ end
+
-+ def version=
-+ pkg(['install', '-qy', "#{resource[:name]}-#{resource[:version]}"])
-+ end
-+
-+ def origin
-+ debug @property_hash[:origin].inspect
-+ @property_hash[:origin]
-+ end
-+
+ # Upgrade to the latest version
+ def update
-+ debug 'pkgng: update called'
+ install
+ end
+
@@ -150,4 +138,8 @@
+ @property_hash[:latest]
+ end
+
++ def origin
++ @property_hash[:origin]
++ end
++
+end