diff options
author | romain <romain@FreeBSD.org> | 2017-08-22 02:47:52 +0800 |
---|---|---|
committer | Koop Mast <kwm@rainbow-runner.nl> | 2018-02-04 05:24:23 +0800 |
commit | 33f61f2bfcfe010c05bb9dc115bb8d2c18a1ee74 (patch) | |
tree | 9755629384da407702363697111e1b3440b367c3 /sysutils/facter | |
parent | ef27f0a8bbe21267ed413ae2819af4d71546dbbb (diff) | |
download | freebsd-ports-gnome-33f61f2bfcfe010c05bb9dc115bb8d2c18a1ee74.tar.gz freebsd-ports-gnome-33f61f2bfcfe010c05bb9dc115bb8d2c18a1ee74.tar.zst freebsd-ports-gnome-33f61f2bfcfe010c05bb9dc115bb8d2c18a1ee74.zip |
Update to 3.8.0
Remove a bunch of patches merged upstream.
Add some new patches to use paths that better fit FreeBSD:
Configuration -> /usr/local/etc/facter/facter.conf
Custom facts -> /usr/local/etc/facter/facts.d/
Cached facts -> /var/facter/cache/cached_facts/
Diffstat (limited to 'sysutils/facter')
31 files changed, 51 insertions, 737 deletions
diff --git a/sysutils/facter/Makefile b/sysutils/facter/Makefile index a7824cf041f9..e68bf1cb8d81 100644 --- a/sysutils/facter/Makefile +++ b/sysutils/facter/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= facter -PORTVERSION= 3.7.1 +PORTVERSION= 3.8.0 PORTREVISION?= 0 CATEGORIES?= sysutils MASTER_SITES= http://downloads.puppetlabs.com/facter/ @@ -33,6 +33,11 @@ USE_RUBY= yes USES+= compiler:c++11-lib ssl CMAKE_ARGS+= -DMAN_PATH=${MANPREFIX}/man +post-patch: + ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ + ${WRKSRC}/lib/src/facts/posix/collection.cc \ + ${WRKSRC}/lib/src/util/config/posix/config.cc + test: build cd ${WRKSRC}/lib && bundle install --path vendor cd ${WRKSRC} && ninja test diff --git a/sysutils/facter/distinfo b/sysutils/facter/distinfo index c661479dc30e..32adc398b382 100644 --- a/sysutils/facter/distinfo +++ b/sysutils/facter/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1500912593 -SHA256 (facter-3.7.1.tar.gz) = 54fc56bfc3997b40c806982759c837f609a7268f669764921424fd41fda83467 -SIZE (facter-3.7.1.tar.gz) = 330767 +TIMESTAMP = 1503037047 +SHA256 (facter-3.8.0.tar.gz) = a53f1646614f774cc150e7edcca40ef2512650e1cbafdcaf0f2739969c6b59c6 +SIZE (facter-3.8.0.tar.gz) = 334042 diff --git a/sysutils/facter/files/patch-lib_inc_facter_facts_fact.hpp b/sysutils/facter/files/patch-lib_inc_facter_facts_fact.hpp deleted file mode 100644 index 3969df45b362..000000000000 --- a/sysutils/facter/files/patch-lib_inc_facter_facts_fact.hpp +++ /dev/null @@ -1,31 +0,0 @@ ---- lib/inc/facter/facts/fact.hpp.orig 2017-07-18 18:49:09 UTC -+++ lib/inc/facter/facts/fact.hpp -@@ -528,9 +528,9 @@ namespace facter { namespace facts { - constexpr static char const* zfs_version = "zfs_version"; - - /** -- * The ZFS supported feature numbers. -+ * The ZFS supported version numbers. - */ -- constexpr static char const* zfs_featurenumbers = "zfs_featurenumbers"; -+ constexpr static char const* zfs_versionnumbers = "zfs_featurenumbers"; - - /** - * The ZFS storage pool (zpool) version fact. -@@ -538,9 +538,14 @@ namespace facter { namespace facts { - constexpr static char const* zpool_version = "zpool_version"; - - /** -- * The ZFS storage pool supported feature numbers. -+ * The ZFS storage pool supported feature flags. - */ -- constexpr static char const* zpool_featurenumbers = "zpool_featurenumbers"; -+ constexpr static char const* zpool_featureflags = "zpool_featureflags"; -+ -+ /** -+ * The ZFS storage pool supported version numbers. -+ */ -+ constexpr static char const* zpool_versionnumbers = "zpool_featurenumbers"; - - /** - * The fact for number of Solaris zones. diff --git a/sysutils/facter/files/patch-lib_inc_facter_facts_vm.hpp b/sysutils/facter/files/patch-lib_inc_facter_facts_vm.hpp deleted file mode 100644 index 002bbf1b2ae0..000000000000 --- a/sysutils/facter/files/patch-lib_inc_facter_facts_vm.hpp +++ /dev/null @@ -1,14 +0,0 @@ ---- lib/inc/facter/facts/vm.hpp.orig 2017-06-27 17:42:22 UTC -+++ lib/inc/facter/facts/vm.hpp -@@ -137,6 +137,11 @@ namespace facter { namespace facts { - * The name for Solaris ldom - */ - constexpr static char const* ldom = "ldom"; -+ -+ /** -+ * The name of FreeBSD jails -+ */ -+ constexpr static char const* jail = "jail"; - }; - - }} // namespace facter::facts diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_memory__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_memory__resolver.hpp deleted file mode 100644 index 531c5e7b43aa..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_memory__resolver.hpp +++ /dev/null @@ -1,28 +0,0 @@ ---- lib/inc/internal/facts/freebsd/memory_resolver.hpp.orig 2017-07-10 14:30:58 UTC -+++ lib/inc/internal/facts/freebsd/memory_resolver.hpp -@@ -0,0 +1,25 @@ -+/** -+ * @file -+ * Declares the FreeBSD memory fact resolver. -+ */ -+#pragma once -+ -+#include "../resolvers/memory_resolver.hpp" -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ /** -+ * Responsible for resolving memory facts. -+ */ -+ struct memory_resolver : resolvers::memory_resolver -+ { -+ protected: -+ /** -+ * Collects the resolver data. -+ * @param facts The fact collection that is resolving facts. -+ * @return Returns the resolver data. -+ */ -+ virtual data collect_data(collection& facts) override; -+ }; -+ -+}}} // namespace facter::facts::osx diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_operating__system__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_operating__system__resolver.hpp deleted file mode 100644 index ba9ee565de2f..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_operating__system__resolver.hpp +++ /dev/null @@ -1,27 +0,0 @@ ---- lib/inc/internal/facts/freebsd/operating_system_resolver.hpp.orig 2017-07-28 07:09:48 UTC -+++ lib/inc/internal/facts/freebsd/operating_system_resolver.hpp -@@ -0,0 +1,24 @@ -+/** -+ * @file -+ * Declares the FreeBSD operating system fact resolver. -+ */ -+#pragma once -+ -+#include "../posix/operating_system_resolver.hpp" -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ /** -+ * Responsible for resolving operating system facts. -+ */ -+ struct operating_system_resolver : posix::operating_system_resolver -+ { -+ protected: -+ /** -+ * Collects the resolver's release data. -+ * @param facts The fact collection that is resolving facts. -+ * @param result The current resolver data. -+ */ -+ virtual void collect_release_data(collection& facts, data& result) override; -+ }; -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_virtualization__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_virtualization__resolver.hpp deleted file mode 100644 index 8ef5b5a2993b..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_virtualization__resolver.hpp +++ /dev/null @@ -1,30 +0,0 @@ ---- lib/inc/internal/facts/freebsd/virtualization_resolver.hpp.orig 2017-07-10 14:30:58 UTC -+++ lib/inc/internal/facts/freebsd/virtualization_resolver.hpp -@@ -0,0 +1,27 @@ -+/** -+ * @file -+ * Declares the FreeBSD virtualization fact resolver. -+ */ -+#pragma once -+ -+#include "../resolvers/virtualization_resolver.hpp" -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ /** -+ * Responsible for resolving virtualization facts. -+ */ -+ struct virtualization_resolver : resolvers::virtualization_resolver -+ { -+ protected: -+ /** -+ * Gets the name of the hypervisor. -+ * @param facts The fact collection that is resolving facts. -+ * @return Returns the name of the hypervisor or empty string if no hypervisor. -+ */ -+ virtual std::string get_hypervisor(collection& facts) override; -+ private: -+ static std::string get_jail_vm(); -+ }; -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zfs__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zfs__resolver.hpp deleted file mode 100644 index 467a2be60e4a..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zfs__resolver.hpp +++ /dev/null @@ -1,27 +0,0 @@ ---- lib/inc/internal/facts/freebsd/zfs_resolver.hpp.orig 2017-07-10 16:43:09 UTC -+++ lib/inc/internal/facts/freebsd/zfs_resolver.hpp -@@ -0,0 +1,24 @@ -+/** -+ * @file -+ * Declares the ZFS fact resolver. -+ */ -+#pragma once -+ -+#include "../resolvers/zfs_resolver.hpp" -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ /** -+ * Responsible for resolving ZFS facts. -+ */ -+ struct zfs_resolver : resolvers::zfs_resolver -+ { -+ protected: -+ /** -+ * Gets the platform's ZFS command. -+ * @return Returns the platform's ZFS command. -+ */ -+ virtual std::string zfs_command(); -+ }; -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zpool__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zpool__resolver.hpp deleted file mode 100644 index b4f839362a30..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_freebsd_zpool__resolver.hpp +++ /dev/null @@ -1,27 +0,0 @@ ---- lib/inc/internal/facts/freebsd/zpool_resolver.hpp.orig 2017-07-10 16:43:09 UTC -+++ lib/inc/internal/facts/freebsd/zpool_resolver.hpp -@@ -0,0 +1,24 @@ -+/** -+ * @file -+ * Declares the FreeBSD ZFS storage pool (zpool) fact resolver. -+ */ -+#pragma once -+ -+#include "../resolvers/zpool_resolver.hpp" -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ /** -+ * Responsible for resolving ZFS storage pool (zpool) facts. -+ */ -+ struct zpool_resolver : resolvers::zpool_resolver -+ { -+ protected: -+ /** -+ * Gets the platform's zpool command. -+ * @return Returns the platform's zpool command. -+ */ -+ virtual std::string zpool_command(); -+ }; -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_operating__system__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_operating__system__resolver.hpp deleted file mode 100644 index 47e3bac47311..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_operating__system__resolver.hpp +++ /dev/null @@ -1,23 +0,0 @@ ---- lib/inc/internal/facts/resolvers/operating_system_resolver.hpp.orig 2017-07-18 18:49:09 UTC -+++ lib/inc/internal/facts/resolvers/operating_system_resolver.hpp -@@ -216,6 +216,20 @@ namespace facter { namespace facts { nam - * @return Returns the resolver data. - */ - virtual data collect_data(collection& facts); -+ -+ /** -+ * Collects the resolver's kernel data. -+ * @param facts The fact collection that is resolving facts. -+ * @param result The current resolver data. -+ */ -+ virtual void collect_kernel_data(collection& facts, data &result); -+ -+ /** -+ * Collects the resolver's release data. -+ * @param facts The fact collection that is resolving facts. -+ * @param result The current resolver data. -+ */ -+ virtual void collect_release_data(collection& facts, data &result); - }; - - }}} // namespace facter::facts::resolvers diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zfs__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zfs__resolver.hpp deleted file mode 100644 index cbdd2f9b2dc3..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zfs__resolver.hpp +++ /dev/null @@ -1,14 +0,0 @@ ---- lib/inc/internal/facts/resolvers/zfs_resolver.hpp.orig 2017-07-18 18:49:09 UTC -+++ lib/inc/internal/facts/resolvers/zfs_resolver.hpp -@@ -43,9 +43,9 @@ namespace facter { namespace facts { nam - */ - std::string version; - /** -- * Stores the ZFS feature numbers. -+ * Stores the ZFS version numbers. - */ -- std::vector<std::string> features; -+ std::vector<std::string> versions; - }; - - /** diff --git a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zpool__resolver.hpp b/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zpool__resolver.hpp deleted file mode 100644 index 2018c2a72a9e..000000000000 --- a/sysutils/facter/files/patch-lib_inc_internal_facts_resolvers_zpool__resolver.hpp +++ /dev/null @@ -1,18 +0,0 @@ ---- lib/inc/internal/facts/resolvers/zpool_resolver.hpp.orig 2017-07-18 18:49:09 UTC -+++ lib/inc/internal/facts/resolvers/zpool_resolver.hpp -@@ -43,9 +43,13 @@ namespace facter { namespace facts { nam - */ - std::string version; - /** -- * Stores the zpool feature numbers. -+ * Stores the zpool feature flags. - */ -- std::vector<std::string> features; -+ std::vector<std::string> feature_flags; -+ /** -+ * Stores the zpool version numbers. -+ */ -+ std::vector<std::string> versions; - }; - - /** diff --git a/sysutils/facter/files/patch-lib_schema_facter.yaml b/sysutils/facter/files/patch-lib_schema_facter.yaml deleted file mode 100644 index a08a9dcc7b8e..000000000000 --- a/sysutils/facter/files/patch-lib_schema_facter.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- lib/schema/facter.yaml.orig 2017-07-18 18:49:09 UTC -+++ lib/schema/facter.yaml -@@ -1894,6 +1894,14 @@ zones: - caveats: | - Solaris: the `zoneadm` utility must be present. - -+zpool_featureflags: -+ type: string -+ description: Return the comma-delimited feature flags for ZFS storage pools. -+ resolution: | -+ Solaris: use the `zpool` utility to retrieve the feature numbers for ZFS storage pools -+ caveats: | -+ Solaris: the `zpool` utility must be present. -+ - zpool_featurenumbers: - type: string - description: Return the comma-delimited feature numbers for ZFS storage pools. diff --git a/sysutils/facter/files/patch-lib_src_facts_bsd_collection.cc b/sysutils/facter/files/patch-lib_src_facts_bsd_collection.cc deleted file mode 100644 index 123f9669e1c7..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_bsd_collection.cc +++ /dev/null @@ -1,19 +0,0 @@ ---- lib/src/facts/bsd/collection.cc.orig 2017-06-27 17:42:22 UTC -+++ lib/src/facts/bsd/collection.cc -@@ -1,6 +1,6 @@ - #include <facter/facts/collection.hpp> - #include <internal/facts/posix/kernel_resolver.hpp> --#include <internal/facts/resolvers/operating_system_resolver.hpp> -+#include <internal/facts/posix/operating_system_resolver.hpp> - #include <internal/facts/bsd/uptime_resolver.hpp> - #include <internal/facts/bsd/filesystem_resolver.hpp> - #include <internal/facts/posix/ssh_resolver.hpp> -@@ -15,7 +15,7 @@ namespace facter { namespace facts { - void collection::add_platform_facts() - { - add(make_shared<posix::kernel_resolver>()); -- add(make_shared<resolvers::operating_system_resolver>()); -+ add(make_shared<posix::operating_system_resolver>()); - add(make_shared<bsd::uptime_resolver>()); - add(make_shared<bsd::filesystem_resolver>()); - add(make_shared<posix::ssh_resolver>()); diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_collection.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_collection.cc deleted file mode 100644 index 9a52c59224b0..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_collection.cc +++ /dev/null @@ -1,36 +0,0 @@ ---- lib/src/facts/freebsd/collection.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/src/facts/freebsd/collection.cc -@@ -8,8 +8,12 @@ - #include <internal/facts/posix/kernel_resolver.hpp> - #include <internal/facts/posix/ssh_resolver.hpp> - #include <internal/facts/posix/timezone_resolver.hpp> --#include <internal/facts/resolvers/operating_system_resolver.hpp> -+#include <internal/facts/freebsd/operating_system_resolver.hpp> - #include <internal/facts/freebsd/networking_resolver.hpp> -+#include <internal/facts/freebsd/virtualization_resolver.hpp> -+#include <internal/facts/freebsd/memory_resolver.hpp> -+#include <internal/facts/freebsd/zfs_resolver.hpp> -+#include <internal/facts/freebsd/zpool_resolver.hpp> - - using namespace std; - -@@ -18,7 +22,7 @@ namespace facter { namespace facts { - void collection::add_platform_facts() - { - add(make_shared<posix::kernel_resolver>()); -- add(make_shared<resolvers::operating_system_resolver>()); -+ add(make_shared<freebsd::operating_system_resolver>()); - add(make_shared<freebsd::networking_resolver>()); - add(make_shared<bsd::uptime_resolver>()); - add(make_shared<bsd::filesystem_resolver>()); -@@ -28,6 +32,10 @@ namespace facter { namespace facts { - add(make_shared<glib::load_average_resolver>()); - add(make_shared<freebsd::processor_resolver>()); - add(make_shared<freebsd::dmi_resolver>()); -+ add(make_shared<freebsd::virtualization_resolver>()); -+ add(make_shared<freebsd::memory_resolver>()); -+ add(make_shared<freebsd::zfs_resolver>()); -+ add(make_shared<freebsd::zpool_resolver>()); - } - - }} // namespace facter::facts diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_memory__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_memory__resolver.cc deleted file mode 100644 index ed3c654f36e6..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_memory__resolver.cc +++ /dev/null @@ -1,79 +0,0 @@ ---- lib/src/facts/freebsd/memory_resolver.cc.orig 2017-07-10 14:30:58 UTC -+++ lib/src/facts/freebsd/memory_resolver.cc -@@ -0,0 +1,76 @@ -+#include <internal/facts/freebsd/memory_resolver.hpp> -+#include <leatherman/execution/execution.hpp> -+#include <leatherman/logging/logging.hpp> -+#include <sys/types.h> -+#include <sys/param.h> -+#include <sys/sysctl.h> -+#include <vm/vm_param.h> -+#include <unistd.h> -+ -+using namespace std; -+using namespace leatherman::execution; -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ memory_resolver::data memory_resolver::collect_data(collection& facts) -+ { -+ data result; -+ -+ size_t size; -+ int pagesize = getpagesize(); -+ -+ // Memory usage -+ -+ unsigned long physmem; -+ size = sizeof(physmem); -+ if (0 == sysctlbyname("hw.physmem", &physmem, &size, NULL, 0)) { -+ result.mem_total = physmem; -+ } -+ -+ unsigned int inactive_count = 0; -+ size = sizeof(inactive_count); -+ sysctlbyname("vm.stats.vm.v_inactive_count", &inactive_count, &size, NULL, 0); -+ -+ unsigned int cache_count = 0; -+ size = sizeof(cache_count); -+ sysctlbyname("vm.stats.vm.v_cache_count", &cache_count, &size, NULL, 0); -+ -+ unsigned int free_count = 0; -+ size = sizeof(free_count); -+ sysctlbyname("vm.stats.vm.v_free_count", &free_count, &size, NULL, 0); -+ -+ long mem_free_page_count = inactive_count + cache_count + free_count; -+ result.mem_free = mem_free_page_count * pagesize; -+ -+ // Swap usage -+ -+ struct xswdev xsw; -+ size = sizeof(xsw); -+ -+ int mib[16]; -+ size_t mibsize; -+ mibsize = sizeof mib / sizeof mib[0]; -+ if (sysctlnametomib("vm.swap_info", mib, &mibsize) == -1) { -+ LOG_DEBUG("sysctlnametomib() failed"); -+ } else { -+ for (int n = 0; ; ++n) { -+ mib[mibsize] = n; -+ if (-1 == sysctl(mib, mibsize + 1, &xsw, &size, NULL, 0)) -+ break; -+ -+ if (xsw.xsw_version != XSWDEV_VERSION) { -+ LOG_DEBUG("xswdev version mismatch"); -+ } else { -+ result.swap_total += xsw.xsw_nblks; -+ result.swap_free += xsw.xsw_nblks - xsw.xsw_used; -+ } -+ } -+ -+ result.swap_free *= pagesize; -+ result.swap_total *= pagesize; -+ } -+ -+ return result; -+ } -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_operating__system__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_operating__system__resolver.cc deleted file mode 100644 index bc1e9661b102..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_operating__system__resolver.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- lib/src/facts/freebsd/operating_system_resolver.cc.orig 2017-07-28 07:09:48 UTC -+++ lib/src/facts/freebsd/operating_system_resolver.cc -@@ -0,0 +1,17 @@ -+#include <leatherman/execution/execution.hpp> -+ -+#include <internal/facts/freebsd/operating_system_resolver.hpp> -+ -+using namespace std; -+using namespace leatherman::execution; -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ void operating_system_resolver::collect_release_data(collection& facts, data& result) -+ { -+ auto exec = execute("freebsd-version"); -+ if (exec.success) { -+ result.release = exec.output; -+ } -+ } -+} } } // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_virtualization__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_virtualization__resolver.cc deleted file mode 100644 index 86674d258095..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_virtualization__resolver.cc +++ /dev/null @@ -1,47 +0,0 @@ ---- lib/src/facts/freebsd/virtualization_resolver.cc.orig 2017-07-10 14:30:58 UTC -+++ lib/src/facts/freebsd/virtualization_resolver.cc -@@ -0,0 +1,44 @@ -+#include <internal/facts/freebsd/virtualization_resolver.hpp> -+#include <facter/facts/scalar_value.hpp> -+#include <facter/facts/collection.hpp> -+#include <facter/facts/fact.hpp> -+#include <facter/facts/vm.hpp> -+#include <leatherman/execution/execution.hpp> -+#include <boost/algorithm/string.hpp> -+ -+#include <sys/types.h> -+#include <sys/sysctl.h> -+ -+using namespace std; -+using namespace facter::facts; -+using namespace leatherman::execution; -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ string virtualization_resolver::get_hypervisor(collection& facts) -+ { -+ string value = get_jail_vm(); -+ -+ if (value.empty()) { -+ auto product_name = facts.get<string_value>(fact::product_name); -+ if (product_name) { -+ value = get_product_name_vm(product_name->value()); -+ } -+ } -+ -+ return value; -+ } -+ -+ string virtualization_resolver::get_jail_vm() -+ { -+ int jailed; -+ size_t size = sizeof(jailed); -+ if (sysctlbyname("security.jail.jailed", &jailed, &size, NULL, 0) == 0) { -+ if (jailed) -+ return vm::jail; -+ } -+ -+ return {}; -+ } -+ -+} } } // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_zfs__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_zfs__resolver.cc deleted file mode 100644 index 9a89f989d081..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_zfs__resolver.cc +++ /dev/null @@ -1,15 +0,0 @@ ---- lib/src/facts/freebsd/zfs_resolver.cc.orig 2017-07-10 16:43:09 UTC -+++ lib/src/facts/freebsd/zfs_resolver.cc -@@ -0,0 +1,12 @@ -+#include <internal/facts/freebsd/zfs_resolver.hpp> -+ -+using namespace std; -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ string zfs_resolver::zfs_command() -+ { -+ return "/sbin/zfs"; -+ } -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_src_facts_freebsd_zpool__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_freebsd_zpool__resolver.cc deleted file mode 100644 index e5333b32342b..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_freebsd_zpool__resolver.cc +++ /dev/null @@ -1,15 +0,0 @@ ---- lib/src/facts/freebsd/zpool_resolver.cc.orig 2017-07-10 16:43:09 UTC -+++ lib/src/facts/freebsd/zpool_resolver.cc -@@ -0,0 +1,12 @@ -+#include <internal/facts/freebsd/zpool_resolver.hpp> -+ -+using namespace std; -+ -+namespace facter { namespace facts { namespace freebsd { -+ -+ string zpool_resolver::zpool_command() -+ { -+ return "/sbin/zpool"; -+ } -+ -+}}} // namespace facter::facts::freebsd diff --git a/sysutils/facter/files/patch-lib_src_facts_openbsd_collection.cc b/sysutils/facter/files/patch-lib_src_facts_openbsd_collection.cc deleted file mode 100644 index eced293ca455..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_openbsd_collection.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- lib/src/facts/openbsd/collection.cc.orig 2017-06-27 17:42:22 UTC -+++ lib/src/facts/openbsd/collection.cc -@@ -11,7 +11,7 @@ - #include <internal/facts/posix/kernel_resolver.hpp> - #include <internal/facts/posix/ssh_resolver.hpp> - #include <internal/facts/posix/timezone_resolver.hpp> --#include <internal/facts/resolvers/operating_system_resolver.hpp> -+#include <internal/facts/posix/operating_system_resolver.hpp> - - using namespace std; - -@@ -20,7 +20,7 @@ namespace facter { namespace facts { - void collection::add_platform_facts() - { - add(make_shared<posix::kernel_resolver>()); -- add(make_shared<resolvers::operating_system_resolver>()); -+ add(make_shared<posix::operating_system_resolver>()); - add(make_shared<bsd::uptime_resolver>()); - add(make_shared<bsd::filesystem_resolver>()); - add(make_shared<posix::ssh_resolver>()); diff --git a/sysutils/facter/files/patch-lib_src_facts_posix_cache.cc b/sysutils/facter/files/patch-lib_src_facts_posix_cache.cc new file mode 100644 index 000000000000..925d105abe9f --- /dev/null +++ b/sysutils/facter/files/patch-lib_src_facts_posix_cache.cc @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- lib/src/facts/posix/cache.cc.orig ++++ lib/src/facts/posix/cache.cc +@@ -3,7 +3,7 @@ + namespace facter { namespace facts { namespace cache { + + std::string fact_cache_location() { +- return "/opt/puppetlabs/facter/cache/cached_facts/"; ++ return "/var/facter/cache/cached_facts/"; + } + + }}} // namespace facter::facts::cache diff --git a/sysutils/facter/files/patch-lib_src_facts_posix_collection.cc b/sysutils/facter/files/patch-lib_src_facts_posix_collection.cc new file mode 100644 index 000000000000..0b2267b0e32c --- /dev/null +++ b/sysutils/facter/files/patch-lib_src_facts_posix_collection.cc @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- lib/src/facts/posix/collection.cc.orig ++++ lib/src/facts/posix/collection.cc +@@ -29,6 +29,8 @@ + directories.emplace_back("/opt/puppetlabs/facter/facts.d"); + directories.emplace_back("/etc/facter/facts.d"); + directories.emplace_back("/etc/puppetlabs/facter/facts.d"); ++ directories.emplace_back("%%PREFIX%%/etc/facter/facts.d"); ++ directories.emplace_back("%%PREFIX%%/etc/puppetlabs/facter/facts.d"); + } + return directories; + } diff --git a/sysutils/facter/files/patch-lib_src_facts_resolvers_operating__system__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_resolvers_operating__system__resolver.cc deleted file mode 100644 index 668ef0fc98b9..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_resolvers_operating__system__resolver.cc +++ /dev/null @@ -1,32 +0,0 @@ ---- lib/src/facts/resolvers/operating_system_resolver.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/src/facts/resolvers/operating_system_resolver.cc -@@ -231,18 +231,27 @@ namespace facter { namespace facts { nam - { - data result; - -+ collect_kernel_data(facts, result); -+ collect_release_data(facts, result); -+ -+ return result; -+ } -+ -+ void operating_system_resolver::collect_kernel_data(collection& facts, data& result) -+ { - auto kernel = facts.get<string_value>(fact::kernel); - if (kernel) { - result.name = kernel->value(); - result.family = kernel->value(); - } -+ } - -+ void operating_system_resolver::collect_release_data(collection& facts, data& result) -+ { - auto release = facts.get<string_value>(fact::kernel_release); - if (release) { - result.release = release->value(); - } -- -- return result; - } - - tuple<string, string> operating_system_resolver::parse_distro(string const& name, string const& release) diff --git a/sysutils/facter/files/patch-lib_src_facts_resolvers_zfs__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_resolvers_zfs__resolver.cc deleted file mode 100644 index 232cd75a5cca..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_resolvers_zfs__resolver.cc +++ /dev/null @@ -1,40 +0,0 @@ ---- lib/src/facts/resolvers/zfs_resolver.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/src/facts/resolvers/zfs_resolver.cc -@@ -18,7 +18,7 @@ namespace facter { namespace facts { nam - "ZFS", - { - fact::zfs_version, -- fact::zfs_featurenumbers -+ fact::zfs_versionnumbers - }) - { - } -@@ -30,8 +30,8 @@ namespace facter { namespace facts { nam - if (!data.version.empty()) { - facts.add(fact::zfs_version, make_value<string_value>(move(data.version))); - } -- if (!data.features.empty()) { -- facts.add(fact::zfs_featurenumbers, make_value<string_value>(boost::join(data.features, ","))); -+ if (!data.versions.empty()) { -+ facts.add(fact::zfs_versionnumbers, make_value<string_value>(boost::join(data.versions, ","))); - } - } - -@@ -48,12 +48,12 @@ namespace facter { namespace facts { nam - return true; - }); - -- // Get the ZFS features -- static boost::regex zfs_feature("\\s*(\\d+)[ ]"); -+ // Get the ZFS versions -+ static boost::regex zfs_supported_version("^\\s*(\\d+)[ ]"); - each_line(zfs_command(), {"upgrade", "-v"}, [&] (string& line) { -- string feature; -- if (re_search(line, zfs_feature, &feature)) { -- result.features.emplace_back(move(feature)); -+ string version; -+ if (re_search(line, zfs_supported_version, &version)) { -+ result.versions.emplace_back(move(version)); - } - return true; - }); diff --git a/sysutils/facter/files/patch-lib_src_facts_resolvers_zpool__resolver.cc b/sysutils/facter/files/patch-lib_src_facts_resolvers_zpool__resolver.cc deleted file mode 100644 index c807ff396198..000000000000 --- a/sysutils/facter/files/patch-lib_src_facts_resolvers_zpool__resolver.cc +++ /dev/null @@ -1,82 +0,0 @@ ---- lib/src/facts/resolvers/zpool_resolver.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/src/facts/resolvers/zpool_resolver.cc -@@ -18,7 +18,8 @@ namespace facter { namespace facts { nam - "ZFS storage pool", - { - fact::zpool_version, -- fact::zpool_featurenumbers, -+ fact::zpool_featureflags, -+ fact::zpool_versionnumbers, - }) - { - } -@@ -30,8 +31,11 @@ namespace facter { namespace facts { nam - if (!data.version.empty()) { - facts.add(fact::zpool_version, make_value<string_value>(move(data.version))); - } -- if (!data.features.empty()) { -- facts.add(fact::zpool_featurenumbers, make_value<string_value>(boost::join(data.features, ","))); -+ if (!data.feature_flags.empty()) { -+ facts.add(fact::zpool_featureflags, make_value<string_value>(boost::join(data.feature_flags, ","))); -+ } -+ if (!data.versions.empty()) { -+ facts.add(fact::zpool_versionnumbers, make_value<string_value>(boost::join(data.versions, ","))); - } - } - -@@ -39,16 +43,47 @@ namespace facter { namespace facts { nam - { - data result; - -+ enum { UNKNOWN, FEATURES, VERSIONS } state = UNKNOWN; -+ - // Get the zpool version and features -- static boost::regex zpool_version("ZFS pool version (\\d+)[.]"); -- static boost::regex zpool_feature("\\s*(\\d+)[ ]"); -+ static boost::regex zpool_version("^This system is currently running ZFS pool version (\\d+)\\.$"); -+ static boost::regex zpool_feature_flags("^This system supports ZFS pool feature flags\\.$"); -+ -+ static boost::regex zpool_supported_feature_header("^The following features are supported:$"); -+ static boost::regex zpool_supported_versions_header("^The following versions are supported:$"); -+ static boost::regex zpool_supported_legacy_versions_header("^The following legacy versions are also supported:$"); -+ -+ static boost::regex zpool_supported_feature("^([[:alnum:]_]+)(\\s+\\(read-only compatible\\))?$"); -+ static boost::regex zpool_supported_version("^\\s*(\\d+)[ ]"); -+ -+ string feature; - each_line(zpool_command(), {"upgrade", "-v"}, [&] (string& line) { -- if (re_search(line, zpool_version, &result.version)) { -- return true; -- } -- string feature; -- if (re_search(line, zpool_feature, &feature)) { -- result.features.emplace_back(move(feature)); -+ switch (state) { -+ case UNKNOWN: -+ if (re_search(line, zpool_version, &result.version)) { -+ } else if (re_search(line, zpool_feature_flags)) { -+ result.version = "5000"; -+ } else if (re_search(line, zpool_supported_feature_header)) { -+ state = FEATURES; -+ } else if (re_search(line, zpool_supported_versions_header)) { -+ state = VERSIONS; -+ } -+ break; -+ -+ case FEATURES: -+ if (re_search(line, zpool_supported_feature, &feature)) { -+ result.feature_flags.emplace_back(move(feature)); -+ } else if (re_search(line, zpool_supported_legacy_versions_header)) { -+ state = VERSIONS; -+ } -+ break; -+ -+ case VERSIONS: -+ string feature; -+ if (re_search(line, zpool_supported_version, &feature)) { -+ result.versions.emplace_back(move(feature)); -+ } -+ break; - } - return true; - }); diff --git a/sysutils/facter/files/patch-lib_src_util_config_posix_config.cc b/sysutils/facter/files/patch-lib_src_util_config_posix_config.cc new file mode 100644 index 000000000000..b18b05b2514e --- /dev/null +++ b/sysutils/facter/files/patch-lib_src_util_config_posix_config.cc @@ -0,0 +1,13 @@ + +$FreeBSD$ + +--- lib/src/util/config/posix/config.cc.orig ++++ lib/src/util/config/posix/config.cc +@@ -7,6 +7,6 @@ + } + + std::string default_config_location() { +- return "/etc/puppetlabs/facter/facter.conf"; ++ return "%%PREFIX%%/etc/facter/facter.conf"; + } + }}} // namespace facter::util::config diff --git a/sysutils/facter/files/patch-lib_tests_facts_resolvers_zfs__resolver.cc b/sysutils/facter/files/patch-lib_tests_facts_resolvers_zfs__resolver.cc deleted file mode 100644 index 9428440d185d..000000000000 --- a/sysutils/facter/files/patch-lib_tests_facts_resolvers_zfs__resolver.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- lib/tests/facts/resolvers/zfs_resolver.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/tests/facts/resolvers/zfs_resolver.cc -@@ -37,7 +37,7 @@ struct test_zfs_resolver : zfs_resolver - { - data result; - result.version = "1"; -- result.features = { "1", "2", "3" }; -+ result.versions = { "1", "2", "3" }; - return result; - } - }; -@@ -57,7 +57,7 @@ SCENARIO("using the ZFS resolver") { - auto value = facts.get<string_value>(fact::zfs_version); - REQUIRE(value); - REQUIRE(value->value() == "1"); -- value = facts.get<string_value>(fact::zfs_featurenumbers); -+ value = facts.get<string_value>(fact::zfs_versionnumbers); - REQUIRE(value); - REQUIRE(value->value() == "1,2,3"); - } diff --git a/sysutils/facter/files/patch-lib_tests_facts_resolvers_zpool__resolver.cc b/sysutils/facter/files/patch-lib_tests_facts_resolvers_zpool__resolver.cc deleted file mode 100644 index bd5a0e131aca..000000000000 --- a/sysutils/facter/files/patch-lib_tests_facts_resolvers_zpool__resolver.cc +++ /dev/null @@ -1,31 +0,0 @@ ---- lib/tests/facts/resolvers/zpool_resolver.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/tests/facts/resolvers/zpool_resolver.cc -@@ -37,7 +37,8 @@ struct test_zpool_resolver : zpool_resol - { - data result; - result.version = "1"; -- result.features = { "1", "2", "3" }; -+ result.versions = { "1", "2", "3" }; -+ result.feature_flags = { "async_destroy", "lz4_compress", "enabled_txg" }; - return result; - } - }; -@@ -53,13 +54,16 @@ SCENARIO("using the zpool resolver") { - WHEN("data is present") { - facts.add(make_shared<test_zpool_resolver>()); - THEN("flat facts are added") { -- REQUIRE(facts.size() == 2u); -+ REQUIRE(facts.size() == 3u); - auto value = facts.get<string_value>(fact::zpool_version); - REQUIRE(value); - REQUIRE(value->value() == "1"); -- value = facts.get<string_value>(fact::zpool_featurenumbers); -+ value = facts.get<string_value>(fact::zpool_versionnumbers); - REQUIRE(value); - REQUIRE(value->value() == "1,2,3"); -+ value = facts.get<string_value>(fact::zpool_featureflags); -+ REQUIRE(value); -+ REQUIRE(value->value() == "async_destroy,lz4_compress,enabled_txg"); - } - } - } diff --git a/sysutils/facter/files/patch-lib_tests_facts_schema.cc b/sysutils/facter/files/patch-lib_tests_facts_schema.cc deleted file mode 100644 index b0044e13e220..000000000000 --- a/sysutils/facter/files/patch-lib_tests_facts_schema.cc +++ /dev/null @@ -1,21 +0,0 @@ ---- lib/tests/facts/schema.cc.orig 2017-07-18 18:49:09 UTC -+++ lib/tests/facts/schema.cc -@@ -396,7 +396,7 @@ protected: - { - data result; - result.version = 1; -- result.features = { "1", "2", "3" }; -+ result.versions = { "1", "2", "3" }; - return result; - } - }; -@@ -433,7 +433,8 @@ protected: - { - data result; - result.version = 1; -- result.features = { "1", "2", "3" }; -+ result.versions = { "1", "2", "3" }; -+ result.feature_flags = { "async_destroy", "lz4_compress", "enabled_txg" }; - return result; - } - }; diff --git a/sysutils/facter/pkg-plist b/sysutils/facter/pkg-plist index 69ac8cc89a69..90430df4f426 100644 --- a/sysutils/facter/pkg-plist +++ b/sysutils/facter/pkg-plist @@ -1,4 +1,5 @@ bin/facter +include/facter/cwrapper.hpp include/facter/export.h include/facter/facts/array_value.hpp include/facter/facts/collection.hpp |