From 956fb16927eadc5dfb313f46e9293c01f868ede1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 4 Dec 2014 17:35:07 +0200 Subject: [PATCH] make net-dhcp module optional --- ruby-ohai.spec | 5 ++++- soft-net-dhcp.patch | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 soft-net-dhcp.patch diff --git a/ruby-ohai.spec b/ruby-ohai.spec index 4d8d227..ffd7a71 100644 --- a/ruby-ohai.spec +++ b/ruby-ohai.spec @@ -15,6 +15,7 @@ Source0: https://github.com/opscode/ohai/archive/%{version}/%{pkgname}-%{version # Source0-md5: b28339ec7f835a2ed4ec0f876178fb14 Patch0: virtualization-vserver.patch Patch1: platform-pld.patch +Patch2: soft-net-dhcp.patch URL: http://docs.getchef.com/ohai.html BuildRequires: rpm-rubyprov BuildRequires: rpmbuild(macros) >= 1.665 @@ -34,6 +35,7 @@ BuildRequires: ruby-systemu >= 2.6.4 %endif Requires: iproute2 Requires: lsb-release +Requires: mount Requires: ruby-ffi >= 1.9 Requires: ruby-ffi-yajl >= 1.1 Requires: ruby-ipaddress @@ -41,9 +43,9 @@ Requires: ruby-mime-types >= 1.16 Requires: ruby-mixlib-cli Requires: ruby-mixlib-config >= 2.0 Requires: ruby-mixlib-log -Requires: mount Requires: ruby-mixlib-shellout >= 2.0.0 Requires: ruby-systemu >= 2.6.4 +Suggests: ruby-net-dhcp BuildArch: noarch BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -64,6 +66,7 @@ This package contains documentation for %{name}. %setup -q -n ohai-%{version} #%patch0 -p1 %patch1 -p1 +%patch2 -p1 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* # no plist and not darwin so don't care diff --git a/soft-net-dhcp.patch b/soft-net-dhcp.patch new file mode 100644 index 0000000..293c86a --- /dev/null +++ b/soft-net-dhcp.patch @@ -0,0 +1,21 @@ +require net/dhcp only when cloudstack hint present + +--- ./lib/ohai/mixin/cloudstack_metadata.rb~ 2014-12-01 22:01:15.000000000 +0200 ++++ ./lib/ohai/mixin/cloudstack_metadata.rb 2014-12-04 17:21:55.363338588 +0200 +@@ -17,7 +17,6 @@ + + require 'ohai/mixin/ec2_metadata' + require 'ohai/hints' +-require 'net/dhcp' + require 'socket' + + +@@ -30,6 +29,8 @@ + response = '' + if Ohai::Hints.hint?('cloudstack') + begin ++ require 'net/dhcp' ++ + request = DHCP::Discover.new + + listensock = UDPSocket.new -- 2.44.0