* lib/rubygems: Update to RubyGems master 278d00d. Changes:
Fixes building extensions without a "clean" make rule Adds gem dependency file autodetection to "gem install -g" * test/rubygems: Tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28918eac58
commit
33d1f172c8
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Wed Oct 16 09:42:42 2013 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* lib/rubygems: Update to RubyGems master 278d00d. Changes:
|
||||||
|
|
||||||
|
Fixes building extensions without a "clean" make rule
|
||||||
|
|
||||||
|
Adds gem dependency file autodetection to "gem install -g"
|
||||||
|
|
||||||
|
* test/rubygems: Tests for the above.
|
||||||
|
|
||||||
Wed Oct 16 09:12:23 2013 Eric Hodel <drbrain@segment7.net>
|
Wed Oct 16 09:12:23 2013 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* lib/rubygems: Update to RubyGems master commit 2a74263. This fixes
|
* lib/rubygems: Update to RubyGems master commit 2a74263. This fixes
|
||||||
|
@ -32,9 +32,13 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|||||||
add_version_option
|
add_version_option
|
||||||
add_prerelease_option "to be installed. (Only for listed gems)"
|
add_prerelease_option "to be installed. (Only for listed gems)"
|
||||||
|
|
||||||
add_option(:"Install/Update", '-g', '--file FILE',
|
add_option(:"Install/Update", '-g', '--file [FILE]',
|
||||||
'Read from a gem dependencies API file and',
|
'Read from a gem dependencies API file and',
|
||||||
'install the listed gems') do |v,o|
|
'install the listed gems') do |v,o|
|
||||||
|
v = %w[gem.deps.rb Gemfile Isolate].find do |file|
|
||||||
|
File.exist? file
|
||||||
|
end unless v
|
||||||
|
|
||||||
o[:gemdeps] = v
|
o[:gemdeps] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,11 +19,6 @@ class Gem::Ext::Builder
|
|||||||
|
|
||||||
CHDIR_MUTEX = Mutex.new # :nodoc:
|
CHDIR_MUTEX = Mutex.new # :nodoc:
|
||||||
|
|
||||||
##
|
|
||||||
# `make` targets to run when building the extension
|
|
||||||
|
|
||||||
MAKE_TARGETS = ['clean', '', 'install'] # :nodoc:
|
|
||||||
|
|
||||||
attr_accessor :build_args # :nodoc:
|
attr_accessor :build_args # :nodoc:
|
||||||
|
|
||||||
def self.class_name
|
def self.class_name
|
||||||
@ -45,14 +40,18 @@ class Gem::Ext::Builder
|
|||||||
|
|
||||||
destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
|
destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
|
||||||
|
|
||||||
self::MAKE_TARGETS.each do |target|
|
['clean', '', 'install'].each do |target|
|
||||||
# Pass DESTDIR via command line to override what's in MAKEFLAGS
|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
|
||||||
cmd = [
|
cmd = [
|
||||||
make_program,
|
make_program,
|
||||||
destdir,
|
destdir,
|
||||||
target
|
target
|
||||||
].join(' ').rstrip
|
].join(' ').rstrip
|
||||||
run(cmd, results, "make #{target}".rstrip)
|
begin
|
||||||
|
run(cmd, results, "make #{target}".rstrip)
|
||||||
|
rescue Gem::InstallError
|
||||||
|
raise unless target == 'clean' # ignore clean failure
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
||||||
|
|
||||||
MAKE_TARGETS = ['', 'install'] # :nodoc:
|
|
||||||
|
|
||||||
def self.build(extension, directory, dest_path, results)
|
def self.build(extension, directory, dest_path, results)
|
||||||
unless File.exist?('Makefile') then
|
unless File.exist?('Makefile') then
|
||||||
cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}"
|
cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}"
|
||||||
|
@ -866,5 +866,32 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|||||||
assert_match "Installing r (2.0)", @ui.output
|
assert_match "Installing r (2.0)", @ui.output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_handle_options_file
|
||||||
|
@cmd.handle_options %w[-g Gemfile]
|
||||||
|
|
||||||
|
assert_equal 'Gemfile', @cmd.options[:gemdeps]
|
||||||
|
|
||||||
|
@cmd.handle_options %w[--file gem.deps.rb]
|
||||||
|
|
||||||
|
assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
|
||||||
|
|
||||||
|
FileUtils.touch 'Isolate'
|
||||||
|
|
||||||
|
@cmd.handle_options %w[-g]
|
||||||
|
|
||||||
|
assert_equal 'Isolate', @cmd.options[:gemdeps]
|
||||||
|
|
||||||
|
FileUtils.touch 'Gemfile'
|
||||||
|
|
||||||
|
@cmd.handle_options %w[-g]
|
||||||
|
|
||||||
|
assert_equal 'Gemfile', @cmd.options[:gemdeps]
|
||||||
|
|
||||||
|
FileUtils.touch 'gem.deps.rb'
|
||||||
|
|
||||||
|
@cmd.handle_options %w[-g]
|
||||||
|
|
||||||
|
assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -66,6 +66,37 @@ install:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_class_make_no_clean
|
||||||
|
ENV['DESTDIR'] = 'destination'
|
||||||
|
results = []
|
||||||
|
|
||||||
|
Dir.chdir @ext do
|
||||||
|
open 'Makefile', 'w' do |io|
|
||||||
|
io.puts <<-MAKEFILE
|
||||||
|
all:
|
||||||
|
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
|
||||||
|
|
||||||
|
install:
|
||||||
|
\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}"
|
||||||
|
MAKEFILE
|
||||||
|
end
|
||||||
|
|
||||||
|
Gem::Ext::Builder.make @dest_path, results
|
||||||
|
end
|
||||||
|
|
||||||
|
results = results.join "\n"
|
||||||
|
|
||||||
|
if RUBY_VERSION > '2.0' then
|
||||||
|
assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
|
||||||
|
assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
|
||||||
|
assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
|
||||||
|
else
|
||||||
|
refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" clean$%, results
|
||||||
|
refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
|
||||||
|
refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_build_extensions
|
def test_build_extensions
|
||||||
@spec.extensions << 'extconf.rb'
|
@spec.extensions << 'extconf.rb'
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ install (FILES test.txt DESTINATION bin)
|
|||||||
|
|
||||||
def test_self_build_has_makefile
|
def test_self_build_has_makefile
|
||||||
File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
|
File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
|
||||||
makefile.puts "clean:\n\t@echo ok\nall:\n\t@echo ok\ninstall:\n\t@echo ok"
|
makefile.puts "all:\n\t@echo ok\ninstall:\n\t@echo ok"
|
||||||
end
|
end
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user