Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into 1.8.7
Browse files Browse the repository at this point in the history
Conflicts:
	gems_list.txt
	kernel/bootstrap/thread.rb
	spec/ruby/optional/capi/thread_spec.rb
  • Loading branch information
brixen committed Apr 21, 2015
2 parents 765a03a + 0ec0c5c commit 2a09d43
Show file tree
Hide file tree
Showing 42 changed files with 782 additions and 657 deletions.
2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rubysl-enumerator-1.0.0.gem
rubysl-erb-1.0.1.gem
rubysl-etc-1.0.1.gem
rubysl-expect-1.0.0.gem
rubysl-fcntl-1.0.2.gem
rubysl-fcntl-1.0.1.gem
rubysl-fileutils-1.0.0.gem
rubysl-find-1.0.0.gem
rubysl-forwardable-1.0.0.gem
Expand Down
5 changes: 5 additions & 0 deletions kernel/bootstrap/rubinius.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def self.extended_modules(obj)
raise PrimitiveFailure, "Rubinius.extended_modules primitive failed"
end

def self.global_serial
Rubinius.primitive :vm_global_serial
raise PrimitiveFailure, "Rubinius.vm_global_serial primitive failed"
end

def self.inc_global_serial
Rubinius.primitive :vm_inc_global_serial
raise PrimitiveFailure, "Rubinius.vm_inc_global_serial primitive failed"
Expand Down
72 changes: 16 additions & 56 deletions kernel/bootstrap/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def kill
alias_method :terminate, :kill

def value
join_inner { @result }
join
@result
end

def active_exception
Expand All @@ -176,11 +177,6 @@ def __context__
Kernel.raise PrimitiveFailure, "Thread#__context__ primitive failed"
end

def native_join
Rubinius.primitive :thread_join
Kernel.raise PrimitiveFailure, "Thread#native_join primitive failed"
end

def mri_backtrace
Rubinius.primitive :thread_mri_backtrace
Kernel.raise PrimitiveFailure, "Thread#mri_backtrace primitive failed"
Expand Down Expand Up @@ -288,8 +284,6 @@ def status
if @alive
if @sleep
"sleep"
elsif @dying
"aborting"
else
"run"
end
Expand All @@ -300,8 +294,20 @@ def status
end
end

def join(timeout = undefined)
join_inner(timeout) { @alive ? nil : self }
def join(timeout=undefined)
if undefined.equal? timeout or nil.equal? timeout
timeout = nil
else
timeout = Rubinius::Type.coerce_to_float timeout
end

value = Rubinius.invoke_primitive :thread_join, self, timeout

if @exception
Kernel.raise @exception
else
value
end
end

def group
Expand All @@ -312,51 +318,6 @@ def add_to_group(group)
@group = group
end

def join_inner(timeout = undefined)
if undefined.equal?(timeout) || nil.equal?(timeout)
timeout = nil
else
timeout = Rubinius::Type.coerce_to_float(timeout)
end
result = nil
Rubinius.lock(self)
begin
if @alive
jc = Rubinius::Channel.new
@joins << jc
Rubinius.unlock(self)
begin
if !timeout
while true
res = jc.receive
# receive returns false if it was a spurious wakeup
break if res != false
end
else
duration = timeout
while true
start = Time.now.to_f
res = jc.receive_timeout duration
# receive returns false if it was a spurious wakeup
break if res != false
elapsed = Time.now.to_f - start
duration -= elapsed
break if duration < 0
end
end
ensure
Rubinius.lock(self)
end
end
Kernel.raise @exception if @exception
result = yield
ensure
Rubinius.unlock(self)
end
result
end
private :join_inner

def raise(exc=undefined, msg=nil, trace=nil)
Rubinius.lock(self)

Expand Down Expand Up @@ -479,5 +440,4 @@ def self.kill(thread)
end

alias_method :run, :wakeup

end
4 changes: 2 additions & 2 deletions library/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require 'thread'

module Gem
VERSION = '2.4.5'
VERSION = '2.4.6'
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down Expand Up @@ -598,7 +598,7 @@ def self.load_yaml

unless test_syck
begin
gem 'psych', '~> 1.2', '>= 1.2.1'
gem 'psych', '>= 1.2.1'
rescue Gem::LoadError
# It's OK if the user does not have the psych gem installed. We will
# attempt to require the stdlib version
Expand Down
5 changes: 2 additions & 3 deletions library/rubygems/basic_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def contains_requirable_file? file
@contains_requirable_file ||= {}
@contains_requirable_file[file] ||=
begin
if instance_variable_defined?(:@ignored) or
instance_variable_defined?('@ignored') then
if instance_variable_defined?(:@ignored) then
return false
elsif missing_extensions? then
@ignored = true
Expand Down Expand Up @@ -145,7 +144,7 @@ def full_require_paths
File.join full_gem_path, path
end

full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty?
full_paths << extension_dir unless @extensions.nil? || @extensions.empty?

full_paths
end
Expand Down
4 changes: 2 additions & 2 deletions library/rubygems/commands/help_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Gem::Commands::HelpCommand < Gem::Command
Ruby Version and Engine Dependency
==================================
You can specifiy the version, engine and engine version of ruby to use with
You can specify the version, engine and engine version of ruby to use with
your gem dependencies file. If you are not running the specified version
RubyGems will raise an exception.
Expand Down Expand Up @@ -223,7 +223,7 @@ class Gem::Commands::HelpCommand < Gem::Command
The #group method allows multiple groups.
The #gemspec development dependencies are placed in the :development group by
default. This may be overriden with the :development_group option:
default. This may be overridden with the :development_group option:
gemspec development_group: :other
Expand Down
4 changes: 3 additions & 1 deletion library/rubygems/commands/open_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def open_gem name
end

def open_editor path
system(*@editor.split(/\s+/) + [path])
Dir.chdir(path) do
system(*@editor.split(/\s+/) + [path])
end
end

def spec_for name
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/commands/yank_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def description # :nodoc:
data you will need to change them immediately and yank your gem.
If you are yanking a gem due to intellectual property reasons contact
http://help.rubygems.org for permanant removal. Be sure to mention this
http://help.rubygems.org for permanent removal. Be sure to mention this
as the reason for the removal request.
EOF
end
Expand Down
3 changes: 1 addition & 2 deletions library/rubygems/compatibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ module Gem

$LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library

if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
# TODO path does not exist here
if path = $LOADED_FEATURES.find {|n| n.end_with? '/rubygems.rb'} then
raise LoadError, "another rubygems is already loaded from #{path}"
end

Expand Down
12 changes: 11 additions & 1 deletion library/rubygems/dependency_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,17 @@ def find_gems_with_sources dep, best_only=false # :nodoc:
tuples, errors = Gem::SpecFetcher.fetcher.search_for_dependency dep

if best_only && !tuples.empty?
tuples.sort! { |a,b| b[0].version <=> a[0].version }
tuples.sort! do |a,b|
if b[0].version == a[0].version
if b[0].platform != Gem::Platform::RUBY
1
else
-1
end
else
b[0].version <=> a[0].version
end
end
tuples = [tuples.first]
end

Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def app_script_text(bin_file_name)
# return the stub script text used to launch the true Ruby script

def windows_stub_script(bindir, bin_file_name)
ruby = Gem.ruby.chomp('"').tr(File::SEPARATOR, "\\")
ruby = Gem.ruby.gsub(/^\"|\"$/, "").tr(File::SEPARATOR, "\\")
return <<-TEXT
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
Expand Down
3 changes: 2 additions & 1 deletion library/rubygems/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,9 @@ def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:

FileUtils.mkdir_p mkdir, mkdir_options

open destination, 'wb', entry.header.mode do |out|
open destination, 'wb' do |out|
out.write entry.read
FileUtils.chmod entry.header.mode, destination
end if entry.file?

verbose destination
Expand Down
8 changes: 4 additions & 4 deletions library/rubygems/package/tar_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def mkdir(name, mode)

def split_name(name) # :nodoc:
if name.bytesize > 256
raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
end

if name.bytesize <= 100 then
Expand All @@ -311,11 +311,11 @@ def split_name(name) # :nodoc:
name = newname

if name.bytesize > 100
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
end

if prefix.bytesize > 155 then
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
end
end

Expand Down
7 changes: 0 additions & 7 deletions library/rubygems/path_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ def initialize(env=ENV)

private

##
# Set the Gem home directory (as reported by Gem.dir).

def home=(home)
@home = home.to_s
end

##
# Set the Gem search path (as reported by Gem.path).

Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/psych_additions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This exists just to satify bugs in marshal'd gemspecs that
# This exists just to satisfy bugs in marshal'd gemspecs that
# contain a reference to YAML::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/remote_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def api_endpoint(uri)
# filename. Returns nil if the gem cannot be located.
#--
# Should probably be integrated with #download below, but that will be a
# larger, more emcompassing effort. -erikh
# larger, more encompassing effort. -erikh

def download_to_cache dependency
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
Expand Down
14 changes: 10 additions & 4 deletions library/rubygems/request_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def gem name, *reqs
if dep = @dependency_names[name] then
dep.requirement.concat reqs
else
dep = Gem::Dependency.new name, reqs
dep = Gem::Dependency.new name, *reqs
@dependency_names[name] = dep
@dependencies << dep
end
Expand Down Expand Up @@ -223,7 +223,7 @@ def install_from_gemdeps options, &block

if options.fetch :lock, true then
lockfile =
Gem::RequestSet::Lockfile.new self, gemdeps, gem_deps_api.dependencies
Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies
lockfile.write
end

Expand Down Expand Up @@ -275,8 +275,13 @@ def load_gemdeps path, without_groups = [], installing = false

@git_set.root_dir = @install_dir

lockfile = Gem::RequestSet::Lockfile.new self, path
lockfile.parse
lock_file = "#{File.expand_path(path)}.lock".untaint
begin
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
parser = tokenizer.make_parser self, []
parser.parse
rescue Errno::ENOENT
end

gf = Gem::RequestSet::GemDependencyAPI.new self, path
gf.installing = installing
Expand Down Expand Up @@ -411,3 +416,4 @@ def tsort_each_child node # :nodoc:

require 'rubygems/request_set/gem_dependency_api'
require 'rubygems/request_set/lockfile'
require 'rubygems/request_set/lockfile/tokenizer'
8 changes: 4 additions & 4 deletions library/rubygems/request_set/gem_dependency_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ def gem name, *requirements

@dependencies[name] =
if requirements.empty? and not source_set then
nil
Gem::Requirement.default
elsif source_set then
'!'
Gem::Requirement.source_set
else
requirements
Gem::Requirement.create requirements
end

return unless gem_platforms options
Expand Down Expand Up @@ -601,7 +601,7 @@ def gemspec options = {}
add_dependencies groups, [self_dep]
add_dependencies groups, spec.runtime_dependencies

@dependencies[spec.name] = '!'
@dependencies[spec.name] = Gem::Requirement.source_set

spec.dependencies.each do |dep|
@dependencies[dep.name] = dep.requirement
Expand Down

0 comments on commit 2a09d43

Please sign in to comment.