c8-stream-2.6
imports/c8-stream-2.6/ruby-2.6.10-109.module+el8.6.0+15475+c55337b4
commit
0e65b19c65
@ -0,0 +1 @@
|
|||||||
|
SOURCES/ruby-2.6.10.tar.xz
|
@ -0,0 +1 @@
|
|||||||
|
e91de95735d0af32238903c7c58d2b660433e0cc SOURCES/ruby-2.6.10.tar.xz
|
@ -0,0 +1,8 @@
|
|||||||
|
if defined?(Gem)
|
||||||
|
require 'rubygems.rb'
|
||||||
|
|
||||||
|
begin
|
||||||
|
require 'abrt'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,303 @@
|
|||||||
|
/* SystemTap tapset to make it easier to trace Ruby 2.0
|
||||||
|
*
|
||||||
|
* All probes provided by Ruby can be listed using following command
|
||||||
|
* (the path to the library must be adjuste appropriately):
|
||||||
|
*
|
||||||
|
* stap -L 'process("@LIBRARY_PATH@").mark("*")'
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.array.create - Allocation of new array.
|
||||||
|
*
|
||||||
|
* @size: Number of elements (an int)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.array.create =
|
||||||
|
process("@LIBRARY_PATH@").mark("array__create")
|
||||||
|
{
|
||||||
|
size = $arg1
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.cmethod.entry - Fired just before a method implemented in C is entered.
|
||||||
|
*
|
||||||
|
* @classname: Name of the class (string)
|
||||||
|
* @methodname: The method about bo be executed (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.cmethod.entry =
|
||||||
|
process("@LIBRARY_PATH@").mark("cmethod__entry")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
methodname = user_string($arg2)
|
||||||
|
file = user_string($arg3)
|
||||||
|
line = $arg4
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.cmethod.return - Fired just after a method implemented in C has returned.
|
||||||
|
*
|
||||||
|
* @classname: Name of the class (string)
|
||||||
|
* @methodname: The executed method (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.cmethod.return =
|
||||||
|
process("@LIBRARY_PATH@").mark("cmethod__return")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
methodname = user_string($arg2)
|
||||||
|
file = user_string($arg3)
|
||||||
|
line = $arg4
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.find.require.entry - Fired when require starts to search load
|
||||||
|
* path for suitable file to require.
|
||||||
|
*
|
||||||
|
* @requiredfile: The name of the file to be required (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.find.require.entry =
|
||||||
|
process("@LIBRARY_PATH@").mark("find__require__entry")
|
||||||
|
{
|
||||||
|
requiredfile = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.find.require.return - Fired just after require has finished
|
||||||
|
* search of load path for suitable file to require.
|
||||||
|
*
|
||||||
|
* @requiredfile: The name of the file to be required (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.find.require.return =
|
||||||
|
process("@LIBRARY_PATH@").mark("find__require__return")
|
||||||
|
{
|
||||||
|
requiredfile = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.gc.mark.begin - Fired when a GC mark phase is about to start.
|
||||||
|
*
|
||||||
|
* It takes no arguments.
|
||||||
|
*/
|
||||||
|
probe ruby.gc.mark.begin =
|
||||||
|
process("@LIBRARY_PATH@").mark("gc__mark__begin")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.gc.mark.end - Fired when a GC mark phase has ended.
|
||||||
|
*
|
||||||
|
* It takes no arguments.
|
||||||
|
*/
|
||||||
|
probe ruby.gc.mark.end =
|
||||||
|
process("@LIBRARY_PATH@").mark("gc__mark__end")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.gc.sweep.begin - Fired when a GC sweep phase is about to start.
|
||||||
|
*
|
||||||
|
* It takes no arguments.
|
||||||
|
*/
|
||||||
|
probe ruby.gc.sweep.begin =
|
||||||
|
process("@LIBRARY_PATH@").mark("gc__sweep__begin")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.gc.sweep.end - Fired when a GC sweep phase has ended.
|
||||||
|
*
|
||||||
|
* It takes no arguments.
|
||||||
|
*/
|
||||||
|
probe ruby.gc.sweep.end =
|
||||||
|
process("@LIBRARY_PATH@").mark("gc__sweep__end")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.hash.create - Allocation of new hash.
|
||||||
|
*
|
||||||
|
* @size: Number of elements (int)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.hash.create =
|
||||||
|
process("@LIBRARY_PATH@").mark("hash__create")
|
||||||
|
{
|
||||||
|
size = $arg1
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.load.entry - Fired when calls to "load" are made.
|
||||||
|
*
|
||||||
|
* @loadedfile: The name of the file to be loaded (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.load.entry =
|
||||||
|
process("@LIBRARY_PATH@").mark("load__entry")
|
||||||
|
{
|
||||||
|
loadedfile = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.load.return - Fired just after require has finished
|
||||||
|
* search of load path for suitable file to require.
|
||||||
|
*
|
||||||
|
* @loadedfile: The name of the file that was loaded (string)
|
||||||
|
*/
|
||||||
|
probe ruby.load.return =
|
||||||
|
process("@LIBRARY_PATH@").mark("load__return")
|
||||||
|
{
|
||||||
|
loadedfile = user_string($arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.method.entry - Fired just before a method implemented in Ruby is entered.
|
||||||
|
*
|
||||||
|
* @classname: Name of the class (string)
|
||||||
|
* @methodname: The method about bo be executed (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.method.entry =
|
||||||
|
process("@LIBRARY_PATH@").mark("method__entry")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
methodname = user_string($arg2)
|
||||||
|
file = user_string($arg3)
|
||||||
|
line = $arg4
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.method.return - Fired just after a method implemented in Ruby has returned.
|
||||||
|
*
|
||||||
|
* @classname: Name of the class (string)
|
||||||
|
* @methodname: The executed method (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.method.return =
|
||||||
|
process("@LIBRARY_PATH@").mark("method__return")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
methodname = user_string($arg2)
|
||||||
|
file = user_string($arg3)
|
||||||
|
line = $arg4
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.object.create - Allocation of new object.
|
||||||
|
*
|
||||||
|
* @classname: Name of the class (string)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.object.create =
|
||||||
|
process("@LIBRARY_PATH@").mark("object__create")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.parse.begin - Fired just before a Ruby source file is parsed.
|
||||||
|
*
|
||||||
|
* @parsedfile: The name of the file to be parsed (string)
|
||||||
|
* @parsedline: The line number of beginning of parsing (int)
|
||||||
|
*/
|
||||||
|
probe ruby.parse.begin =
|
||||||
|
process("@LIBRARY_PATH@").mark("parse__begin")
|
||||||
|
{
|
||||||
|
parsedfile = user_string($arg1)
|
||||||
|
parsedline = $arg2
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.parse.end - Fired just after a Ruby source file was parsed.
|
||||||
|
*
|
||||||
|
* @parsedfile: The name of parsed the file (string)
|
||||||
|
* @parsedline: The line number of beginning of parsing (int)
|
||||||
|
*/
|
||||||
|
probe ruby.parse.end =
|
||||||
|
process("@LIBRARY_PATH@").mark("parse__end")
|
||||||
|
{
|
||||||
|
parsedfile = user_string($arg1)
|
||||||
|
parsedline = $arg2
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.raise - Fired when an exception is raised.
|
||||||
|
*
|
||||||
|
* @classname: The class name of the raised exception (string)
|
||||||
|
* @file: The name of the file where the exception was raised (string)
|
||||||
|
* @line: The line number in the file where the exception was raised (int)
|
||||||
|
*/
|
||||||
|
probe ruby.raise =
|
||||||
|
process("@LIBRARY_PATH@").mark("raise")
|
||||||
|
{
|
||||||
|
classname = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.require.entry - Fired on calls to rb_require_safe (when a file
|
||||||
|
* is required).
|
||||||
|
*
|
||||||
|
* @requiredfile: The name of the file to be required (string)
|
||||||
|
* @file: The file that called "require" (string)
|
||||||
|
* @line: The line number where the call to require was made(int)
|
||||||
|
*/
|
||||||
|
probe ruby.require.entry =
|
||||||
|
process("@LIBRARY_PATH@").mark("require__entry")
|
||||||
|
{
|
||||||
|
requiredfile = user_string($arg1)
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.require.return - Fired just after require has finished
|
||||||
|
* search of load path for suitable file to require.
|
||||||
|
*
|
||||||
|
* @requiredfile: The file that was required (string)
|
||||||
|
*/
|
||||||
|
probe ruby.require.return =
|
||||||
|
process("@LIBRARY_PATH@").mark("require__return")
|
||||||
|
{
|
||||||
|
requiredfile = user_string($arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* probe ruby.string.create - Allocation of new string.
|
||||||
|
*
|
||||||
|
* @size: Number of elements (an int)
|
||||||
|
* @file: The file name where the method is being called (string)
|
||||||
|
* @line: The line number where the method is being called (int)
|
||||||
|
*/
|
||||||
|
probe ruby.string.create =
|
||||||
|
process("@LIBRARY_PATH@").mark("string__create")
|
||||||
|
{
|
||||||
|
size = $arg1
|
||||||
|
file = user_string($arg2)
|
||||||
|
line = $arg3
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
%ruby_libdir %{_datadir}/%{name}
|
||||||
|
%ruby_libarchdir %{_libdir}/%{name}
|
||||||
|
|
||||||
|
# This is the local lib/arch and should not be used for packaging.
|
||||||
|
%ruby_sitedir site_ruby
|
||||||
|
%ruby_sitelibdir %{_prefix}/local/share/%{name}/%{ruby_sitedir}
|
||||||
|
%ruby_sitearchdir %{_prefix}/local/%{_lib}/%{name}/%{ruby_sitedir}
|
||||||
|
|
||||||
|
# This is the general location for libs/archs compatible with all
|
||||||
|
# or most of the Ruby versions available in the Fedora repositories.
|
||||||
|
%ruby_vendordir vendor_ruby
|
||||||
|
%ruby_vendorlibdir %{ruby_libdir}/%{ruby_vendordir}
|
||||||
|
%ruby_vendorarchdir %{ruby_libarchdir}/%{ruby_vendordir}
|
||||||
|
|
||||||
|
# For ruby packages we want to filter out any provides caused by private
|
||||||
|
# libs in %%{ruby_vendorarchdir}/%%{ruby_sitearchdir}.
|
||||||
|
#
|
||||||
|
# Note that this must be invoked in the spec file, preferably as
|
||||||
|
# "%{?ruby_default_filter}", before any %description block.
|
||||||
|
%ruby_default_filter %{expand: \
|
||||||
|
%global __provides_exclude_from %{?__provides_exclude_from:%{__provides_exclude_from}|}^(%{ruby_vendorarchdir}|%{ruby_sitearchdir})/.*\\\\.so$ \
|
||||||
|
}
|
@ -0,0 +1,195 @@
|
|||||||
|
# The RubyGems root folder.
|
||||||
|
%gem_dir %{_datadir}/gems
|
||||||
|
%gem_archdir %{_libdir}/gems
|
||||||
|
|
||||||
|
# Common gem locations and files.
|
||||||
|
%gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{?prerelease}
|
||||||
|
%gem_extdir_mri %{gem_archdir}/%{name}/%{gem_name}-%{version}%{?prerelease}
|
||||||
|
%gem_libdir %{gem_instdir}/lib
|
||||||
|
%gem_cache %{gem_dir}/cache/%{gem_name}-%{version}%{?prerelease}.gem
|
||||||
|
%gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}%{?prerelease}.gemspec
|
||||||
|
%gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}%{?prerelease}
|
||||||
|
|
||||||
|
|
||||||
|
# %gem_install - Install gem into appropriate directory.
|
||||||
|
#
|
||||||
|
# Usage: %gem_install [options]
|
||||||
|
#
|
||||||
|
# -n <gem_file> Overrides gem file name for installation.
|
||||||
|
# -d <install_dir> Set installation directory.
|
||||||
|
#
|
||||||
|
%gem_install(d:n:) \
|
||||||
|
mkdir -p %{-d*}%{!?-d:.%{gem_dir}} \
|
||||||
|
\
|
||||||
|
CONFIGURE_ARGS="--with-cflags='%{optflags}' --with-cxxflags='%{optflags}' $CONFIGURE_ARGS" \\\
|
||||||
|
gem install \\\
|
||||||
|
-V \\\
|
||||||
|
--local \\\
|
||||||
|
--build-root %{-d*}%{!?-d:.} \\\
|
||||||
|
--force \\\
|
||||||
|
--document=ri,rdoc \\\
|
||||||
|
%{-n*}%{!?-n:%{gem_name}-%{version}%{?prerelease}.gem} \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
|
||||||
|
# For rubygems packages we want to filter out any provides caused by private
|
||||||
|
# libs in %%{gem_archdir}.
|
||||||
|
#
|
||||||
|
# Note that this must be invoked in the spec file, preferably as
|
||||||
|
# "%{?rubygems_default_filter}", before any %description block.
|
||||||
|
%rubygems_default_filter %{expand: \
|
||||||
|
%global __provides_exclude_from %{?__provides_exclude_from:%{__provides_exclude_from}|}^%{gem_extdir_mri}/.*\\\\.so$ \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# The 'read' command in %%gemspec_* macros is not essential, but it is usefull
|
||||||
|
# to make the sript appear in build log.
|
||||||
|
|
||||||
|
|
||||||
|
# %gemspec_add_dep - Add dependency into .gemspec.
|
||||||
|
#
|
||||||
|
# Usage: %gemspec_add_dep -g <gem> [options] [requirements]
|
||||||
|
#
|
||||||
|
# Add dependency named <gem> to .gemspec file. The macro adds runtime
|
||||||
|
# dependency by default. The [requirements] argument can be used to specify
|
||||||
|
# the dependency constraints more precisely. It is expected to be valid Ruby
|
||||||
|
# code.
|
||||||
|
#
|
||||||
|
# -s <gemspec_file> Overrides the default .gemspec location.
|
||||||
|
# -d Add development dependecy.
|
||||||
|
#
|
||||||
|
%gemspec_add_dep(g:s:d) \
|
||||||
|
read -d '' gemspec_add_dep_script << 'EOR' || : \
|
||||||
|
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}%{?prerelease}.gemspec}' \
|
||||||
|
\
|
||||||
|
name = '%{-g*}' \
|
||||||
|
requirements = %{*}%{!?1:nil} \
|
||||||
|
\
|
||||||
|
type = :%{!?-d:runtime}%{?-d:development} \
|
||||||
|
\
|
||||||
|
spec = Gem::Specification.load(gemspec_file) \
|
||||||
|
abort("#{gemspec_file} is not accessible.") unless spec \
|
||||||
|
\
|
||||||
|
dep = spec.dependencies.detect { |d| d.type == type && d.name == name } \
|
||||||
|
if dep \
|
||||||
|
dep.requirement.concat requirements \
|
||||||
|
else \
|
||||||
|
spec.public_send "add_#{type}_dependency", name, requirements \
|
||||||
|
end \
|
||||||
|
File.write gemspec_file, spec.to_ruby \
|
||||||
|
EOR\
|
||||||
|
echo "$gemspec_add_dep_script" | ruby \
|
||||||
|
unset -v gemspec_add_dep_script \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
|
||||||
|
# %gemspec_remove_dep - Remove dependency from .gemspec.
|
||||||
|
#
|
||||||
|
# Usage: %gemspec_remove_dep -g <gem> [options] [requirements]
|
||||||
|
#
|
||||||
|
# Remove dependency named <gem> from .gemspec file. The macro removes runtime
|
||||||
|
# dependency by default. The [requirements] argument can be used to specify
|
||||||
|
# the dependency constraints more precisely. It is expected to be valid Ruby
|
||||||
|
# code. The macro fails if these specific requirements can't be removed.
|
||||||
|
#
|
||||||
|
# -s <gemspec_file> Overrides the default .gemspec location.
|
||||||
|
# -d Remove development dependecy.
|
||||||
|
#
|
||||||
|
%gemspec_remove_dep(g:s:d) \
|
||||||
|
read -d '' gemspec_remove_dep_script << 'EOR' || : \
|
||||||
|
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}%{?prerelease}.gemspec}' \
|
||||||
|
\
|
||||||
|
name = '%{-g*}' \
|
||||||
|
requirements = %{*}%{!?1:nil} \
|
||||||
|
\
|
||||||
|
type = :%{!?-d:runtime}%{?-d:development} \
|
||||||
|
\
|
||||||
|
spec = Gem::Specification.load(gemspec_file) \
|
||||||
|
abort("#{gemspec_file} is not accessible.") unless spec \
|
||||||
|
\
|
||||||
|
dep = spec.dependencies.detect { |d| d.type == type && d.name == name } \
|
||||||
|
if dep \
|
||||||
|
if requirements \
|
||||||
|
requirements = Gem::Requirement.create(requirements).requirements \
|
||||||
|
requirements.each do |r| \
|
||||||
|
unless dep.requirement.requirements.reject! { |dependency_requirements| dependency_requirements == r } \
|
||||||
|
abort("Requirement '#{r.first} #{r.last}' was not possible to remove for dependency '#{dep}'!") \
|
||||||
|
end \
|
||||||
|
end \
|
||||||
|
spec.dependencies.delete dep if dep.requirement.requirements.empty? \
|
||||||
|
else \
|
||||||
|
spec.dependencies.delete dep \
|
||||||
|
end \
|
||||||
|
else \
|
||||||
|
abort("Dependency '#{name}' was not found!") \
|
||||||
|
end \
|
||||||
|
File.write gemspec_file, spec.to_ruby \
|
||||||
|
EOR\
|
||||||
|
echo "$gemspec_remove_dep_script" | ruby \
|
||||||
|
unset -v gemspec_remove_dep_script \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
|
||||||
|
# %%gemspec_add_file - Add files to various files lists in .gemspec.
|
||||||
|
#
|
||||||
|
# Usage: %%gemspec_add_file [options] <file>
|
||||||
|
#
|
||||||
|
# Add files to .gemspec file. <file> is expected to be valid Ruby code.
|
||||||
|
# Path to file is expected. Does not check real files in any way.
|
||||||
|
# By default, `files` list is edited.
|
||||||
|
#
|
||||||
|
# -s <gemspec_file> Overrides the default .gemspec location.
|
||||||
|
# -t Edit test_files only.
|
||||||
|
# -r Edit extra_rdoc_files only.
|
||||||
|
#
|
||||||
|
%gemspec_add_file(s:tr) \
|
||||||
|
read -d '' gemspec_add_file_script << 'EOR' || : \
|
||||||
|
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}%{?prerelease}.gemspec}' \
|
||||||
|
\
|
||||||
|
abort("gemspec_add_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \
|
||||||
|
\
|
||||||
|
filenames = %{*}%{!?1:nil} \
|
||||||
|
filenames = Array(filenames) \
|
||||||
|
\
|
||||||
|
spec = Gem::Specification.load(gemspec_file) \
|
||||||
|
abort("#{gemspec_file} is not accessible.") unless spec \
|
||||||
|
\
|
||||||
|
spec.%{?-t:test_}%{?-r:extra_rdoc_}files += filenames \
|
||||||
|
File.write gemspec_file, spec.to_ruby \
|
||||||
|
EOR\
|
||||||
|
echo "$gemspec_add_file_script" | ruby \
|
||||||
|
unset -v gemspec_add_file_script \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
|
||||||
|
# %%gemspec_remove_file - Remove files from various files lists in .gemspec.
|
||||||
|
#
|
||||||
|
# Usage: %%gemspec_remove_file [options] <file>
|
||||||
|
#
|
||||||
|
# Remove files from .gemspec file. <file> is expected to be valid Ruby code.
|
||||||
|
# Path to file is expected. Does not check/remove real files in any way.
|
||||||
|
# By default, `files` list is edited. File has to be removed from `test_files`
|
||||||
|
# first in order to be removable from `files`.
|
||||||
|
#
|
||||||
|
# -s <gemspec_file> Overrides the default .gemspec location.
|
||||||
|
# -t Edit test_files only.
|
||||||
|
# -r Edit extra_rdoc_files only.
|
||||||
|
#
|
||||||
|
%gemspec_remove_file(s:tr) \
|
||||||
|
read -d '' gemspec_remove_file_script << 'EOR' || : \
|
||||||
|
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}%{?prerelease}.gemspec}' \
|
||||||
|
\
|
||||||
|
abort("gemspec_remove_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \
|
||||||
|
\
|
||||||
|
filenames = %{*}%{!?1:nil} \
|
||||||
|
filenames = Array(filenames) \
|
||||||
|
\
|
||||||
|
spec = Gem::Specification.load(gemspec_file) \
|
||||||
|
abort("#{gemspec_file} is not accessible.") unless spec \
|
||||||
|
\
|
||||||
|
spec.%{?-t:test_}%{?-r:extra_rdoc_}files -= filenames \
|
||||||
|
File.write gemspec_file, spec.to_ruby \
|
||||||
|
EOR\
|
||||||
|
echo "$gemspec_remove_file_script" | ruby \
|
||||||
|
unset -v gemspec_remove_file_script \
|
||||||
|
%{nil}
|
@ -0,0 +1,148 @@
|
|||||||
|
module Gem
|
||||||
|
class << self
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns full path of previous but one directory of dir in path
|
||||||
|
# E.g. for '/usr/share/ruby', 'ruby', it returns '/usr'
|
||||||
|
|
||||||
|
def previous_but_one_dir_to(path, dir)
|
||||||
|
return unless path
|
||||||
|
|
||||||
|
split_path = path.split(File::SEPARATOR)
|
||||||
|
File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2])
|
||||||
|
end
|
||||||
|
private :previous_but_one_dir_to
|
||||||
|
|
||||||
|
##
|
||||||
|
# Detects --install-dir option specified on command line.
|
||||||
|
|
||||||
|
def opt_install_dir?
|
||||||
|
@opt_install_dir ||= ARGV.include?('--install-dir') || ARGV.include?('-i')
|
||||||
|
end
|
||||||
|
private :opt_install_dir?
|
||||||
|
|
||||||
|
##
|
||||||
|
# Detects --build-root option specified on command line.
|
||||||
|
|
||||||
|
def opt_build_root?
|
||||||
|
@opt_build_root ||= ARGV.include?('--build-root')
|
||||||
|
end
|
||||||
|
private :opt_build_root?
|
||||||
|
|
||||||
|
##
|
||||||
|
# Tries to detect, if arguments and environment variables suggest that
|
||||||
|
# 'gem install' is executed from rpmbuild.
|
||||||
|
|
||||||
|
def rpmbuild?
|
||||||
|
@rpmbuild ||= ENV['RPM_PACKAGE_NAME'] && (opt_install_dir? || opt_build_root?)
|
||||||
|
end
|
||||||
|
private :rpmbuild?
|
||||||
|
|
||||||
|
##
|
||||||
|
# Default gems locations allowed on FHS system (/usr, /usr/share).
|
||||||
|
# The locations are derived from directories specified during build
|
||||||
|
# configuration.
|
||||||
|
|
||||||
|
def default_locations
|
||||||
|
@default_locations ||= {
|
||||||
|
:system => previous_but_one_dir_to(RbConfig::CONFIG['vendordir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']),
|
||||||
|
:local => previous_but_one_dir_to(RbConfig::CONFIG['sitedir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# For each location provides set of directories for binaries (:bin_dir)
|
||||||
|
# platform independent (:gem_dir) and dependent (:ext_dir) files.
|
||||||
|
|
||||||
|
def default_dirs
|
||||||
|
@libdir ||= case RUBY_PLATFORM
|
||||||
|
when 'java'
|
||||||
|
RbConfig::CONFIG['datadir']
|
||||||
|
else
|
||||||
|
RbConfig::CONFIG['libdir']
|
||||||
|
end
|
||||||
|
|
||||||
|
@default_dirs ||= default_locations.inject(Hash.new) do |hash, location|
|
||||||
|
destination, path = location
|
||||||
|
|
||||||
|
hash[destination] = if path
|
||||||
|
{
|
||||||
|
:bin_dir => File.join(path, RbConfig::CONFIG['bindir'].split(File::SEPARATOR).last),
|
||||||
|
:gem_dir => File.join(path, RbConfig::CONFIG['datadir'].split(File::SEPARATOR).last, 'gems'),
|
||||||
|
:ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems')
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
:bin_dir => '',
|
||||||
|
:gem_dir => '',
|
||||||
|
:ext_dir => ''
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Remove methods we are going to override. This avoids "method redefined;"
|
||||||
|
# warnings otherwise issued by Ruby.
|
||||||
|
|
||||||
|
remove_method :operating_system_defaults if method_defined? :operating_system_defaults
|
||||||
|
remove_method :default_dir if method_defined? :default_dir
|
||||||
|
remove_method :default_path if method_defined? :default_path
|
||||||
|
remove_method :default_ext_dir_for if method_defined? :default_ext_dir_for
|
||||||
|
|
||||||
|
##
|
||||||
|
# Regular user installs into user directory, root manages /usr/local.
|
||||||
|
|
||||||
|
def operating_system_defaults
|
||||||
|
unless opt_build_root?
|
||||||
|
options = if Process.uid == 0
|
||||||
|
"--install-dir=#{Gem.default_dirs[:local][:gem_dir]} --bindir #{Gem.default_dirs[:local][:bin_dir]}"
|
||||||
|
else
|
||||||
|
"--user-install --bindir #{File.join [Dir.home, 'bin']}"
|
||||||
|
end
|
||||||
|
|
||||||
|
{"gem" => options}
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# RubyGems default overrides.
|
||||||
|
|
||||||
|
def default_dir
|
||||||
|
Gem.default_dirs[:system][:gem_dir]
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_path
|
||||||
|
path = default_dirs.collect {|location, paths| paths[:gem_dir]}
|
||||||
|
path.unshift Gem.user_dir if File.exist? Gem.user_home
|
||||||
|
path
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_ext_dir_for base_dir
|
||||||
|
dir = if rpmbuild?
|
||||||
|
build_dir = base_dir.chomp Gem.default_dirs[:system][:gem_dir]
|
||||||
|
if build_dir != base_dir
|
||||||
|
File.join build_dir, Gem.default_dirs[:system][:ext_dir]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
|
||||||
|
dirs && dirs.last[:ext_dir]
|
||||||
|
end
|
||||||
|
dir && File.join(dir, RbConfig::CONFIG['RUBY_INSTALL_NAME'])
|
||||||
|
end
|
||||||
|
|
||||||
|
# This method should be available since RubyGems 2.2 until RubyGems 3.0.
|
||||||
|
# https://github.com/rubygems/rubygems/issues/749
|
||||||
|
if method_defined? :install_extension_in_lib
|
||||||
|
remove_method :install_extension_in_lib
|
||||||
|
|
||||||
|
def install_extension_in_lib
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,25 @@
|
|||||||
|
From 28cc0749d6729aa2444661ee7b411e183fe220b0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Mon, 19 Nov 2012 15:14:51 +0100
|
||||||
|
Subject: [PATCH] Verbose mkmf.
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/mkmf.rb | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
|
||||||
|
index 682eb46..e6b1445 100644
|
||||||
|
--- a/lib/mkmf.rb
|
||||||
|
+++ b/lib/mkmf.rb
|
||||||
|
@@ -1911,7 +1911,7 @@ def configuration(srcdir)
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
# V=0 quiet, V=1 verbose. other values don't work.
|
||||||
|
-V = 0
|
||||||
|
+V = 1
|
||||||
|
Q1 = $(V:1=)
|
||||||
|
Q = $(Q1:0=@)
|
||||||
|
ECHO1 = $(V:1=@ #{CONFIG['NULLCMD']})
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
From 996012f6abe0ce4d68a2de9f249935c6d5b467bc Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Fri, 4 Oct 2013 22:13:11 +0200
|
||||||
|
Subject: [PATCH] Allow to specify addition preludes by configuration option.
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile.in | 2 ++
|
||||||
|
common.mk | 2 +-
|
||||||
|
configure.ac | 7 +++++++
|
||||||
|
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index 7e8ed82..7916993 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -154,6 +154,8 @@ BOOTSTRAPRUBY = @BOOTSTRAPRUBY@
|
||||||
|
COROUTINE_H = @X_FIBER_COROUTINE_H@
|
||||||
|
COROUTINE_OBJ = $(COROUTINE_H:.h=.@OBJEXT@)
|
||||||
|
|
||||||
|
+OPTIONAL_PRELUDES = @OPTIONAL_PRELUDES@
|
||||||
|
+
|
||||||
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
|
MAJOR= @MAJOR@
|
||||||
|
diff --git a/common.mk b/common.mk
|
||||||
|
index 5cfbc3d..3f0a82e 100644
|
||||||
|
--- a/common.mk
|
||||||
|
+++ b/common.mk
|
||||||
|
@@ -156,7 +156,7 @@ ALLOBJS = $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(INITOBJS)
|
||||||
|
GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT)
|
||||||
|
|
||||||
|
DEFAULT_PRELUDES = $(GEM_PRELUDE)
|
||||||
|
-PRELUDE_SCRIPTS = $(srcdir)/prelude.rb $(DEFAULT_PRELUDES)
|
||||||
|
+PRELUDE_SCRIPTS = $(srcdir)/prelude.rb $(DEFAULT_PRELUDES) $(OPTIONAL_PRELUDES)
|
||||||
|
GEM_PRELUDE = $(srcdir)/gem_prelude.rb
|
||||||
|
PRELUDES = {$(srcdir)}prelude.c {$(srcdir)}miniprelude.c
|
||||||
|
GOLFPRELUDES = {$(srcdir)}golf_prelude.c
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 028ef7ca3e..cdeff87871 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3872,6 +3872,13 @@ AC_SUBST(rubyarchhdrdir)dnl
|
||||||
|
AC_SUBST(sitearchhdrdir)dnl
|
||||||
|
AC_SUBST(vendorarchhdrdir)dnl
|
||||||
|
|
||||||
|
+AC_ARG_WITH(prelude,
|
||||||
|
+ AS_HELP_STRING([--with-prelude=FILE-LIST], [specify additional preludes separated by space]),
|
||||||
|
+ [prelude=$withval])
|
||||||
|
+if test "$prelude" != ""; then
|
||||||
|
+ AC_SUBST(OPTIONAL_PRELUDES, $prelude)
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
AC_ARG_WITH(mantype,
|
||||||
|
AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]),
|
||||||
|
[
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
From 07c666ba5c3360dd6f43605a8ac7c85c99c1721f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Tue, 1 Oct 2013 12:22:40 +0200
|
||||||
|
Subject: [PATCH] Allow to configure libruby.so placement.
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 11fc237552..b77e88fc37 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3102,6 +3102,11 @@ AS_IF([test ${multiarch+set}], [
|
||||||
|
])
|
||||||
|
|
||||||
|
archlibdir='${libdir}/${arch}'
|
||||||
|
+AC_ARG_WITH(archlibdir,
|
||||||
|
+ AS_HELP_STRING([--with-archlibdir=DIR],
|
||||||
|
+ [prefix for libruby [[LIBDIR/ARCH]]]),
|
||||||
|
+ [archlibdir="$withval"])
|
||||||
|
+
|
||||||
|
sitearchlibdir='${libdir}/${sitearch}'
|
||||||
|
archincludedir='${includedir}/${arch}'
|
||||||
|
sitearchincludedir='${includedir}/${sitearch}'
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,80 @@
|
|||||||
|
From e24d97c938c481450ed80ec83e5399595946c1ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Fri, 8 Feb 2013 22:48:41 +0100
|
||||||
|
Subject: [PATCH] Prevent duplicated paths when empty version string is
|
||||||
|
configured.
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 3 ++-
|
||||||
|
loadpath.c | 12 ++++++++++++
|
||||||
|
tool/mkconfig.rb | 2 +-
|
||||||
|
3 files changed, 15 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 999e2d6d5d..11fc237552 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3727,7 +3727,8 @@ AS_CASE(["$ruby_version_dir_name"],
|
||||||
|
ruby_version_dir=/'${ruby_version_dir_name}'
|
||||||
|
|
||||||
|
if test -z "${ruby_version_dir_name}"; then
|
||||||
|
- AC_MSG_ERROR([No ruby version, No place for bundled libraries])
|
||||||
|
+ unset ruby_version_dir
|
||||||
|
+ AC_DEFINE(RUBY_LIB_VERSION_BLANK, 1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
rubylibdir='${rubylibprefix}'${ruby_version_dir}
|
||||||
|
diff --git a/loadpath.c b/loadpath.c
|
||||||
|
index 9160031..0d4d953 100644
|
||||||
|
--- a/loadpath.c
|
||||||
|
+++ b/loadpath.c
|
||||||
|
@@ -65,21 +65,33 @@ const char ruby_initial_load_paths[] =
|
||||||
|
RUBY_SEARCH_PATH "\0"
|
||||||
|
#endif
|
||||||
|
#ifndef NO_RUBY_SITE_LIB
|
||||||
|
+#ifdef RUBY_LIB_VERSION_BLANK
|
||||||
|
+ RUBY_SITE_LIB "\0"
|
||||||
|
+#else
|
||||||
|
RUBY_SITE_LIB2 "\0"
|
||||||
|
+#endif
|
||||||
|
#ifdef RUBY_THINARCH
|
||||||
|
RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
|
||||||
|
#endif
|
||||||
|
RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
|
||||||
|
+#ifndef RUBY_LIB_VERSION_BLANK
|
||||||
|
RUBY_SITE_LIB "\0"
|
||||||
|
#endif
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifndef NO_RUBY_VENDOR_LIB
|
||||||
|
+#ifdef RUBY_LIB_VERSION_BLANK
|
||||||
|
+ RUBY_VENDOR_LIB "\0"
|
||||||
|
+#else
|
||||||
|
RUBY_VENDOR_LIB2 "\0"
|
||||||
|
+#endif
|
||||||
|
#ifdef RUBY_THINARCH
|
||||||
|
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
|
||||||
|
#endif
|
||||||
|
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
|
||||||
|
+#ifndef RUBY_LIB_VERSION_BLANK
|
||||||
|
RUBY_VENDOR_LIB "\0"
|
||||||
|
+#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RUBY_LIB "\0"
|
||||||
|
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
|
||||||
|
index 07076d4..35e6c3c 100755
|
||||||
|
--- a/tool/mkconfig.rb
|
||||||
|
+++ b/tool/mkconfig.rb
|
||||||
|
@@ -114,7 +114,7 @@
|
||||||
|
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
|
||||||
|
case name
|
||||||
|
when /^prefix$/
|
||||||
|
- val = "(TOPDIR || DESTDIR + #{val})"
|
||||||
|
+ val = "(((TOPDIR && TOPDIR.empty?) ? nil : TOPDIR) || DESTDIR + #{val})"
|
||||||
|
when /^ARCH_FLAG$/
|
||||||
|
val = "arch_flag || #{val}" if universal
|
||||||
|
when /^UNIVERSAL_ARCHNAMES$/
|
||||||
|
--
|
||||||
|
1.9.0
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 2089cab72b38d6d5e7ba2b596e41014209acad30 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Mon, 19 Nov 2012 14:37:28 +0100
|
||||||
|
Subject: [PATCH] Always use i386.
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index b77e88fc37..6bba453e3c 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3791,6 +3791,8 @@ AC_SUBST(vendorarchdir)dnl
|
||||||
|
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
|
||||||
|
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
|
||||||
|
|
||||||
|
+target_cpu=`echo $target_cpu | sed s/i.86/i386/`
|
||||||
|
+
|
||||||
|
AS_IF([test "${universal_binary-no}" = yes ], [
|
||||||
|
arch="universal-${target_os}"
|
||||||
|
AS_IF([test "${rb_cv_architecture_available}" = yes], [
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,97 @@
|
|||||||
|
From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Fri, 11 Nov 2011 13:14:45 +0100
|
||||||
|
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
|
||||||
|
Ruby tree.
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 5 +++++
|
||||||
|
loadpath.c | 4 ++++
|
||||||
|
template/verconf.h.tmpl | 3 +++
|
||||||
|
tool/rbinstall.rb | 10 ++++++++++
|
||||||
|
4 files changed, 22 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 6bba453e3c..028ef7ca3e 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3763,6 +3763,10 @@ AC_ARG_WITH(vendorarchdir,
|
||||||
|
[vendorarchdir=$withval],
|
||||||
|
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
|
||||||
|
|
||||||
|
+AC_ARG_WITH(rubygemsdir,
|
||||||
|
+ AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
|
||||||
|
+ [rubygemsdir=$withval])
|
||||||
|
+
|
||||||
|
AS_IF([test "${LOAD_RELATIVE+set}"], [
|
||||||
|
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
|
||||||
|
RUBY_EXEC_PREFIX=''
|
||||||
|
@@ -3787,6 +3787,7 @@ AC_SUBST(sitearchdir)dnl
|
||||||
|
AC_SUBST(vendordir)dnl
|
||||||
|
AC_SUBST(vendorlibdir)dnl
|
||||||
|
AC_SUBST(vendorarchdir)dnl
|
||||||
|
+AC_SUBST(rubygemsdir)dnl
|
||||||
|
|
||||||
|
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
|
||||||
|
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
|
||||||
|
diff --git a/loadpath.c b/loadpath.c
|
||||||
|
index 623dc9d..74c5d9e 100644
|
||||||
|
--- a/loadpath.c
|
||||||
|
+++ b/loadpath.c
|
||||||
|
@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifdef RUBYGEMS_DIR
|
||||||
|
+ RUBYGEMS_DIR "\0"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
RUBY_LIB "\0"
|
||||||
|
#ifdef RUBY_THINARCH
|
||||||
|
RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
|
||||||
|
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
|
||||||
|
index 79c003e..34f2382 100644
|
||||||
|
--- a/template/verconf.h.tmpl
|
||||||
|
+++ b/template/verconf.h.tmpl
|
||||||
|
@@ -36,6 +36,9 @@
|
||||||
|
% if C["RUBY_SEARCH_PATH"]
|
||||||
|
#define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
|
||||||
|
% end
|
||||||
|
+% if C["rubygemsdir"]
|
||||||
|
+#define RUBYGEMS_DIR "${rubygemsdir}"
|
||||||
|
+% end
|
||||||
|
%
|
||||||
|
% R = {}
|
||||||
|
% R["ruby_version"] = '"RUBY_LIB_VERSION"'
|
||||||
|
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
|
||||||
|
index d8987af..1efbd33 100755
|
||||||
|
--- a/tool/rbinstall.rb
|
||||||
|
+++ b/tool/rbinstall.rb
|
||||||
|
@@ -338,6 +338,7 @@ if CONFIG["vendordir"]
|
||||||
|
vendorlibdir = CONFIG["vendorlibdir"]
|
||||||
|
vendorarchlibdir = CONFIG["vendorarchdir"]
|
||||||
|
end
|
||||||
|
+rubygemsdir = CONFIG["rubygemsdir"]
|
||||||
|
mandir = CONFIG["mandir", true]
|
||||||
|
docdir = CONFIG["docdir", true]
|
||||||
|
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
|
||||||
|
@@ -564,7 +565,16 @@ end
|
||||||
|
install?(:local, :comm, :lib) do
|
||||||
|
prepare "library scripts", rubylibdir
|
||||||
|
noinst = %w[*.txt *.rdoc *.gemspec]
|
||||||
|
+ # Bundler carries "rubygems.rb" file, so it must be specialcased :/
|
||||||
|
+ noinst += %w[rubygems.rb rubygems/ bundler.rb bundler/] if rubygemsdir
|
||||||
|
install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
|
||||||
|
+ if rubygemsdir
|
||||||
|
+ noinst = %w[*.txt *.rdoc *.gemspec]
|
||||||
|
+ install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
|
||||||
|
+ install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
|
||||||
|
+ install_recursive(File.join(srcdir, "lib", "bundler"), File.join(rubylibdir, "bundler"), :no_install => noinst, :mode => $data_mode)
|
||||||
|
+ install(File.join(srcdir, "lib", "bundler.rb"), rubylibdir, :mode => $data_mode)
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
|
||||||
|
install?(:local, :comm, :hdr, :'comm-hdr') do
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
From 07eb5f5e775dec01a92a8b13910eaced9e8ee0cd Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Tue, 2 Dec 2014 10:56:58 +0100
|
||||||
|
Subject: [PATCH] Generate preludes using miniruby.
|
||||||
|
|
||||||
|
---
|
||||||
|
common.mk | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/common.mk b/common.mk
|
||||||
|
index 168dc52..20c218a 100644
|
||||||
|
--- a/common.mk
|
||||||
|
+++ b/common.mk
|
||||||
|
@@ -1053,9 +1053,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE)
|
||||||
|
$(srcdir)/template/prelude.c.tmpl
|
||||||
|
|
||||||
|
$(PRELUDE_C): $(COMPILE_PRELUDE) \
|
||||||
|
- $(PRELUDE_SCRIPTS)
|
||||||
|
+ $(PRELUDE_SCRIPTS) $(PREP)
|
||||||
|
$(ECHO) generating $@
|
||||||
|
- $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
|
||||||
|
+ $(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
|
||||||
|
$(srcdir)/template/prelude.c.tmpl $(PRELUDE_SCRIPTS)
|
||||||
|
|
||||||
|
$(GOLF_PRELUDE_C): $(COMPILE_PRELUDE) {$(srcdir)}golf_prelude.rb
|
||||||
|
--
|
||||||
|
2.6.3
|
||||||
|
|
@ -0,0 +1,296 @@
|
|||||||
|
From 4fc1be3af3f58621bb751c9e63c208b15c0e8d16 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Tue, 31 Mar 2015 16:21:04 +0200
|
||||||
|
Subject: [PATCH 1/4] Use ruby_version_dir_name for versioned directories.
|
||||||
|
|
||||||
|
This disallows changing the ruby_version constant by --with-ruby-version
|
||||||
|
configuration options. The two places version numbers are disallowed as
|
||||||
|
well, since there are a lot of places which cannot handle this format
|
||||||
|
properly.
|
||||||
|
|
||||||
|
ruby_version_dir_name now specifies custom version string for versioned
|
||||||
|
directories, e.g. instead of default X.Y.Z, you can specify whatever
|
||||||
|
string.
|
||||||
|
---
|
||||||
|
configure.ac | 64 ++++++++++++++++++++++++---------------------
|
||||||
|
template/ruby.pc.in | 1 +
|
||||||
|
2 files changed, 35 insertions(+), 30 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 8ea969412f..a00f2b6776 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -3678,9 +3678,6 @@ AS_CASE(["$target_os"],
|
||||||
|
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
|
||||||
|
])
|
||||||
|
|
||||||
|
-rubylibdir='${rubylibprefix}/${ruby_version}'
|
||||||
|
-rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
|
||||||
|
-
|
||||||
|
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
|
||||||
|
AC_ARG_WITH(rubyarchprefix,
|
||||||
|
AS_HELP_STRING([--with-rubyarchprefix=DIR],
|
||||||
|
@@ -3703,56 +3703,62 @@ AC_ARG_WITH(ridir,
|
||||||
|
AC_SUBST(ridir)
|
||||||
|
AC_SUBST(RI_BASE_NAME)
|
||||||
|
|
||||||
|
-AC_ARG_WITH(ruby-version,
|
||||||
|
- AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|minor|STR)]),
|
||||||
|
- [ruby_version=$withval],
|
||||||
|
- [ruby_version=full])
|
||||||
|
unset RUBY_LIB_VERSION
|
||||||
|
-unset RUBY_LIB_VERSION_STYLE
|
||||||
|
-AS_CASE(["$ruby_version"],
|
||||||
|
- [full], [RUBY_LIB_VERSION_STYLE='3 /* full */'],
|
||||||
|
- [minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */'])
|
||||||
|
-AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
|
||||||
|
- {
|
||||||
|
- echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
|
||||||
|
- echo '#define STRINGIZE(x) x'
|
||||||
|
- test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
|
||||||
|
- echo '#include "version.h"'
|
||||||
|
- echo 'ruby_version=RUBY_LIB_VERSION'
|
||||||
|
- } > conftest.c
|
||||||
|
- ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
|
||||||
|
- eval $ruby_version
|
||||||
|
-], [test -z "${ruby_version}"], [
|
||||||
|
- AC_MSG_ERROR([No ruby version, No place for bundled libraries])
|
||||||
|
-], [
|
||||||
|
- RUBY_LIB_VERSION="${ruby_version}"
|
||||||
|
-])
|
||||||
|
+RUBY_LIB_VERSION_STYLE='3 /* full */'
|
||||||
|
+{
|
||||||
|
+echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
|
||||||
|
+echo '#define STRINGIZE(x) x'
|
||||||
|
+test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
|
||||||
|
+echo '#include "version.h"'
|
||||||
|
+echo 'ruby_version=RUBY_LIB_VERSION'
|
||||||
|
+} > conftest.c
|
||||||
|
+ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
|
||||||
|
+eval $ruby_version
|
||||||
|
+
|
||||||
|
+RUBY_LIB_VERSION="${ruby_version}"
|
||||||
|
+
|
||||||
|
AC_SUBST(RUBY_LIB_VERSION_STYLE)
|
||||||
|
AC_SUBST(RUBY_LIB_VERSION)
|
||||||
|
|
||||||
|
+AC_ARG_WITH(ruby-version,
|
||||||
|
+ AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|STR)]),
|
||||||
|
+ [ruby_version_dir_name=$withval],
|
||||||
|
+ [ruby_version_dir_name=full])
|
||||||
|
+AS_CASE(["$ruby_version_dir_name"],
|
||||||
|
+ [full], [ruby_version_dir_name='${ruby_version}'])
|
||||||
|
+
|
||||||
|
+ruby_version_dir=/'${ruby_version_dir_name}'
|
||||||
|
+
|
||||||
|
+if test -z "${ruby_version_dir_name}"; then
|
||||||
|
+ AC_MSG_ERROR([No ruby version, No place for bundled libraries])
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+rubylibdir='${rubylibprefix}'${ruby_version_dir}
|
||||||
|
+rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_dir}}${multiarch-'${rubylibdir}/${arch}'}
|
||||||
|
+
|
||||||
|
AC_ARG_WITH(sitedir,
|
||||||
|
AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
|
||||||
|
[sitedir=$withval],
|
||||||
|
[sitedir='${rubylibprefix}/site_ruby'])
|
||||||
|
-sitelibdir='${sitedir}/${ruby_version}'
|
||||||
|
+sitelibdir='${sitedir}'${ruby_version_dir}
|
||||||
|
|
||||||
|
AC_ARG_WITH(sitearchdir,
|
||||||
|
AS_HELP_STRING([--with-sitearchdir=DIR],
|
||||||
|
[architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
|
||||||
|
[sitearchdir=$withval],
|
||||||
|
- [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
|
||||||
|
+ [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_dir}}${multiarch-'${sitelibdir}/${sitearch}'}])
|
||||||
|
|
||||||
|
AC_ARG_WITH(vendordir,
|
||||||
|
AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
|
||||||
|
[vendordir=$withval],
|
||||||
|
[vendordir='${rubylibprefix}/vendor_ruby'])
|
||||||
|
-vendorlibdir='${vendordir}/${ruby_version}'
|
||||||
|
+vendorlibdir='${vendordir}'${ruby_version_dir}
|
||||||
|
|
||||||
|
AC_ARG_WITH(vendorarchdir,
|
||||||
|
AS_HELP_STRING([--with-vendorarchdir=DIR],
|
||||||
|
[architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
|
||||||
|
[vendorarchdir=$withval],
|
||||||
|
- [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
|
||||||
|
+ [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
|
||||||
|
|
||||||
|
AS_IF([test "${LOAD_RELATIVE+set}"], [
|
||||||
|
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
|
||||||
|
@@ -3769,6 +3769,7 @@ AC_SUBST(sitearchincludedir)dnl
|
||||||
|
AC_SUBST(arch)dnl
|
||||||
|
AC_SUBST(sitearch)dnl
|
||||||
|
AC_SUBST(ruby_version)dnl
|
||||||
|
+AC_SUBST(ruby_version_dir_name)dnl
|
||||||
|
AC_SUBST(rubylibdir)dnl
|
||||||
|
AC_SUBST(rubyarchdir)dnl
|
||||||
|
AC_SUBST(sitedir)dnl
|
||||||
|
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
|
||||||
|
index 8a2c066..c81b211 100644
|
||||||
|
--- a/template/ruby.pc.in
|
||||||
|
+++ b/template/ruby.pc.in
|
||||||
|
@@ -9,6 +9,7 @@ MAJOR=@MAJOR@
|
||||||
|
MINOR=@MINOR@
|
||||||
|
TEENY=@TEENY@
|
||||||
|
ruby_version=@ruby_version@
|
||||||
|
+ruby_version_dir_name=@ruby_version_dir_name@
|
||||||
|
RUBY_API_VERSION=@RUBY_API_VERSION@
|
||||||
|
RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
|
||||||
|
RUBY_BASE_NAME=@RUBY_BASE_NAME@
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
|
|
||||||
|
From 518850aba6eee76de7715aae8d37330e34b01983 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Tue, 31 Mar 2015 16:37:26 +0200
|
||||||
|
Subject: [PATCH 2/4] Add ruby_version_dir_name support for RDoc.
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/rdoc/ri/paths.rb | 2 +-
|
||||||
|
tool/rbinstall.rb | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
|
||||||
|
index 970cb91..5bf8230 100644
|
||||||
|
--- a/lib/rdoc/ri/paths.rb
|
||||||
|
+++ b/lib/rdoc/ri/paths.rb
|
||||||
|
@@ -10,7 +10,7 @@ module RDoc::RI::Paths
|
||||||
|
#:stopdoc:
|
||||||
|
require 'rbconfig'
|
||||||
|
|
||||||
|
- version = RbConfig::CONFIG['ruby_version']
|
||||||
|
+ version = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
|
||||||
|
BASE = if RbConfig::CONFIG.key? 'ridir' then
|
||||||
|
File.join RbConfig::CONFIG['ridir'], version
|
||||||
|
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
|
||||||
|
index d4c110e..d39c9a6 100755
|
||||||
|
--- a/tool/rbinstall.rb
|
||||||
|
+++ b/tool/rbinstall.rb
|
||||||
|
@@ -428,7 +428,7 @@ def CONFIG.[](name, mandatory = false)
|
||||||
|
|
||||||
|
install?(:doc, :rdoc) do
|
||||||
|
if $rdocdir
|
||||||
|
- ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
|
||||||
|
+ ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version_dir_name'] || CONFIG['ruby_version'], "system")
|
||||||
|
prepare "rdoc", ridatadir
|
||||||
|
install_recursive($rdocdir, ridatadir, :no_install => rdoc_noinst, :mode => $data_mode)
|
||||||
|
end
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
|
|
||||||
|
From f8d136f9a46d1fe87eba622ab9665935d05e981b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Tue, 31 Mar 2015 16:37:44 +0200
|
||||||
|
Subject: [PATCH 3/4] Add ruby_version_dir_name support for RubyGems.
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/rubygems/defaults.rb | 11 ++++++-----
|
||||||
|
test/rubygems/test_gem.rb | 5 +++--
|
||||||
|
2 files changed, 9 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
|
||||||
|
index 55ca080..75eea2b 100644
|
||||||
|
--- a/lib/rubygems/defaults.rb
|
||||||
|
+++ b/lib/rubygems/defaults.rb
|
||||||
|
@@ -32,20 +32,20 @@ def self.default_dir
|
||||||
|
[
|
||||||
|
File.dirname(RbConfig::CONFIG['sitedir']),
|
||||||
|
'Gems',
|
||||||
|
- RbConfig::CONFIG['ruby_version']
|
||||||
|
+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
]
|
||||||
|
elsif RbConfig::CONFIG['rubylibprefix']
|
||||||
|
[
|
||||||
|
RbConfig::CONFIG['rubylibprefix'],
|
||||||
|
'gems',
|
||||||
|
- RbConfig::CONFIG['ruby_version']
|
||||||
|
+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[
|
||||||
|
RbConfig::CONFIG['libdir'],
|
||||||
|
ruby_engine,
|
||||||
|
'gems',
|
||||||
|
- RbConfig::CONFIG['ruby_version']
|
||||||
|
+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -75,7 +75,8 @@ def self.default_rubygems_dirs
|
||||||
|
|
||||||
|
def self.user_dir
|
||||||
|
parts = [Gem.user_home, '.gem', ruby_engine]
|
||||||
|
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
|
||||||
|
+ ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
+ parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
|
||||||
|
File.join parts
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -172,7 +173,7 @@ def self.vendor_dir # :nodoc:
|
||||||
|
return nil unless RbConfig::CONFIG.key? 'vendordir'
|
||||||
|
|
||||||
|
File.join RbConfig::CONFIG['vendordir'], 'gems',
|
||||||
|
- RbConfig::CONFIG['ruby_version']
|
||||||
|
+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
|
||||||
|
index 0428bea..b6e090e 100644
|
||||||
|
--- a/test/rubygems/test_gem.rb
|
||||||
|
+++ b/test/rubygems/test_gem.rb
|
||||||
|
@@ -1288,7 +1288,8 @@ def test_self_use_paths
|
||||||
|
|
||||||
|
def test_self_user_dir
|
||||||
|
parts = [@userhome, '.gem', Gem.ruby_engine]
|
||||||
|
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
|
||||||
|
+ ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
+ parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
|
||||||
|
|
||||||
|
assert_equal File.join(parts), Gem.user_dir
|
||||||
|
end
|
||||||
|
@@ -1365,7 +1366,7 @@ def test_self_gzip
|
||||||
|
def test_self_vendor_dir
|
||||||
|
expected =
|
||||||
|
File.join RbConfig::CONFIG['vendordir'], 'gems',
|
||||||
|
- RbConfig::CONFIG['ruby_version']
|
||||||
|
+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
|
||||||
|
|
||||||
|
assert_equal expected, Gem.vendor_dir
|
||||||
|
end
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
|
|
||||||
|
From 88c38a030c22dbf9422ece847bdfbf87d6659313 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||||
|
Date: Wed, 1 Apr 2015 14:55:37 +0200
|
||||||
|
Subject: [PATCH 4/4] Let headers directories follow the configured version
|
||||||
|
name.
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index a00f2b6776..999e2d6d5d 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -101,7 +101,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
|
||||||
|
RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
|
||||||
|
AC_SUBST(RUBY_BASE_NAME)
|
||||||
|
AC_SUBST(RUBYW_BASE_NAME)
|
||||||
|
-AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
|
||||||
|
+AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version_dir_name}')
|
||||||
|
|
||||||
|
AC_CANONICAL_TARGET
|
||||||
|
test x"$target_alias" = x &&
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
@ -0,0 +1,182 @@
|
|||||||
|
From f46bac1f3e8634e24c747d06b28e11b874f1e488 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kazuki Yamaguchi <k@rhe.jp>
|
||||||
|
Date: Thu, 16 Aug 2018 19:40:48 +0900
|
||||||
|
Subject: [PATCH] config: support .include directive
|
||||||
|
|
||||||
|
OpenSSL 1.1.1 introduces a new '.include' directive. Update our config
|
||||||
|
parser to support that.
|
||||||
|
|
||||||
|
As mentioned in the referenced GitHub issue, we should use the OpenSSL
|
||||||
|
API instead of implementing the parsing logic ourselves, but it will
|
||||||
|
need backwards-incompatible changes which we can't backport to stable
|
||||||
|
versions. So continue to use the Ruby implementation for now.
|
||||||
|
|
||||||
|
Reference: https://github.com/ruby/openssl/issues/208
|
||||||
|
---
|
||||||
|
ext/openssl/lib/openssl/config.rb | 54 ++++++++++++++++++++-----------
|
||||||
|
test/openssl/test_config.rb | 54 +++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 90 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ext/openssl/lib/openssl/config.rb b/ext/openssl/lib/openssl/config.rb
|
||||||
|
index 88225451..ba3a54c8 100644
|
||||||
|
--- a/ext/openssl/lib/openssl/config.rb
|
||||||
|
+++ b/ext/openssl/lib/openssl/config.rb
|
||||||
|
@@ -77,29 +77,44 @@ def get_key_string(data, section, key) # :nodoc:
|
||||||
|
def parse_config_lines(io)
|
||||||
|
section = 'default'
|
||||||
|
data = {section => {}}
|
||||||
|
- while definition = get_definition(io)
|
||||||
|
+ io_stack = [io]
|
||||||
|
+ while definition = get_definition(io_stack)
|
||||||
|
definition = clear_comments(definition)
|
||||||
|
next if definition.empty?
|
||||||
|
- if definition[0] == ?[
|
||||||
|
+ case definition
|
||||||
|
+ when /\A\[/
|
||||||
|
if /\[([^\]]*)\]/ =~ definition
|
||||||
|
section = $1.strip
|
||||||
|
data[section] ||= {}
|
||||||
|
else
|
||||||
|
raise ConfigError, "missing close square bracket"
|
||||||
|
end
|
||||||
|
- else
|
||||||
|
- if /\A([^:\s]*)(?:::([^:\s]*))?\s*=(.*)\z/ =~ definition
|
||||||
|
- if $2
|
||||||
|
- section = $1
|
||||||
|
- key = $2
|
||||||
|
- else
|
||||||
|
- key = $1
|
||||||
|
+ when /\A\.include (\s*=\s*)?(.+)\z/
|
||||||
|
+ path = $2
|
||||||
|
+ if File.directory?(path)
|
||||||
|
+ files = Dir.glob(File.join(path, "*.{cnf,conf}"), File::FNM_EXTGLOB)
|
||||||
|
+ else
|
||||||
|
+ files = [path]
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ files.each do |filename|
|
||||||
|
+ begin
|
||||||
|
+ io_stack << StringIO.new(File.read(filename))
|
||||||
|
+ rescue
|
||||||
|
+ raise ConfigError, "could not include file '%s'" % filename
|
||||||
|
end
|
||||||
|
- value = unescape_value(data, section, $3)
|
||||||
|
- (data[section] ||= {})[key] = value.strip
|
||||||
|
+ end
|
||||||
|
+ when /\A([^:\s]*)(?:::([^:\s]*))?\s*=(.*)\z/
|
||||||
|
+ if $2
|
||||||
|
+ section = $1
|
||||||
|
+ key = $2
|
||||||
|
else
|
||||||
|
- raise ConfigError, "missing equal sign"
|
||||||
|
+ key = $1
|
||||||
|
end
|
||||||
|
+ value = unescape_value(data, section, $3)
|
||||||
|
+ (data[section] ||= {})[key] = value.strip
|
||||||
|
+ else
|
||||||
|
+ raise ConfigError, "missing equal sign"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
data
|
||||||
|
@@ -212,10 +227,10 @@ def clear_comments(line)
|
||||||
|
scanned.join
|
||||||
|
end
|
||||||
|
|
||||||
|
- def get_definition(io)
|
||||||
|
- if line = get_line(io)
|
||||||
|
+ def get_definition(io_stack)
|
||||||
|
+ if line = get_line(io_stack)
|
||||||
|
while /[^\\]\\\z/ =~ line
|
||||||
|
- if extra = get_line(io)
|
||||||
|
+ if extra = get_line(io_stack)
|
||||||
|
line += extra
|
||||||
|
else
|
||||||
|
break
|
||||||
|
@@ -225,9 +240,12 @@ def get_definition(io)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
- def get_line(io)
|
||||||
|
- if line = io.gets
|
||||||
|
- line.gsub(/[\r\n]*/, '')
|
||||||
|
+ def get_line(io_stack)
|
||||||
|
+ while io = io_stack.last
|
||||||
|
+ if line = io.gets
|
||||||
|
+ return line.gsub(/[\r\n]*/, '')
|
||||||
|
+ end
|
||||||
|
+ io_stack.pop
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
|
||||||
|
index 99dcc497..5653b5d0 100644
|
||||||
|
--- a/test/openssl/test_config.rb
|
||||||
|
+++ b/test/openssl/test_config.rb
|
||||||
|
@@ -120,6 +120,49 @@ def test_s_parse_format
|
||||||
|
assert_equal("error in line 7: missing close square bracket", excn.message)
|
||||||
|
end
|
||||||
|
|
||||||
|
+ def test_s_parse_include
|
||||||
|
+ in_tmpdir("ossl-config-include-test") do |dir|
|
||||||
|
+ Dir.mkdir("child")
|
||||||
|
+ File.write("child/a.conf", <<~__EOC__)
|
||||||
|
+ [default]
|
||||||
|
+ file-a = a.conf
|
||||||
|
+ [sec-a]
|
||||||
|
+ a = 123
|
||||||
|
+ __EOC__
|
||||||
|
+ File.write("child/b.cnf", <<~__EOC__)
|
||||||
|
+ [default]
|
||||||
|
+ file-b = b.cnf
|
||||||
|
+ [sec-b]
|
||||||
|
+ b = 123
|
||||||
|
+ __EOC__
|
||||||
|
+ File.write("include-child.conf", <<~__EOC__)
|
||||||
|
+ key_outside_section = value_a
|
||||||
|
+ .include child
|
||||||
|
+ __EOC__
|
||||||
|
+
|
||||||
|
+ include_file = <<~__EOC__
|
||||||
|
+ [default]
|
||||||
|
+ file-main = unnamed
|
||||||
|
+ [sec-main]
|
||||||
|
+ main = 123
|
||||||
|
+ .include = include-child.conf
|
||||||
|
+ __EOC__
|
||||||
|
+
|
||||||
|
+ # Include a file by relative path
|
||||||
|
+ c1 = OpenSSL::Config.parse(include_file)
|
||||||
|
+ assert_equal(["default", "sec-a", "sec-b", "sec-main"], c1.sections.sort)
|
||||||
|
+ assert_equal(["file-main", "file-a", "file-b"], c1["default"].keys)
|
||||||
|
+ assert_equal({"a" => "123"}, c1["sec-a"])
|
||||||
|
+ assert_equal({"b" => "123"}, c1["sec-b"])
|
||||||
|
+ assert_equal({"main" => "123", "key_outside_section" => "value_a"}, c1["sec-main"])
|
||||||
|
+
|
||||||
|
+ # Relative paths are from the working directory
|
||||||
|
+ assert_raise(OpenSSL::ConfigError) do
|
||||||
|
+ Dir.chdir("child") { OpenSSL::Config.parse(include_file) }
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
def test_s_load
|
||||||
|
# alias of new
|
||||||
|
c = OpenSSL::Config.load
|
||||||
|
@@ -299,6 +342,17 @@ def test_clone
|
||||||
|
@it['newsection'] = {'a' => 'b'}
|
||||||
|
assert_not_equal(@it.sections.sort, c.sections.sort)
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ private
|
||||||
|
+
|
||||||
|
+ def in_tmpdir(*args)
|
||||||
|
+ Dir.mktmpdir(*args) do |dir|
|
||||||
|
+ dir = File.realpath(dir)
|
||||||
|
+ Dir.chdir(dir) do
|
||||||
|
+ yield dir
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,58 @@
|
|||||||
|
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
|
||||||
|
index 1a80b2b..b997e23 100644
|
||||||
|
--- a/ext/fiddle/closure.c
|
||||||
|
+++ b/ext/fiddle/closure.c
|
||||||
|
@@ -13,22 +13,11 @@ typedef struct {
|
||||||
|
ffi_type **argv;
|
||||||
|
} fiddle_closure;
|
||||||
|
|
||||||
|
-#if defined(USE_FFI_CLOSURE_ALLOC)
|
||||||
|
-#elif !defined(HAVE_FFI_CLOSURE_ALLOC)
|
||||||
|
-# define USE_FFI_CLOSURE_ALLOC 0
|
||||||
|
-#else
|
||||||
|
-# define USE_FFI_CLOSURE_ALLOC 1
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
static void
|
||||||
|
dealloc(void * ptr)
|
||||||
|
{
|
||||||
|
fiddle_closure * cls = (fiddle_closure *)ptr;
|
||||||
|
-#if USE_FFI_CLOSURE_ALLOC
|
||||||
|
ffi_closure_free(cls->pcl);
|
||||||
|
-#else
|
||||||
|
- munmap(cls->pcl, sizeof(*cls->pcl));
|
||||||
|
-#endif
|
||||||
|
if (cls->argv) xfree(cls->argv);
|
||||||
|
xfree(cls);
|
||||||
|
}
|
||||||
|
@@ -202,12 +188,7 @@ allocate(VALUE klass)
|
||||||
|
VALUE i = TypedData_Make_Struct(klass, fiddle_closure,
|
||||||
|
&closure_data_type, closure);
|
||||||
|
|
||||||
|
-#if USE_FFI_CLOSURE_ALLOC
|
||||||
|
closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code);
|
||||||
|
-#else
|
||||||
|
- closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
|
||||||
|
- MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
@@ -254,17 +238,8 @@ initialize(int rbargc, VALUE argv[], VALUE self)
|
||||||
|
if (FFI_OK != result)
|
||||||
|
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
|
||||||
|
|
||||||
|
-#if USE_FFI_CLOSURE_ALLOC
|
||||||
|
result = ffi_prep_closure_loc(pcl, cif, callback,
|
||||||
|
(void *)self, cl->code);
|
||||||
|
-#else
|
||||||
|
- result = ffi_prep_closure(pcl, cif, callback, (void *)self);
|
||||||
|
- cl->code = (void *)pcl;
|
||||||
|
- i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC);
|
||||||
|
- if (i) {
|
||||||
|
- rb_sys_fail("mprotect");
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
if (FFI_OK != result)
|
||||||
|
rb_raise(rb_eRuntimeError, "error prepping closure %d", result);
|
@ -0,0 +1,107 @@
|
|||||||
|
From 745899dec8f28d50a37dc03a96bbea972caaef58 Mon Sep 17 00:00:00 2001
|
||||||
|
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
Date: Tue, 19 Feb 2019 22:41:56 +0900
|
||||||
|
Subject: [PATCH] Use ENV["BUNDLE_GEM"] instead of gem command provided by
|
||||||
|
system ruby.
|
||||||
|
|
||||||
|
It break the examples of bundler. Because some examples detect the
|
||||||
|
different version of system ruby than test target version like trunk.
|
||||||
|
---
|
||||||
|
lib/bundler/gem_helper.rb | 8 ++++++--
|
||||||
|
spec/bundler/commands/clean_spec.rb | 14 +++++++++-----
|
||||||
|
spec/bundler/support/rubygems_ext.rb | 7 ++-----
|
||||||
|
3 files changed, 17 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
|
||||||
|
index e7673cba88..c54259b5b6 100644
|
||||||
|
--- a/lib/bundler/gem_helper.rb
|
||||||
|
+++ b/lib/bundler/gem_helper.rb
|
||||||
|
@@ -74,7 +74,8 @@ def install
|
||||||
|
|
||||||
|
def build_gem
|
||||||
|
file_name = nil
|
||||||
|
- sh("gem build -V '#{spec_path}'") do
|
||||||
|
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ sh("#{gem} build -V #{spec_path}") do
|
||||||
|
file_name = File.basename(built_gem_path)
|
||||||
|
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
|
||||||
|
FileUtils.mv(built_gem_path, "pkg")
|
||||||
|
@@ -85,7 +86,10 @@ def build_gem
|
||||||
|
|
||||||
|
def install_gem(built_gem_path = nil, local = false)
|
||||||
|
built_gem_path ||= build_gem
|
||||||
|
- out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}")
|
||||||
|
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ cmd = "#{gem} install #{built_gem_path}"
|
||||||
|
+ cmd = "#{cmd} --local" if local
|
||||||
|
+ out, _ = sh_with_code(cmd)
|
||||||
|
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
|
||||||
|
Bundler.ui.confirm "#{name} (#{version}) installed."
|
||||||
|
end
|
||||||
|
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
|
||||||
|
index 37cbeeb4e7..74a5b86ec1 100644
|
||||||
|
--- a/spec/bundler/commands/clean_spec.rb
|
||||||
|
+++ b/spec/bundler/commands/clean_spec.rb
|
||||||
|
@@ -339,7 +339,8 @@ def should_not_have_gems(*gems)
|
||||||
|
gem "rack"
|
||||||
|
G
|
||||||
|
|
||||||
|
- sys_exec! "gem list"
|
||||||
|
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ sys_exec! "#{gem} list"
|
||||||
|
expect(out).to include("rack (1.0.0)").and include("thin (1.0)")
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -461,8 +462,9 @@ def should_not_have_gems(*gems)
|
||||||
|
end
|
||||||
|
bundle! :update, :all => bundle_update_requires_all?
|
||||||
|
|
||||||
|
- sys_exec! "gem list"
|
||||||
|
- expect(out).to include("foo (1.0.1, 1.0)")
|
||||||
|
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ sys_exec! "#{gem} list"
|
||||||
|
+ expect(out).to include("foo (1.0.1, 1.0)")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "cleans system gems when --force is used" do
|
||||||
|
@@ -485,7 +487,8 @@ def should_not_have_gems(*gems)
|
||||||
|
bundle "clean --force"
|
||||||
|
|
||||||
|
expect(out).to include("Removing foo (1.0)")
|
||||||
|
- sys_exec "gem list"
|
||||||
|
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ sys_exec "#{gem} list"
|
||||||
|
expect(out).not_to include("foo (1.0)")
|
||||||
|
expect(out).to include("rack (1.0.0)")
|
||||||
|
end
|
||||||
|
@@ -519,7 +522,8 @@ def should_not_have_gems(*gems)
|
||||||
|
expect(out).to include(system_gem_path.to_s)
|
||||||
|
expect(out).to include("grant write permissions")
|
||||||
|
|
||||||
|
- sys_exec "gem list"
|
||||||
|
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
|
||||||
|
+ sys_exec "#{gem} list"
|
||||||
|
expect(out).to include("foo (1.0)")
|
||||||
|
expect(out).to include("rack (1.0.0)")
|
||||||
|
end
|
||||||
|
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
|
||||||
|
index c18f7650fc..408d715ecf 100644
|
||||||
|
--- a/spec/bundler/support/rubygems_ext.rb
|
||||||
|
+++ b/spec/bundler/support/rubygems_ext.rb
|
||||||
|
@@ -59,11 +59,8 @@ def self.install_gems(gems)
|
||||||
|
no_reqs.map!(&:first)
|
||||||
|
reqs.map! {|name, req| "'#{name}:#{req}'" }
|
||||||
|
deps = reqs.concat(no_reqs).join(" ")
|
||||||
|
- cmd = if Gem::VERSION < "2.0.0"
|
||||||
|
- "gem install #{deps} --no-rdoc --no-ri --conservative"
|
||||||
|
- else
|
||||||
|
- "gem install #{deps} --no-document --conservative"
|
||||||
|
- end
|
||||||
|
+ gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "#{Gem.ruby} -S gem"
|
||||||
|
+ cmd = "#{gem} install #{deps} --no-document --conservative"
|
||||||
|
puts cmd
|
||||||
|
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
|
||||||
|
end
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,131 @@
|
|||||||
|
From 920b924e5652884064a9529ffbd80d458a46fbc6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||||
|
Date: Tue, 5 Feb 2019 09:58:50 +0000
|
||||||
|
Subject: [PATCH] Make sure to wait with IO.select before using
|
||||||
|
Socket#recvfrom_nonblock
|
||||||
|
|
||||||
|
* On all platforms, as this is the recommended code pattern.
|
||||||
|
|
||||||
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||||
|
---
|
||||||
|
spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||||
|
index c1239ae637e0..74fd286c42ad 100644
|
||||||
|
--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||||
|
+++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||||
|
@@ -36,12 +36,11 @@
|
||||||
|
describe 'with data available' do
|
||||||
|
before do
|
||||||
|
@client.write('hello')
|
||||||
|
-
|
||||||
|
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||||
|
end
|
||||||
|
|
||||||
|
platform_is_not :windows do
|
||||||
|
it 'returns an Array containing the data and an Addrinfo' do
|
||||||
|
+ IO.select([@server])
|
||||||
|
ret = @server.recvfrom_nonblock(1)
|
||||||
|
|
||||||
|
ret.should be_an_instance_of(Array)
|
||||||
|
@@ -54,8 +53,7 @@
|
||||||
|
5.times do
|
||||||
|
@client.write('hello')
|
||||||
|
|
||||||
|
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||||
|
-
|
||||||
|
+ IO.select([@server])
|
||||||
|
msg, _ = @server.recvfrom_nonblock(5)
|
||||||
|
|
||||||
|
msg.should == 'hello'
|
||||||
|
@@ -66,6 +64,7 @@
|
||||||
|
platform_is_not :windows do
|
||||||
|
describe 'the returned Array' do
|
||||||
|
before do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@array = @server.recvfrom_nonblock(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -80,6 +79,7 @@
|
||||||
|
|
||||||
|
describe 'the returned Addrinfo' do
|
||||||
|
before do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@addr = @server.recvfrom_nonblock(1)[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
From c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f Mon Sep 17 00:00:00 2001
|
||||||
|
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||||
|
Date: Tue, 5 Feb 2019 10:19:29 +0000
|
||||||
|
Subject: [PATCH] Make sure to wait with IO.select before using
|
||||||
|
Socket#accept_nonblock and recvfrom_nonblock
|
||||||
|
|
||||||
|
* On all platforms, as this is the recommended code pattern.
|
||||||
|
|
||||||
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||||
|
---
|
||||||
|
spec/ruby/library/socket/socket/accept_nonblock_spec.rb | 4 ++--
|
||||||
|
spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb | 5 +++--
|
||||||
|
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||||
|
index 3ef219ed05a9..cde9e6a4b669 100644
|
||||||
|
--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||||
|
+++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||||
|
@@ -86,8 +86,6 @@
|
||||||
|
@client = Socket.new(family, :STREAM, 0)
|
||||||
|
|
||||||
|
@client.connect(addr)
|
||||||
|
-
|
||||||
|
- platform_is(:darwin, :freebsd, :solaris) { IO.select([@server]) }
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
@@ -96,6 +94,7 @@
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns an Array containing a Socket and an Addrinfo' do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@socket, addrinfo = @server.accept_nonblock
|
||||||
|
|
||||||
|
@socket.should be_an_instance_of(Socket)
|
||||||
|
@@ -104,6 +103,7 @@
|
||||||
|
|
||||||
|
describe 'the returned Addrinfo' do
|
||||||
|
before do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@socket, @addr = @server.accept_nonblock
|
||||||
|
end
|
||||||
|
|
||||||
|
diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||||
|
index 015109a05200..62bbaf0dc93a 100644
|
||||||
|
--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||||
|
+++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||||
|
@@ -40,16 +40,16 @@
|
||||||
|
describe 'with data available' do
|
||||||
|
before do
|
||||||
|
@client.write('hello')
|
||||||
|
-
|
||||||
|
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns an Array containing the data and an Array' do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@server.recvfrom_nonblock(1).should be_an_instance_of(Array)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'the returned Array' do
|
||||||
|
before do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@array = @server.recvfrom_nonblock(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -64,6 +64,7 @@
|
||||||
|
|
||||||
|
describe 'the returned address Array' do
|
||||||
|
before do
|
||||||
|
+ IO.select([@server])
|
||||||
|
@addr = @server.recvfrom_nonblock(1)[1]
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 8cca079d3be8d07c261baea72529628469938245 Mon Sep 17 00:00:00 2001
|
||||||
|
From: hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||||
|
Date: Sat, 2 Feb 2019 10:41:22 +0000
|
||||||
|
Subject: [PATCH] Fixup r66984. Update the location of bundler gemspec.
|
||||||
|
|
||||||
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||||
|
---
|
||||||
|
spec/bundler/support/path.rb | 2 +-
|
||||||
|
tool/sync_default_gems.rb | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
|
||||||
|
index 38f7145dc72a..69efcba05175 100644
|
||||||
|
--- a/spec/bundler/support/path.rb
|
||||||
|
+++ b/spec/bundler/support/path.rb
|
||||||
|
@@ -9,7 +9,7 @@ def root
|
||||||
|
end
|
||||||
|
|
||||||
|
def gemspec
|
||||||
|
- @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec")
|
||||||
|
+ @gemspec ||= root.join(ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec")
|
||||||
|
end
|
||||||
|
|
||||||
|
def bindir
|
||||||
|
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
|
||||||
|
index bb4fcdd2cc12..26458147e5a3 100644
|
||||||
|
--- a/tool/sync_default_gems.rb
|
||||||
|
+++ b/tool/sync_default_gems.rb
|
||||||
|
@@ -89,7 +89,7 @@ def sync_default_gems(gem)
|
||||||
|
`rm -rf lib/bundler* libexec/bundler libexec/bundle libexec/bundle_ruby spec/bundler man/bundle* man/gemfile*`
|
||||||
|
`cp -r ../../bundler/bundler/lib/bundler* ./lib`
|
||||||
|
`cp -r ../../bundler/bundler/exe/bundle* ./libexec`
|
||||||
|
- `cp ../../bundler/bundler/bundler.gemspec ./lib`
|
||||||
|
+ `cp ../../bundler/bundler/bundler.gemspec ./lib/bundler`
|
||||||
|
`cp -r ../../bundler/bundler/spec spec/bundler`
|
||||||
|
`cp -r ../../bundler/bundler/man/*.{1,5,1\.txt,5\.txt,ronn} ./man`
|
||||||
|
`rm -rf spec/bundler/support/artifice/vcr_cassettes`
|
@ -0,0 +1,26 @@
|
|||||||
|
From 2becb920e431110c4afc4fa069b051c5940c2096 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Evans <code@jeremyevans.net>
|
||||||
|
Date: Fri, 29 May 2020 14:13:30 -0700
|
||||||
|
Subject: [PATCH] Convert ip addresses to canonical form in
|
||||||
|
Resolv::DNS::Requester::UnconnectedUDP#sender
|
||||||
|
|
||||||
|
Otherwise, if the IP address given is not in canonical form, it
|
||||||
|
won't match, and Resolv will ignore it.
|
||||||
|
|
||||||
|
Fixes [Bug #16439]
|
||||||
|
---
|
||||||
|
lib/resolv.rb | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/lib/resolv.rb b/lib/resolv.rb
|
||||||
|
index e7b45e785a85..d78531e174fd 100644
|
||||||
|
--- a/lib/resolv.rb
|
||||||
|
+++ b/lib/resolv.rb
|
||||||
|
@@ -762,6 +762,7 @@ def recv_reply(readable_socks)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sender(msg, data, host, port=Port)
|
||||||
|
+ host = Addrinfo.ip(host).ip_address
|
||||||
|
lazy_initialize
|
||||||
|
sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
|
||||||
|
return nil if !sock
|
@ -0,0 +1,25 @@
|
|||||||
|
From a267a40be7844224c5f000530bd3e8e906f1acea Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Evans <code@jeremyevans.net>
|
||||||
|
Date: Wed, 10 Mar 2021 13:48:00 -0800
|
||||||
|
Subject: [PATCH] Do not use a libdir for glibc, it breaks Linux PPC64 (#70)
|
||||||
|
|
||||||
|
Fixes [Bug #12666]
|
||||||
|
---
|
||||||
|
test/fiddle/helper.rb | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
|
||||||
|
index f38f903..a6e2019 100644
|
||||||
|
--- a/test/fiddle/helper.rb
|
||||||
|
+++ b/test/fiddle/helper.rb
|
||||||
|
@@ -20,8 +20,8 @@
|
||||||
|
# 64-bit ruby
|
||||||
|
libdir = '/lib64' if File.directory? '/lib64'
|
||||||
|
end
|
||||||
|
- libc_so = File.join(libdir, "libc.so.6")
|
||||||
|
- libm_so = File.join(libdir, "libm.so.6")
|
||||||
|
+ libc_so = "libc.so.6"
|
||||||
|
+ libm_so = "libm.so.6"
|
||||||
|
when /mingw/, /mswin/
|
||||||
|
require "rbconfig"
|
||||||
|
crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'
|
@ -0,0 +1,422 @@
|
|||||||
|
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
|
||||||
|
index 8e56d4a9bc..c37946b46c 100644
|
||||||
|
--- a/lib/bundler/definition.rb
|
||||||
|
+++ b/lib/bundler/definition.rb
|
||||||
|
@@ -910,6 +910,8 @@ def source_requirements
|
||||||
|
# Load all specs from remote sources
|
||||||
|
index
|
||||||
|
|
||||||
|
+ validate_dependency_confusion! unless disable_dependency_confusion_check?
|
||||||
|
+
|
||||||
|
# Record the specs available in each gem's source, so that those
|
||||||
|
# specs will be available later when the resolver knows where to
|
||||||
|
# look for that gemspec (or its dependencies)
|
||||||
|
@@ -989,5 +991,112 @@ def equivalent_rubygems_remotes?(source)
|
||||||
|
|
||||||
|
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ def validate_dependency_confusion!
|
||||||
|
+ # Continue if there is a scoped repository in the remote case.
|
||||||
|
+ return unless @remote && sources.non_global_rubygems_sources.size > 0
|
||||||
|
+
|
||||||
|
+ # Raise an error unless all the scope repositories implement the dependency API.
|
||||||
|
+ # When there is a non-dependency API scoped repository, we cannot get
|
||||||
|
+ # indirect dependencies used in a `Gemfile`.
|
||||||
|
+ unless sources.non_global_rubygems_sources.all?(&:dependency_api_available?)
|
||||||
|
+ non_api_sources = sources.non_global_rubygems_sources.reject(&:dependency_api_available?)
|
||||||
|
+ non_api_source_names_str = non_api_sources.map {|d| " * #{d}" }.join("\n")
|
||||||
|
+
|
||||||
|
+ msg = String.new
|
||||||
|
+ msg << "Your Gemfile contains scoped sources that don't implement a dependency API, namely:\n\n"
|
||||||
|
+ msg << non_api_source_names_str
|
||||||
|
+ msg << "\n\nUsing the above gem servers may result in installing unexpected gems. " \
|
||||||
|
+ "To resolve this warning, make sure you use gem servers that implement dependency APIs, " \
|
||||||
|
+ "such as gemstash or geminabox gem servers."
|
||||||
|
+ raise_error_or_warn_dependency_confusion(msg)
|
||||||
|
+ return
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ indirect_dep_names = indirect_dependency_names_in_non_global_rubygems_soruces
|
||||||
|
+ # Get all the gem names from the index made from the default source.
|
||||||
|
+ # default_source_dep_names = @index.sources.select(&:default_source_used?).map(&:spec_names).flatten
|
||||||
|
+ # Get all the gem names from each source.
|
||||||
|
+ all_spec_names_list = @index.sources.map(&:spec_names)
|
||||||
|
+
|
||||||
|
+ # Only include the indirect dependency gems on the scoped sources that
|
||||||
|
+ # also exist on another source. The gems are included in more than 2
|
||||||
|
+ # sources (the own source + another source). If the gems don't exist on
|
||||||
|
+ # the another source, the dependency confusion doesn't happen.
|
||||||
|
+ indirect_dep_names.select! do |name|
|
||||||
|
+ source_num = all_spec_names_list.select {|all_names| all_names.include?(name) }
|
||||||
|
+ source_num.size >= 2
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ # Raise an error if there is an indirect dependency.
|
||||||
|
+ if indirect_dep_names.size > 0
|
||||||
|
+ dep_names_str = indirect_dep_names.join(", ")
|
||||||
|
+ source_names_str = sources.non_global_rubygems_sources.map {|d| " * #{d}" }.join("\n")
|
||||||
|
+
|
||||||
|
+ msg = String.new
|
||||||
|
+ msg << "Your Gemfile contains implicit dependency gems #{dep_names_str} on the scoped sources, namely:\n\n"
|
||||||
|
+ msg << source_names_str
|
||||||
|
+ msg << "\n\nUsing implicit dependency gems on the above sources may result in installing unexpected gems. "
|
||||||
|
+ msg << "To suppress this message, make sure you set the gems explicitly in the Gemfile."
|
||||||
|
+ raise_error_or_warn_dependency_confusion(msg)
|
||||||
|
+ return
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def raise_error_or_warn_dependency_confusion(msg)
|
||||||
|
+ if warn_on_dependnecy_confusion?
|
||||||
|
+ Bundler.ui.warn msg
|
||||||
|
+ else
|
||||||
|
+ msg = "#{msg} Or set the environment variable BUNDLE_WARN_ON_DEPENDENCY_CONFUSION."
|
||||||
|
+ raise SecurityError, msg
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def indirect_dependency_names_in_non_global_rubygems_soruces
|
||||||
|
+ # Indirect dependency gem names
|
||||||
|
+ indirect_dep_names = []
|
||||||
|
+ # Direct dependency gem names
|
||||||
|
+ direct_dep_names = @dependencies.map(&:name)
|
||||||
|
+
|
||||||
|
+ sources.non_global_rubygems_sources.each do |s|
|
||||||
|
+ # If the non dependency API source is used, the `dependency_names`
|
||||||
|
+ # returns gems not only used in the `Gemfile`, but also returns ones
|
||||||
|
+ # existing in the scoped source too. This method shouldn't be used with
|
||||||
|
+ # the non dependency API sources.
|
||||||
|
+ s.specs.dependency_names.each do |dep_name|
|
||||||
|
+ # Exclude direct dependency gems.
|
||||||
|
+ next if direct_dep_names.include?(dep_name)
|
||||||
|
+
|
||||||
|
+ s.specs.local_search(dep_name).each do |spec|
|
||||||
|
+ # Debug gems with unexpected `spec.class`.
|
||||||
|
+ Bundler.ui.debug "Found dependency gem #{dep_name} (#{spec.class}) in scoped sources."
|
||||||
|
+ # StubSpecification extending RemoteSpecification: the gems by
|
||||||
|
+ # `gem list`. Exclude the gems.
|
||||||
|
+ # EndpointSpecification: gems returned by dependency API such as
|
||||||
|
+ # geminabox
|
||||||
|
+ # RemoteSpecification: gems returned by non dependency API such as
|
||||||
|
+ # gem server. This method cannot be executed with the non
|
||||||
|
+ # dependency API sources.
|
||||||
|
+ indirect_dep_names << dep_name if spec.class == EndpointSpecification
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ indirect_dep_names.sort.uniq
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ # Print a warning instead of raising an error when this option is enabled.
|
||||||
|
+ # Don't use Bundler.settings to minimize the difference to backport easily
|
||||||
|
+ # and avoid additional tests.
|
||||||
|
+ def warn_on_dependnecy_confusion?
|
||||||
|
+ @warn_on_dependnecy_confusion ||= ENV["BUNDLE_WARN_ON_DEPENDENCY_CONFUSION"]
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ # Disable the dependency confusion check when this option is enabled.
|
||||||
|
+ # The option can be used as a workaround if the check logic is problematic
|
||||||
|
+ # in a case such as a performance issue.
|
||||||
|
+ def disable_dependency_confusion_check?
|
||||||
|
+ @disable_dependnecy_confusion_check ||= ENV["BUNDLE_DISABLE_DEPENDENCY_CONFUSION_CHECK"]
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
|
||||||
|
index 485b388a32..48a2ab736b 100644
|
||||||
|
--- a/lib/bundler/source/rubygems.rb
|
||||||
|
+++ b/lib/bundler/source/rubygems.rb
|
||||||
|
@@ -289,6 +289,10 @@ def dependency_names_to_double_check
|
||||||
|
names
|
||||||
|
end
|
||||||
|
|
||||||
|
+ def dependency_api_available?
|
||||||
|
+ api_fetchers.any?
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
protected
|
||||||
|
|
||||||
|
def credless_remotes
|
||||||
|
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
|
||||||
|
index ac2adacb3d..37869878ce 100644
|
||||||
|
--- a/lib/bundler/source_list.rb
|
||||||
|
+++ b/lib/bundler/source_list.rb
|
||||||
|
@@ -64,6 +64,10 @@ def rubygems_sources
|
||||||
|
@rubygems_sources + [default_source]
|
||||||
|
end
|
||||||
|
|
||||||
|
+ def non_global_rubygems_sources
|
||||||
|
+ @rubygems_sources
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
def rubygems_remotes
|
||||||
|
rubygems_sources.map(&:remotes).flatten.uniq
|
||||||
|
end
|
||||||
|
diff --git a/spec/bundler/bundler/definition_dep_confusion_spec.rb b/spec/bundler/bundler/definition_dep_confusion_spec.rb
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..9fee464960
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/spec/bundler/bundler/definition_dep_confusion_spec.rb
|
||||||
|
@@ -0,0 +1,257 @@
|
||||||
|
+# frozen_string_literal: true
|
||||||
|
+
|
||||||
|
+require "bundler/definition"
|
||||||
|
+
|
||||||
|
+RSpec.describe Bundler::Definition do
|
||||||
|
+ before do
|
||||||
|
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile) { Pathname.new("Gemfile") }
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ let(:sources) { Bundler::SourceList.new }
|
||||||
|
+ subject { Bundler::Definition.new(nil, [], sources, []) }
|
||||||
|
+
|
||||||
|
+ describe "#validate_dependency_confusion!" do
|
||||||
|
+ before do
|
||||||
|
+ subject.instance_variable_set(:@remote, remote)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when it's not remote" do
|
||||||
|
+ let(:remote) { false }
|
||||||
|
+
|
||||||
|
+ it "should neither raise an error nor warn" do
|
||||||
|
+ expect(subject).not_to receive(:raise_error_or_warn_dependency_confusion)
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when it's remote" do
|
||||||
|
+ before do
|
||||||
|
+ allow(sources).to receive(:non_global_rubygems_sources).and_return(non_global_rubygems_sources)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ let(:remote) { true }
|
||||||
|
+
|
||||||
|
+ context "when the number of non-global source is zero" do
|
||||||
|
+ let(:non_global_rubygems_sources) { [] }
|
||||||
|
+
|
||||||
|
+ it "should neither raise an error nor warn" do
|
||||||
|
+ expect(subject).not_to receive(:raise_error_or_warn_dependency_confusion)
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when there are any non dependency API non global sources" do
|
||||||
|
+ let(:non_global_rubygems_sources) do
|
||||||
|
+ [
|
||||||
|
+ double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"),
|
||||||
|
+ double("non-global-source-1", :dependency_api_available? => false, :to_s => "b"),
|
||||||
|
+ double("non-global-source-2", :dependency_api_available? => false, :to_s => "c"),
|
||||||
|
+ ]
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ it "should raise an error or warn" do
|
||||||
|
+ expect(subject).to receive(:raise_error_or_warn_dependency_confusion).with(<<-M.strip)
|
||||||
|
+Your Gemfile contains scoped sources that don't implement a dependency API, namely:
|
||||||
|
+
|
||||||
|
+ * b
|
||||||
|
+ * c
|
||||||
|
+
|
||||||
|
+Using the above gem servers may result in installing unexpected gems. To resolve this warning, make sure you use gem servers that implement dependency APIs, such as gemstash or geminabox gem servers.
|
||||||
|
+ M
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when all the non global sources implement dependency API" do
|
||||||
|
+ before do
|
||||||
|
+ allow(subject).to receive(:indirect_dependency_names_in_non_global_rubygems_soruces).and_return(indirect_dependency_names)
|
||||||
|
+ subject.instance_variable_set(:@index, index)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ let(:non_global_rubygems_sources) do
|
||||||
|
+ [
|
||||||
|
+ double("non-global-source-0", :dependency_api_available? => true, :to_s => "a"),
|
||||||
|
+ double("non-global-source-1", :dependency_api_available? => true, :to_s => "b"),
|
||||||
|
+ ]
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ let(:index) { double("index", :sources => index_sources) }
|
||||||
|
+ let(:index_sources) do
|
||||||
|
+ [
|
||||||
|
+ double("index-source-1", :spec_names => ["a1", "a2"]),
|
||||||
|
+ double("index-source-2", :spec_names => ["a2", "b1", "b2"]),
|
||||||
|
+ double("index-source-3", :spec_names => ["b2"])
|
||||||
|
+ ]
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when there is not an indirect dependency in the non global sources" do
|
||||||
|
+ let(:indirect_dependency_names) {[]}
|
||||||
|
+
|
||||||
|
+ it "should neither raise an error nor warn" do
|
||||||
|
+ expect(subject).not_to receive(:raise_error_or_warn_dependency_confusion)
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when there is an indirect dependency in the non global sources" do
|
||||||
|
+
|
||||||
|
+ context "when the indirect dependency doesn't exist in another source" do
|
||||||
|
+ let(:indirect_dependency_names) {["a1", "b1"]}
|
||||||
|
+
|
||||||
|
+ it "should neither raise an error nor warn" do
|
||||||
|
+ expect(subject).not_to receive(:raise_error_or_warn_dependency_confusion)
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when the indirect dependency also exists in anotehr source" do
|
||||||
|
+ let(:indirect_dependency_names) {["a1", "a2", "b2"]}
|
||||||
|
+
|
||||||
|
+ it "should raise an error or warn" do
|
||||||
|
+ expect(subject).to receive(:raise_error_or_warn_dependency_confusion).with(<<-M.strip)
|
||||||
|
+Your Gemfile contains implicit dependency gems a2, b2 on the scoped sources, namely:
|
||||||
|
+
|
||||||
|
+ * a
|
||||||
|
+ * b
|
||||||
|
+
|
||||||
|
+Using implicit dependency gems on the above sources may result in installing unexpected gems. To suppress this message, make sure you set the gems explicitly in the Gemfile.
|
||||||
|
+ M
|
||||||
|
+ subject.send(:validate_dependency_confusion!)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ describe "#indirect_dependency_names_in_non_global_rubygems_soruces" do
|
||||||
|
+ before do
|
||||||
|
+ subject.instance_variable_set(:@dependencies, dependencies)
|
||||||
|
+ allow(sources).to receive(:non_global_rubygems_sources).and_return(non_global_rubygems_sources)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ # Direct dependencies
|
||||||
|
+ let(:dependencies) do
|
||||||
|
+ [
|
||||||
|
+ double("dependency-0", :name => "g0"),
|
||||||
|
+ double("dependency-1", :name => "g3")
|
||||||
|
+ ]
|
||||||
|
+ end
|
||||||
|
+ let(:non_global_rubygems_sources) do
|
||||||
|
+ [
|
||||||
|
+ double("non-global-source-0", :specs => index_0, :to_s => "s0"),
|
||||||
|
+ double("non-global-source-1", :specs => index_1, :to_s => "s1"),
|
||||||
|
+ ]
|
||||||
|
+ end
|
||||||
|
+ let(:index_0) do
|
||||||
|
+ # All the dependencies in the source-0.
|
||||||
|
+ index = double("index-0", :dependency_names => ["g0", "g1", "g2", "g5"])
|
||||||
|
+ allow(index).to receive(:local_search) do |query|
|
||||||
|
+ return_map = {
|
||||||
|
+ "g1" => [double("spec", :class => Bundler::StubSpecification, :to_s => "g1")],
|
||||||
|
+ "g2" => [double("spec", :class => Bundler::EndpointSpecification, :to_s => "g2")],
|
||||||
|
+ "g5" => [double("spec", :class => Bundler::EndpointSpecification, :to_s => "g5")]
|
||||||
|
+ }
|
||||||
|
+ return_map[query]
|
||||||
|
+ end
|
||||||
|
+ index
|
||||||
|
+ end
|
||||||
|
+ let(:index_1) do
|
||||||
|
+ # All the dependencies in the source-1.
|
||||||
|
+ index = double("index-1", :dependency_names => ["g3", "g4", "g5"])
|
||||||
|
+ allow(index).to receive(:local_search) do |query|
|
||||||
|
+ return_map = {
|
||||||
|
+ "g4" => [double("spec", :class => Bundler::EndpointSpecification, :to_s => "g4")],
|
||||||
|
+ "g5" => [double("spec", :class => Bundler::EndpointSpecification, :to_s => "g5")]
|
||||||
|
+ }
|
||||||
|
+ return_map[query]
|
||||||
|
+ end
|
||||||
|
+ index
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ it "should return only indirect dependencies of endpoint specification" do
|
||||||
|
+ expect(subject.send(:indirect_dependency_names_in_non_global_rubygems_soruces)).to eq(["g2", "g4", "g5"])
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ describe "#raise_error_or_warn_dependency_confusion" do
|
||||||
|
+ before do
|
||||||
|
+ allow(subject).to receive(:warn_on_dependnecy_confusion?).and_return(warn_on_dependnecy_confusion)
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when #warn_on_dependnecy_confusion? returns false" do
|
||||||
|
+ let(:warn_on_dependnecy_confusion) { false }
|
||||||
|
+
|
||||||
|
+ it "should raise an error" do
|
||||||
|
+ expect(Bundler.ui).not_to receive(:warn)
|
||||||
|
+ expect do
|
||||||
|
+ subject.send(:raise_error_or_warn_dependency_confusion, "This is a message.")
|
||||||
|
+ end.to raise_error(Bundler::SecurityError, "This is a message. " \
|
||||||
|
+ "Or set the environment variable BUNDLE_WARN_ON_DEPENDENCY_CONFUSION.")
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when #warn_on_dependnecy_confusion? returns true" do
|
||||||
|
+ let(:warn_on_dependnecy_confusion) { true }
|
||||||
|
+
|
||||||
|
+ it "should warn" do
|
||||||
|
+ expect(Bundler.ui).to receive(:warn).with(<<-W.strip)
|
||||||
|
+This is a message.
|
||||||
|
+W
|
||||||
|
+ subject.send(:raise_error_or_warn_dependency_confusion, "This is a message.")
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ describe "#warn_on_dependnecy_confusion?" do
|
||||||
|
+ context "when BUNDLE_WARN_ON_DEPENDENCY_CONFUSION is set" do
|
||||||
|
+ it "should return true" do
|
||||||
|
+ with_env({"BUNDLE_WARN_ON_DEPENDENCY_CONFUSION" => "1"}) do
|
||||||
|
+ expect(subject.send(:warn_on_dependnecy_confusion?)).to be_truthy
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when BUNDLE_WARN_ON_DEPENDENCY_CONFUSION is not set" do
|
||||||
|
+ it "should return false" do
|
||||||
|
+ with_env({"BUNDLE_WARN_ON_DEPENDENCY_CONFUSION" => nil}) do
|
||||||
|
+ expect(subject.send(:warn_on_dependnecy_confusion?)).to be_falsy
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ describe "#disable_dependency_confusion_check?" do
|
||||||
|
+ context "when BUNDLE_DISABLE_DEPENDENCY_CONFUSION_CHECK is set" do
|
||||||
|
+ it "should return true" do
|
||||||
|
+ with_env({"BUNDLE_DISABLE_DEPENDENCY_CONFUSION_CHECK" => "1"}) do
|
||||||
|
+ expect(subject.send(:disable_dependency_confusion_check?)).to be_truthy
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ context "when BUNDLE_DISABLE_DEPENDENCY_CONFUSION_CHECK is not set" do
|
||||||
|
+ it "should return false" do
|
||||||
|
+ with_env({"BUNDLE_DISABLE_DEPENDENCY_CONFUSION_CHECK" => nil}) do
|
||||||
|
+ expect(subject.send(:disable_dependency_confusion_check?)).to be_falsy
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def with_env(env={})
|
||||||
|
+ begin
|
||||||
|
+ tmp_env = {}
|
||||||
|
+ env.each do |key, value|
|
||||||
|
+ tmp_env[key] = ENV.delete key
|
||||||
|
+ ENV[key] = value
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ yield
|
||||||
|
+ ensure
|
||||||
|
+ tmp_env.each do |key, value|
|
||||||
|
+ ENV[key] = value
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+end
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
/* Example tapset file.
|
||||||
|
*
|
||||||
|
* You can execute the tapset using following command (please adjust the path
|
||||||
|
* prior running the command, if needed):
|
||||||
|
*
|
||||||
|
* stap /usr/share/doc/ruby-2.0.0.0/ruby-exercise.stp -c "ruby -e \"puts 'test'\""
|
||||||
|
*/
|
||||||
|
|
||||||
|
probe ruby.cmethod.entry {
|
||||||
|
printf("%d -> %s::%s %s:%d\n", tid(), classname, methodname, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
probe ruby.cmethod.return {
|
||||||
|
printf("%d <- %s::%s %s:%d\n", tid(), classname, methodname, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
probe ruby.method.entry {
|
||||||
|
printf("%d -> %s::%s %s:%d\n", tid(), classname, methodname, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
probe ruby.method.return {
|
||||||
|
printf("%d <- %s::%s %s:%d\n", tid(), classname, methodname, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
probe ruby.gc.mark.begin { printf("%d gc.mark.begin\n", tid()); }
|
||||||
|
|
||||||
|
probe ruby.gc.mark.end { printf("%d gc.mark.end\n", tid()); }
|
||||||
|
|
||||||
|
probe ruby.gc.sweep.begin { printf("%d gc.sweep.begin\n", tid()); }
|
||||||
|
|
||||||
|
probe ruby.gc.sweep.end { printf("%d gc.sweep.end\n", tid()); }
|
||||||
|
|
||||||
|
probe ruby.object.create{
|
||||||
|
printf("%d obj.create %s %s:%d\n", tid(), classname, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
probe ruby.raise {
|
||||||
|
printf("%d raise %s %s:%d\n", tid(), classname, file, line);
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
From 65cfebb041c454c246aaf32a177b0243915a9998 Mon Sep 17 00:00:00 2001
|
||||||
|
From: fatkodima <fatkodima123@gmail.com>
|
||||||
|
Date: Fri, 1 Nov 2019 23:06:10 +0200
|
||||||
|
Subject: [PATCH] Don't use insecure temporary directory as home directory
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/bundler.rb | 29 +++++++++++---------------
|
||||||
|
spec/bundler/bundler_spec.rb | 38 +++++++++--------------------------
|
||||||
|
spec/bundler/settings_spec.rb | 2 +-
|
||||||
|
3 files changed, 22 insertions(+), 47 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/bundler.rb b/lib/bundler.rb
|
||||||
|
index 2ada6fe7891..b184f7e69c6 100644
|
||||||
|
--- a/lib/bundler.rb
|
||||||
|
+++ b/lib/bundler.rb
|
||||||
|
@@ -170,8 +170,7 @@ def user_home
|
||||||
|
end
|
||||||
|
|
||||||
|
if warning
|
||||||
|
- Kernel.send(:require, "etc")
|
||||||
|
- user_home = tmp_home_path(Etc.getlogin, warning)
|
||||||
|
+ user_home = tmp_home_path(warning)
|
||||||
|
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
|
||||||
|
user_home
|
||||||
|
else
|
||||||
|
@@ -180,21 +180,6 @@ def user_home
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
- def tmp_home_path(login, warning)
|
||||||
|
- login ||= "unknown"
|
||||||
|
- Kernel.send(:require, "tmpdir")
|
||||||
|
- path = Pathname.new(Dir.tmpdir).join("bundler", "home")
|
||||||
|
- SharedHelpers.filesystem_access(path) do |tmp_home_path|
|
||||||
|
- unless tmp_home_path.exist?
|
||||||
|
- tmp_home_path.mkpath
|
||||||
|
- tmp_home_path.chmod(0o777)
|
||||||
|
- end
|
||||||
|
- tmp_home_path.join(login).tap(&:mkpath)
|
||||||
|
- end
|
||||||
|
- rescue RuntimeError => e
|
||||||
|
- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
|
||||||
|
- end
|
||||||
|
-
|
||||||
|
def user_bundle_path(dir = "home")
|
||||||
|
env_var, fallback = case dir
|
||||||
|
when "home"
|
||||||
|
@@ -555,6 +555,17 @@ def configure_gem_home
|
||||||
|
Bundler.rubygems.clear_paths
|
||||||
|
end
|
||||||
|
|
||||||
|
+ def tmp_home_path(warning)
|
||||||
|
+ Kernel.send(:require, "tmpdir")
|
||||||
|
+ SharedHelpers.filesystem_access(Dir.tmpdir) do
|
||||||
|
+ path = Bundler.tmp
|
||||||
|
+ at_exit { Bundler.rm_rf(path) }
|
||||||
|
+ path
|
||||||
|
+ end
|
||||||
|
+ rescue RuntimeError => e
|
||||||
|
+ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
# @param env [Hash]
|
||||||
|
def with_env(env)
|
||||||
|
backup = ENV.to_hash
|
||||||
|
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
|
||||||
|
index 74cf7ae05d3..247838600bf 100644
|
||||||
|
--- a/spec/bundler/bundler/bundler_spec.rb
|
||||||
|
+++ b/spec/bundler/bundler/bundler_spec.rb
|
||||||
|
@@ -233,16 +233,13 @@
|
||||||
|
path = "/home/oggy"
|
||||||
|
allow(Bundler.rubygems).to receive(:user_home).and_return(path)
|
||||||
|
allow(File).to receive(:directory?).with(path).and_return false
|
||||||
|
- allow(Etc).to receive(:getlogin).and_return("USER")
|
||||||
|
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
|
||||||
|
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
|
||||||
|
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
|
||||||
|
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
|
||||||
|
message = <<EOF
|
||||||
|
`/home/oggy` is not a directory.
|
||||||
|
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
|
||||||
|
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
|
||||||
|
EOF
|
||||||
|
expect(Bundler.ui).to receive(:warn).with(message)
|
||||||
|
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
|
||||||
|
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -255,16 +252,13 @@
|
||||||
|
allow(File).to receive(:directory?).with(path).and_return true
|
||||||
|
allow(File).to receive(:writable?).with(path).and_return false
|
||||||
|
allow(File).to receive(:directory?).with(dotbundle).and_return false
|
||||||
|
- allow(Etc).to receive(:getlogin).and_return("USER")
|
||||||
|
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
|
||||||
|
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
|
||||||
|
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
|
||||||
|
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
|
||||||
|
message = <<EOF
|
||||||
|
`/home/oggy` is not writable.
|
||||||
|
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
|
||||||
|
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
|
||||||
|
EOF
|
||||||
|
expect(Bundler.ui).to receive(:warn).with(message)
|
||||||
|
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
|
||||||
|
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
|
||||||
|
end
|
||||||
|
|
||||||
|
context ".bundle exists and have correct permissions" do
|
||||||
|
@@ -283,31 +277,17 @@
|
||||||
|
context "home directory is not set" do
|
||||||
|
it "should issue warning and return a temporary user home" do
|
||||||
|
allow(Bundler.rubygems).to receive(:user_home).and_return(nil)
|
||||||
|
- allow(Etc).to receive(:getlogin).and_return("USER")
|
||||||
|
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
|
||||||
|
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
|
||||||
|
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
|
||||||
|
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
|
||||||
|
message = <<EOF
|
||||||
|
Your home directory is not set.
|
||||||
|
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
|
||||||
|
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
|
||||||
|
EOF
|
||||||
|
expect(Bundler.ui).to receive(:warn).with(message)
|
||||||
|
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
|
||||||
|
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
- describe "#tmp_home_path" do
|
||||||
|
- it "should create temporary user home" do
|
||||||
|
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
|
||||||
|
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(false)
|
||||||
|
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home")
|
||||||
|
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home/USER")
|
||||||
|
- expect(File).to receive(:chmod).with(0o777, "/TMP/bundler/home")
|
||||||
|
- expect(Bundler.tmp_home_path("USER", "")).to eq(Pathname("/TMP/bundler/home/USER"))
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
-
|
||||||
|
describe "#requires_sudo?" do
|
||||||
|
let!(:tmpdir) { Dir.mktmpdir }
|
||||||
|
let(:bundle_path) { Pathname("#{tmpdir}/bundle") }
|
||||||
|
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
|
||||||
|
index 7e1dadded76..2a285fdcf37 100644
|
||||||
|
--- a/spec/bundler/bundler/settings_spec.rb
|
||||||
|
+++ b/spec/bundler/bundler/settings_spec.rb
|
||||||
|
@@ -67,7 +67,7 @@
|
||||||
|
context "when $TMPDIR is not writable" do
|
||||||
|
it "does not raise" do
|
||||||
|
expect(Bundler.rubygems).to receive(:user_home).twice.and_return(nil)
|
||||||
|
- expect(FileUtils).to receive(:mkpath).twice.with(File.join(Dir.tmpdir, "bundler", "home")).and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
|
||||||
|
+ expect(Bundler).to receive(:tmp).twice.and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
|
||||||
|
|
||||||
|
expect(subject.send(:global_config_file)).to be_nil
|
||||||
|
end
|
@ -0,0 +1,24 @@
|
|||||||
|
From c16675582a68800ef17b6056110e0a8bcdb38b55 Mon Sep 17 00:00:00 2001
|
||||||
|
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
Date: Tue, 22 Jan 2019 09:37:23 +0900
|
||||||
|
Subject: [PATCH] Avoid rdoc hook when it's failed to load rdoc library.
|
||||||
|
|
||||||
|
Fixed #2483
|
||||||
|
---
|
||||||
|
lib/rubygems/rdoc.rb | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
|
||||||
|
index dfaf7c55bf..4e16fbb86f 100644
|
||||||
|
--- a/lib/rubygems/rdoc.rb
|
||||||
|
+++ b/lib/rubygems/rdoc.rb
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
module Gem
|
||||||
|
RDoc = ::RDoc::RubygemsHook
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
-
|
||||||
|
-Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
@ -0,0 +1,88 @@
|
|||||||
|
From f4061357d812e9033f07ae3f8f44c4e26839f1e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: bronzdoc <lsagastume1990@gmail.com>
|
||||||
|
Date: Mon, 14 Jan 2019 09:46:29 -0600
|
||||||
|
Subject: [PATCH] Restore gem build behavior and introdcue the "-C" flag to gem
|
||||||
|
build
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/rubygems/commands/build_command.rb | 41 +++++++++++++------
|
||||||
|
.../test_gem_commands_build_command.rb | 1 +
|
||||||
|
2 files changed, 29 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
|
||||||
|
index e59471e976..761b80ee94 100644
|
||||||
|
--- a/lib/rubygems/commands/build_command.rb
|
||||||
|
+++ b/lib/rubygems/commands/build_command.rb
|
||||||
|
@@ -18,6 +18,10 @@ def initialize
|
||||||
|
add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
|
||||||
|
options[:output] = value
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ add_option '-C PATH', '', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
|
||||||
|
+ options[:build_path] = value
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
|
||||||
|
def arguments # :nodoc:
|
||||||
|
@@ -60,25 +64,36 @@ def execute
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.exist? gemspec
|
||||||
|
- Dir.chdir(File.dirname(gemspec)) do
|
||||||
|
- spec = Gem::Specification.load File.basename(gemspec)
|
||||||
|
-
|
||||||
|
- if spec
|
||||||
|
- Gem::Package.build(
|
||||||
|
- spec,
|
||||||
|
- options[:force],
|
||||||
|
- options[:strict],
|
||||||
|
- options[:output]
|
||||||
|
- )
|
||||||
|
- else
|
||||||
|
- alert_error "Error loading gemspec. Aborting."
|
||||||
|
- terminate_interaction 1
|
||||||
|
+ spec = Gem::Specification.load(gemspec)
|
||||||
|
+
|
||||||
|
+ if options[:build_path]
|
||||||
|
+ Dir.chdir(File.dirname(gemspec)) do
|
||||||
|
+ spec = Gem::Specification.load File.basename(gemspec)
|
||||||
|
+ build_package(spec)
|
||||||
|
end
|
||||||
|
+ else
|
||||||
|
+ build_package(spec)
|
||||||
|
end
|
||||||
|
+
|
||||||
|
else
|
||||||
|
alert_error "Gemspec file not found: #{gemspec}"
|
||||||
|
terminate_interaction 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
+ private
|
||||||
|
+
|
||||||
|
+ def build_package(spec)
|
||||||
|
+ if spec
|
||||||
|
+ Gem::Package.build(
|
||||||
|
+ spec,
|
||||||
|
+ options[:force],
|
||||||
|
+ options[:strict],
|
||||||
|
+ options[:output]
|
||||||
|
+ )
|
||||||
|
+ else
|
||||||
|
+ alert_error "Error loading gemspec. Aborting."
|
||||||
|
+ terminate_interaction 1
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
|
||||||
|
index ac82a408c7..02d1b98e8f 100644
|
||||||
|
--- a/test/rubygems/test_gem_commands_build_command.rb
|
||||||
|
+++ b/test/rubygems/test_gem_commands_build_command.rb
|
||||||
|
@@ -207,6 +207,7 @@ def test_execute_outside_dir
|
||||||
|
gs.write @gem.to_ruby
|
||||||
|
end
|
||||||
|
|
||||||
|
+ @cmd.options[:build_path] = gemspec_dir
|
||||||
|
@cmd.options[:args] = [gemspec_file]
|
||||||
|
|
||||||
|
use_ui @ui do
|
@ -0,0 +1,6 @@
|
|||||||
|
%__rubygems_requires %{_rpmconfigdir}/rubygems.req
|
||||||
|
%__rubygems_provides %{_rpmconfigdir}/rubygems.prov
|
||||||
|
%__rubygems_conflicts %{_rpmconfigdir}/rubygems.con
|
||||||
|
# In non-gem packages, the %%{gem_name} macro is not available and the macro
|
||||||
|
# stays unexpanded which leads to "invalid regex" error (rhbz#1154067).
|
||||||
|
%__rubygems_path ^%{?gem_name:%{gem_spec}}%{!?gem_name:this_should_never_match_anything}$
|
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
require 'rubygems/package'
|
||||||
|
|
||||||
|
module RubyGemsReq
|
||||||
|
module Helpers
|
||||||
|
# Keep only '!=' requirements.
|
||||||
|
def self.conflicts(requirements)
|
||||||
|
conflicts = requirements.select {|r| r.first == '!='}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts Gem::Requirement into array of requirements strings compatible
|
||||||
|
# with RPM .spec file.
|
||||||
|
def self.requirement_versions_to_rpm(requirement)
|
||||||
|
self.conflicts(requirement.requirements).map do |op, version|
|
||||||
|
version == Gem::Version.new(0) ? "" : "= #{version}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Report conflicting gem dependencies including their version.
|
||||||
|
def self.gem_depenencies(specification)
|
||||||
|
specification.runtime_dependencies.each do |dependency|
|
||||||
|
conflict_strings = Helpers::requirement_versions_to_rpm(dependency.requirement).map do |requirement|
|
||||||
|
requirement_string = "rubygem(#{dependency.name}) #{requirement}"
|
||||||
|
end
|
||||||
|
if conflict_strings.length > 0
|
||||||
|
conflict_string = conflict_strings.join(' with ')
|
||||||
|
conflict_string.prepend('(').concat(')') if conflict_strings.length > 1
|
||||||
|
puts conflict_string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reports all conflicts specified by all provided .gemspec files.
|
||||||
|
def self.conflicts
|
||||||
|
while filename = gets
|
||||||
|
filename.strip!
|
||||||
|
begin
|
||||||
|
specification = Gem::Specification.load filename
|
||||||
|
|
||||||
|
gem_depenencies(specification)
|
||||||
|
rescue => e
|
||||||
|
# Ignore all errors.
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if __FILE__ == $0
|
||||||
|
RubyGemsReq::conflicts
|
||||||
|
end
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
require 'rubygems/package'
|
||||||
|
|
||||||
|
module RubyGemsProv
|
||||||
|
module Helpers
|
||||||
|
# If there is some prelease version files, such as rc1 (i.e. non-numeric
|
||||||
|
# field), prepend this field by tilde instead of dot.
|
||||||
|
def self.normalize_prerelease(version)
|
||||||
|
if version.prerelease?
|
||||||
|
prerelease = version.version.sub /^#{version.release}\./, ''
|
||||||
|
"#{version.release}~#{prerelease}"
|
||||||
|
else
|
||||||
|
version.release
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reports all functionality gem provides.
|
||||||
|
def self.provides
|
||||||
|
while filename = gets
|
||||||
|
filename.strip!
|
||||||
|
begin
|
||||||
|
specification = Gem::Specification.load filename
|
||||||
|
|
||||||
|
puts "rubygem(#{specification.name}) = #{Helpers::normalize_prerelease(specification.version)}"
|
||||||
|
rescue => e
|
||||||
|
# Ignore all errors.
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if __FILE__ == $0
|
||||||
|
RubyGemsProv::provides
|
||||||
|
end
|
@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
require 'rubygems/package'
|
||||||
|
|
||||||
|
module RubyGemsReq
|
||||||
|
module Helpers
|
||||||
|
# Expands '~>' and '!=' gem requirements.
|
||||||
|
def self.expand_requirement(requirements)
|
||||||
|
requirements.inject([]) do |output, r|
|
||||||
|
output.concat case r.first
|
||||||
|
when '~>'
|
||||||
|
expand_pessimistic_requirement(r)
|
||||||
|
when '!='
|
||||||
|
# If there is only the conflict requirement, we still need to depend
|
||||||
|
# on the specified gem.
|
||||||
|
if requirements.size == 1
|
||||||
|
Gem::Requirement.default.requirements
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
[r]
|
||||||
|
end
|
||||||
|
end.reject {|r| r.empty? }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Expands the pessimistic version operator '~>' into equivalent '>=' and
|
||||||
|
# '<' pair.
|
||||||
|
def self.expand_pessimistic_requirement(requirement)
|
||||||
|
next_version = Gem::Version.create(requirement.last).bump
|
||||||
|
return ['>=', requirement.last], ['<', next_version]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts Gem::Requirement into array of requirements strings compatible
|
||||||
|
# with RPM .spec file.
|
||||||
|
def self.requirement_versions_to_rpm(requirement)
|
||||||
|
self.expand_requirement(requirement.requirements).map do |op, version|
|
||||||
|
version == Gem::Version.new(0) ? "" : " #{op} #{version}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Compose dependency together with its requirements in RPM rich dependency
|
||||||
|
# string.
|
||||||
|
def self.compose_dependency_string(name, requirements)
|
||||||
|
dependency_strings = requirements.map { |requirement| name + requirement }
|
||||||
|
dependency_string = dependency_strings.join(' with ')
|
||||||
|
dependency_string.prepend('(').concat(')') if dependency_strings.length > 1
|
||||||
|
dependency_string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Report RubyGems dependency, versioned if required.
|
||||||
|
def self.rubygems_dependency(specification)
|
||||||
|
dependency_name = "ruby(rubygems)"
|
||||||
|
requirements = Helpers::requirement_versions_to_rpm(specification.required_rubygems_version)
|
||||||
|
|
||||||
|
puts Helpers::compose_dependency_string(dependency_name, requirements)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Report all gem dependencies including their version.
|
||||||
|
def self.gem_depenencies(specification)
|
||||||
|
specification.runtime_dependencies.each do |dependency|
|
||||||
|
dependency_name = "rubygem(#{dependency.name})"
|
||||||
|
requirements = Helpers::requirement_versions_to_rpm(dependency.requirement)
|
||||||
|
|
||||||
|
puts Helpers::compose_dependency_string(dependency_name, requirements)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reports all requirements specified by all provided .gemspec files.
|
||||||
|
def self.requires
|
||||||
|
while filename = gets
|
||||||
|
filename.strip!
|
||||||
|
begin
|
||||||
|
specification = Gem::Specification.load filename
|
||||||
|
|
||||||
|
rubygems_dependency(specification)
|
||||||
|
gem_depenencies(specification)
|
||||||
|
rescue => e
|
||||||
|
# Ignore all errors.
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if __FILE__ == $0
|
||||||
|
RubyGemsReq::requires
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
if !!$LOADED_FEATURES.detect { |f| f =~ /abrt\.rb/ }
|
||||||
|
exit true
|
||||||
|
else
|
||||||
|
puts 'ERROR: ABRT hook was not loaded.'
|
||||||
|
|
||||||
|
exit false
|
||||||
|
end
|
@ -0,0 +1,65 @@
|
|||||||
|
require 'set'
|
||||||
|
|
||||||
|
LIBRUBY_SO = 'libruby.so'
|
||||||
|
PROBES_D = 'probes.d'
|
||||||
|
|
||||||
|
# These probes are excluded by VM_COLLECT_USAGE_DETAILS ifdef.
|
||||||
|
EXCLUDE_PROBES = Set.new %w(insn insn__operand)
|
||||||
|
|
||||||
|
## Detect SystemTap section headers presence
|
||||||
|
|
||||||
|
stap_headers = [
|
||||||
|
'\.stapsdt\.base',
|
||||||
|
'\.note\.stapsdt'
|
||||||
|
]
|
||||||
|
|
||||||
|
header_regexp = %r{ (#{stap_headers.join('|')}) }
|
||||||
|
|
||||||
|
section_headers = `readelf -S "#{LIBRUBY_SO}"`
|
||||||
|
detected_stap_headers = section_headers.scan(header_regexp).flatten
|
||||||
|
|
||||||
|
# Assume there are both headers until this is proven wrong ;)
|
||||||
|
unless detected_stap_headers.size == 2
|
||||||
|
puts 'ERROR: SystemTap (DTrace) headers were not detected in resulting library.'
|
||||||
|
exit false
|
||||||
|
end
|
||||||
|
|
||||||
|
## Find if every declared probe is propagated to resulting library
|
||||||
|
|
||||||
|
# Colect probes specified in probes.d file.
|
||||||
|
probes_declared = []
|
||||||
|
|
||||||
|
File.open(PROBES_D) do |file|
|
||||||
|
file.each_line do |line|
|
||||||
|
if probe = line[/probe (\S+)\(.*\);/, 1]
|
||||||
|
probes_declared << probe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
probes_declared = Set.new probes_declared
|
||||||
|
|
||||||
|
unless EXCLUDE_PROBES.subset? probes_declared
|
||||||
|
puts 'ERROR: Change in SystemTap (DTrace) probes definition file detected.'
|
||||||
|
exit false
|
||||||
|
end
|
||||||
|
|
||||||
|
probes_declared -= EXCLUDE_PROBES
|
||||||
|
|
||||||
|
# Detect probes in resulting library.
|
||||||
|
get_probes_detected = %r{
|
||||||
|
^\s*Provider:\s+ruby,\s+Name:\s+(\S+),\s+.*$
|
||||||
|
}
|
||||||
|
|
||||||
|
probes_detected = `eu-readelf -n "#{LIBRUBY_SO}"`
|
||||||
|
|
||||||
|
probes_detected = Set.new probes_detected.scan(get_probes_detected).flatten
|
||||||
|
|
||||||
|
# Both sets must be equal, otherwise something is wrong.
|
||||||
|
unless probes_declared == probes_detected
|
||||||
|
puts 'ERROR: SystemTap (DTrace) probes were not correctly propagated into resulting library.'
|
||||||
|
puts " Undetected probes: #{(probes_declared - probes_detected).sort.join(', ')}\n",
|
||||||
|
" Additional detected probes: #{(probes_detected - probes_declared).sort.join(', ')}"
|
||||||
|
|
||||||
|
exit false
|
||||||
|
end
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue