summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-20 00:31:12 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-20 00:31:12 +0000
commit8552f7aa680e1f1a31d76dc9038d80248a445960 (patch)
tree29de125ca8389a65e44d42b269a19274b8846b11 /lib
parent347e748bddd42e5a39dcb5c55ac37704a14b9374 (diff)
* lib/rubygems: Update to RubyGems master 3de7e0f. Changes:
Only attempt to build extensions for newly-installed gems. This prevents compilation attempts at gem activation time for gems that already have extensions built. Fix crash in the dependency resolver for dependencies that cannot be resolved. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/dependency_resolver.rb2
-rw-r--r--lib/rubygems/dependency_resolver/vendor_set.rb3
-rw-r--r--lib/rubygems/installer.rb3
-rw-r--r--lib/rubygems/specification.rb31
-rw-r--r--lib/rubygems/util/list.rb4
5 files changed, 41 insertions, 2 deletions
diff --git a/lib/rubygems/dependency_resolver.rb b/lib/rubygems/dependency_resolver.rb
index 2b3cc1aa34..10cecf7972 100644
--- a/lib/rubygems/dependency_resolver.rb
+++ b/lib/rubygems/dependency_resolver.rb
@@ -125,7 +125,7 @@ class Gem::DependencyResolver
# If the existing activation indicates that there are other possibles for
# it, then issue the conflict on the dependency for the activation itself.
# Otherwise, issue it on the requester's request itself.
- if existing.others_possible?
+ if existing.others_possible? or existing.request.requester.nil? then
conflict =
Gem::DependencyResolver::DependencyConflict.new dep, existing
else
diff --git a/lib/rubygems/dependency_resolver/vendor_set.rb b/lib/rubygems/dependency_resolver/vendor_set.rb
index 53c377b069..716c2a8e26 100644
--- a/lib/rubygems/dependency_resolver/vendor_set.rb
+++ b/lib/rubygems/dependency_resolver/vendor_set.rb
@@ -28,6 +28,9 @@ class Gem::DependencyResolver::VendorSet
spec = Gem::Specification.load gemspec
+ raise Gem::GemNotFoundException,
+ "unable to find #{gemspec} for gem #{name}" unless spec
+
key = "#{spec.name}-#{spec.version}-#{spec.platform}"
@specs[key] = spec
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 2e7ccc731e..214652a241 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -346,7 +346,10 @@ class Gem::Installer
def write_spec
open spec_file, 'w' do |file|
+ spec.installed_by_version = Gem.rubygems_version
+
file.puts spec.to_ruby_for_cache
+
file.fsync rescue nil # for filesystems without fsync(2)
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 21119b901a..b2c2acc294 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -506,6 +506,23 @@ class Gem::Specification < Gem::BasicSpecification
end
##
+ # The version of RubyGems that installed this gem. Returns
+ # <code>Gem::Version.new(0)</code> for gems installed by versions earlier
+ # than RubyGems 2.2.0.
+
+ def installed_by_version # :nodoc:
+ @installed_by_version ||= Gem::Version.new(0)
+ end
+
+ ##
+ # Sets the version of RubyGems that installed this gem. See also
+ # #installed_by_version.
+
+ def installed_by_version= version # :nodoc:
+ @installed_by_version = Gem::Version.new version
+ end
+
+ ##
# The license for this gem.
#
# The license must be a short name, no more than 64 characters.
@@ -1391,6 +1408,7 @@ class Gem::Specification < Gem::BasicSpecification
def build_extensions # :nodoc:
return if default_gem?
return if extensions.empty?
+ return if installed_by_version < Gem::Version.new('2.2')
return if File.exist? gem_build_complete_path
return if !File.writable?(base_dir) &&
!File.exist?(File.join(base_dir, 'extensions'))
@@ -1776,6 +1794,7 @@ class Gem::Specification < Gem::BasicSpecification
@activated = false
self.loaded_from = nil
@original_platform = nil
+ @installed_by_version = nil
@@nil_attributes.each do |key|
instance_variable_set "@#{key}", nil
@@ -1979,7 +1998,12 @@ class Gem::Specification < Gem::BasicSpecification
q.group 2, 'Gem::Specification.new do |s|', 'end' do
q.breakable
- @@attributes.each do |attr_name|
+ attributes = @@attributes - [:name, :version]
+ attributes.unshift :installed_by_version
+ attributes.unshift :version
+ attributes.unshift :name
+
+ attributes.each do |attr_name|
current_value = self.send attr_name
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name then
@@ -2262,6 +2286,11 @@ class Gem::Specification < Gem::BasicSpecification
end
end
+ if @installed_by_version then
+ result << nil
+ result << " s.installed_by_version = \"#{Gem::VERSION}\""
+ end
+
unless dependencies.empty? then
result << nil
result << " if s.respond_to? :specification_version then"
diff --git a/lib/rubygems/util/list.rb b/lib/rubygems/util/list.rb
index 9f540adcc1..9bc11fe334 100644
--- a/lib/rubygems/util/list.rb
+++ b/lib/rubygems/util/list.rb
@@ -36,6 +36,10 @@ module Gem
List.new value, self
end
+ def pretty_print q # :nodoc:
+ q.pp to_a
+ end
+
def self.prepend(list, value)
return List.new(value) unless list
List.new value, list