diff --git a/sysutils/ruby-facter/Makefile b/sysutils/ruby-facter/Makefile index d14803157f1..eae9c580afb 100644 --- a/sysutils/ruby-facter/Makefile +++ b/sysutils/ruby-facter/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.81 2015/08/24 10:32:00 jasper Exp $ +# $OpenBSD: Makefile,v 1.82 2015/09/01 07:23:35 jasper Exp $ PORTROACH= limit:^2 @@ -6,7 +6,7 @@ COMMENT= Ruby library for retrieving facts from operating systems VERSION= 2.4.4 DISTNAME= facter-${VERSION} -REVISION= 3 +REVISION= 4 PKGSPEC= facter->=2.0,<3.0 CATEGORIES= sysutils diff --git a/sysutils/ruby-facter/patches/patch-lib_facter_partitions_rb b/sysutils/ruby-facter/patches/patch-lib_facter_partitions_rb new file mode 100644 index 00000000000..79598ef2329 --- /dev/null +++ b/sysutils/ruby-facter/patches/patch-lib_facter_partitions_rb @@ -0,0 +1,15 @@ +$OpenBSD: patch-lib_facter_partitions_rb,v 1.4 2015/09/01 07:23:35 jasper Exp $ + +Cache df/mount output to prevent running these programs 3 times for every partition found. +https://github.com/puppetlabs/facter/pull/1119 + +--- lib/facter/partitions.rb.orig Mon Aug 31 19:03:25 2015 ++++ lib/facter/partitions.rb Mon Aug 31 19:03:35 2015 +@@ -36,4 +36,7 @@ Facter.add(:partitions) do + end + partitions + end ++ on_flush do ++ Facter::Util::Partitions.flush! if Facter::Util::Partitions.flushable? ++ end + end diff --git a/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_openbsd_rb b/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_openbsd_rb index fc161c49e45..3fe170911c9 100644 --- a/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_openbsd_rb +++ b/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_openbsd_rb @@ -1,10 +1,11 @@ -$OpenBSD: patch-lib_facter_util_partitions_openbsd_rb,v 1.4 2015/08/24 10:32:00 jasper Exp $ +$OpenBSD: patch-lib_facter_util_partitions_openbsd_rb,v 1.5 2015/09/01 07:23:35 jasper Exp $ Cache df/mount output to prevent running these programs 3 times for every partition found. +https://github.com/puppetlabs/facter/pull/1119 ---- lib/facter/util/partitions/openbsd.rb.orig Mon Aug 24 09:42:02 2015 -+++ lib/facter/util/partitions/openbsd.rb Mon Aug 24 09:42:05 2015 -@@ -1,7 +1,11 @@ +--- lib/facter/util/partitions/openbsd.rb.orig Tue May 19 18:41:15 2015 ++++ lib/facter/util/partitions/openbsd.rb Mon Aug 31 19:03:46 2015 +@@ -1,9 +1,26 @@ module Facter::Util::Partitions module OpenBSD + @df_output = nil @@ -16,8 +17,23 @@ Cache df/mount output to prevent running these programs 3 times for every partit + @df_output.scan(/\/dev\/(\S+)/).flatten end ++ def self.flushable? ++ true ++ end ++ ++ def self.flush! ++ @df_output = nil ++ @mount_output = nil ++ end ++ ++ def self.flushed? ++ !@df_output ++ end ++ # On OpenBSD partitions don't have a UUID; disks have DUID but that's not -@@ -22,19 +26,29 @@ module Facter::Util::Partitions + # compatible. + def self.uuid(partition) +@@ -22,19 +39,29 @@ module Facter::Util::Partitions def self.filesystem(partition) scan_mount(/\/dev\/#{partition}\son\s\S+\stype\s(\S+)/) end @@ -36,7 +52,7 @@ Cache df/mount output to prevent running these programs 3 times for every partit + def self.run_df + Facter::Core::Execution.exec('df -k') + end -+ ++ def self.scan_mount(scan_regex) - Facter::Core::Execution.exec('mount').scan(scan_regex).flatten.first + @mount_output ||= run_mount diff --git a/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_rb b/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_rb new file mode 100644 index 00000000000..20734241d90 --- /dev/null +++ b/sysutils/ruby-facter/patches/patch-lib_facter_util_partitions_rb @@ -0,0 +1,24 @@ +$OpenBSD: patch-lib_facter_util_partitions_rb,v 1.4 2015/09/01 07:23:35 jasper Exp $ + +Cache df/mount output to prevent running these programs 3 times for every partition found. +https://github.com/puppetlabs/facter/pull/1119 + +--- lib/facter/util/partitions.rb.orig Mon Aug 31 19:03:29 2015 ++++ lib/facter/util/partitions.rb Mon Aug 31 19:03:38 2015 +@@ -44,4 +44,16 @@ module Facter::Util::Partitions + def self.available? + !self.list.empty? + end ++ ++ def self.flushable? ++ implementation.flushable? ++ end ++ ++ def self.flushed? ++ implementation.flushed? ++ end ++ ++ def self.flush! ++ implementation.flush! ++ end + end