class Object
Constants
- NET_SSH_PATCH_REQUIREMENT
Set the version requirement for when net-ssh should be patched
Public Class Methods
vagrant_ruby()
click to toggle source
# File lib/vagrant/patches/rubygems.rb, line 14 def vagrant_ruby cmd = ruby_ruby "#{cmd} -I\"#{Vagrant.source_root.join("lib/vagrant/patches/builder")}\"" end
Also aliased as: ruby
Public Instance Methods
clean_flags!()
click to toggle source
Check values defined for CFLAGS, CPPFLAGS, LDFLAGS, and INCFLAGS for unquoted Windows paths and quote them.
# File lib/vagrant/patches/builder/mkmf.rb, line 57 def clean_flags! $CFLAGS = flag_cleaner($CFLAGS) $CPPFLAGS = flag_cleaner($CPPFLAGS) $LDFLAGS = flag_cleaner($LDFLAGS) $INCFLAGS = flag_cleaner($INCFLAGS) end
flag_cleaner(flags)
click to toggle source
Attempt to detect and quote Windos paths found within the given string of flags
@param [String] flags Compiler/linker flags @return [String] flags with paths quoted
# File lib/vagrant/patches/builder/mkmf.rb, line 39 def flag_cleaner(flags) parts = flags.split(" -") parts.map! do |p| if p !~ %r{[A-Za-z]:(/|\\)} next p elsif p =~ %r{"[A-Za-z]:(/|\\).+"$} next p end p.gsub(%r{([A-Za-z]:(/|\\).+)$}, '"\1"') end parts.join(" -") end
to_pem()
click to toggle source
# File lib/vagrant/patches/net-ssh.rb, line 72 def to_pem "#{ssh_type} #{self.to_bn.to_s(2)}" end
vagrant_append_cflags(*args)
click to toggle source
# File lib/vagrant/patches/builder/mkmf.rb, line 74 def vagrant_append_cflags(*args) result = ruby_append_cflags(*args) clean_flags! result end
Also aliased as: append_cflags
vagrant_append_cppflags(*args)
click to toggle source
# File lib/vagrant/patches/builder/mkmf.rb, line 82 def vagrant_append_cppflags(*args) result = ruby_append_cppflags(*args) clean_flags! result end
Also aliased as: append_cppflags
vagrant_append_ldflags(*args)
click to toggle source
# File lib/vagrant/patches/builder/mkmf.rb, line 90 def vagrant_append_ldflags(*args) result = ruby_append_ldflags(*args) clean_flags! result end
Also aliased as: append_ldflags
vagrant_cc_config(*args)
click to toggle source
# File lib/vagrant/patches/builder/mkmf.rb, line 98 def vagrant_cc_config(*args) clean_flags! ruby_cc_config(*args) end
Also aliased as: cc_config
vagrant_create_makefile(*args)
click to toggle source
Since mkmf loads the MakeMakefile module directly into the current scope, apply patches directly in the scope
# File lib/vagrant/patches/builder/mkmf.rb, line 66 def vagrant_create_makefile(*args) clean_flags! ruby_create_makefile(*args) end
Also aliased as: create_makefile
vagrant_link_config(*args)
click to toggle source
# File lib/vagrant/patches/builder/mkmf.rb, line 105 def vagrant_link_config(*args) clean_flags! ruby_link_config(*args) end
Also aliased as: link_config
vagrant_read_private_keyblob(type)
click to toggle source
# File lib/vagrant/patches/net-ssh.rb, line 13 def vagrant_read_private_keyblob(type) case type when /^ecdsa\-sha2\-(\w*)$/ curve_name_in_type = $1 curve_name_in_key = read_string unless curve_name_in_type == curve_name_in_key raise Net::SSH::Exception, "curve name mismatched (`#{curve_name_in_key}' with `#{curve_name_in_type}')" end public_key_oct = read_string priv_key_bignum = read_bignum begin curvename = OpenSSL::PKey::EC::CurveNameAlias[curve_name_in_key] group = OpenSSL::PKey::EC::Group.new(curvename) point = OpenSSL::PKey::EC::Point.new(group, OpenSSL::BN.new(public_key_oct, 2)) priv_bn = OpenSSL::BN.new(priv_key_bignum, 2) asn1 = OpenSSL::ASN1::Sequence( [ OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(0)), OpenSSL::ASN1::Sequence.new( [ OpenSSL::ASN1::ObjectId("id-ecPublicKey"), OpenSSL::ASN1::ObjectId(curvename) ] ), OpenSSL::ASN1::OctetString.new( OpenSSL::ASN1::Sequence.new( [ OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(1)), OpenSSL::ASN1::OctetString.new(priv_bn.to_s(2)), OpenSSL::ASN1::ASN1Data.new( [ OpenSSL::ASN1::BitString.new(point.to_octet_string(:uncompressed)), ], 1, :CONTEXT_SPECIFIC, ) ] ).to_der ) ] ) key = OpenSSL::PKey::EC.new(asn1.to_der) return key rescue OpenSSL::PKey::ECError raise NotImplementedError, "unsupported key type `#{type}'" end else netssh_read_private_keyblob(type) end end