From e8baa285975dac507da3337e9c598e1aa44a78c2 Mon Sep 17 00:00:00 2001 From: Cory Stephenson Date: Sun, 24 Aug 2014 02:20:53 -0500 Subject: Have freebsd port use pkg info if the freebsd version is >= 10000017 --- lib/chef/provider/package/freebsd/port.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/chef/provider/package/freebsd') diff --git a/lib/chef/provider/package/freebsd/port.rb b/lib/chef/provider/package/freebsd/port.rb index 4b3510f0e9..536b73728f 100644 --- a/lib/chef/provider/package/freebsd/port.rb +++ b/lib/chef/provider/package/freebsd/port.rb @@ -56,9 +56,14 @@ class Chef private + def ships_with_pkgng? + # It was not until __FreeBSD_version 1000017 that pkgng became + # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'. + node[:os_version].to_i >= 1000017 + end + def supports_pkgng? - with_pkgng = makefile_variable_value('WITH_PKGNG') - with_pkgng && with_pkgng =~ /yes/i + ships_with_pkgng? || !!shell_out!("make -V WITH_PKGNG", :env => nil).stdout.match(/yes/i) end end -- cgit v1.2.1 From 712d4a87678537613413ed730888d63f3b03acd9 Mon Sep 17 00:00:00 2001 From: Cory Stephenson Date: Thu, 28 Aug 2014 18:54:29 -0500 Subject: Move supports_with_pkgng? check to the freebsd_package package. --- lib/chef/provider/package/freebsd/port.rb | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'lib/chef/provider/package/freebsd') diff --git a/lib/chef/provider/package/freebsd/port.rb b/lib/chef/provider/package/freebsd/port.rb index 536b73728f..8b191179f0 100644 --- a/lib/chef/provider/package/freebsd/port.rb +++ b/lib/chef/provider/package/freebsd/port.rb @@ -34,7 +34,7 @@ class Chef end def current_installed_version - pkg_info = if supports_pkgng? + pkg_info = if @new_resource.supports_pkgng? shell_out!("pkg info \"#{@new_resource.package_name}\"", :env => nil, :returns => [0,70]) else shell_out!("pkg_info -E \"#{@new_resource.package_name}*\"", :env => nil, :returns => [0,1]) @@ -53,19 +53,6 @@ class Chef def port_dir super(@new_resource.package_name) end - - private - - def ships_with_pkgng? - # It was not until __FreeBSD_version 1000017 that pkgng became - # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'. - node[:os_version].to_i >= 1000017 - end - - def supports_pkgng? - ships_with_pkgng? || !!shell_out!("make -V WITH_PKGNG", :env => nil).stdout.match(/yes/i) - end - end end end -- cgit v1.2.1