Module: Chef::Provider::Package::Freebsd::PortsHelper
- Included in:
- Port
- Defined in:
- lib/chef/provider/package/freebsd/base.rb
Instance Method Summary collapse
- #makefile_variable_value(variable, dir = nil) ⇒ Object
- #port_dir(port) ⇒ Object
- #supports_ports? ⇒ Boolean
Instance Method Details
#makefile_variable_value(variable, dir = nil) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/chef/provider/package/freebsd/base.rb', line 59 def makefile_variable_value(variable, dir = nil) = dir ? { cwd: dir } : {} [:env] = nil [:returns] = [0, 1] make_v = shell_out!("make", "-V", variable, **) make_v.exitstatus == 0 ? make_v.stdout.strip.split($OUTPUT_RECORD_SEPARATOR).first : nil end |
#port_dir(port) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/chef/provider/package/freebsd/base.rb', line 36 def port_dir(port) case port # When the package name starts with a '/' treat it as the full path to the ports directory. when %r{^/} port # Otherwise if the package name contains a '/' not at the start (like 'www/wordpress') treat # as a relative path from /usr/ports. when %r{/} "/usr/ports/#{port}" # Otherwise look up the path to the ports directory using 'whereis' else whereis = shell_out!("whereis", "-s", port, env: nil) unless path = whereis.stdout[/^#{Regexp.escape(port)}:\s+(.+)$/, 1] raise Chef::Exceptions::Package, "Could not find port with the name #{port}" end path end end |