Make operating_system.rb more robust.
This avoids issues with incomplete rbconfig.rb such as: https://bugs.ruby-lang.org/issues/10822
This commit is contained in:
		
							parent
							
								
									76bbf0976d
								
							
						
					
					
						commit
						329ba54c7e
					
				| @ -6,6 +6,8 @@ module Gem | |||||||
|     # E.g. for '/usr/share/ruby', 'ruby', it returns '/usr' |     # E.g. for '/usr/share/ruby', 'ruby', it returns '/usr' | ||||||
| 
 | 
 | ||||||
|     def previous_but_one_dir_to(path, dir) |     def previous_but_one_dir_to(path, dir) | ||||||
|  |       return unless path | ||||||
|  | 
 | ||||||
|       split_path = path.split(File::SEPARATOR) |       split_path = path.split(File::SEPARATOR) | ||||||
|       File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2]) |       File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2]) | ||||||
|     end |     end | ||||||
| @ -44,13 +46,21 @@ module Gem | |||||||
|         RbConfig::CONFIG['libdir'] |         RbConfig::CONFIG['libdir'] | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       @default_dirs ||= Hash[default_locations.collect do |destination, path| |       @default_dirs ||= Hash.new do |hash, key| | ||||||
|         [destination, { |         hash[key] = if path = default_locations[key] | ||||||
|           :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'), |             :bin_dir => File.join(path, RbConfig::CONFIG['bindir'].split(File::SEPARATOR).last), | ||||||
|           :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems') |             :gem_dir => File.join(path, RbConfig::CONFIG['datadir'].split(File::SEPARATOR).last, 'gems'), | ||||||
|         }] |             :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems') | ||||||
|       end] |           } | ||||||
|  |         else | ||||||
|  |           { | ||||||
|  |             :bin_dir => '', | ||||||
|  |             :gem_dir => '', | ||||||
|  |             :ext_dir => '' | ||||||
|  |           } | ||||||
|  |         end | ||||||
|  |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ## |     ## | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ | |||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| %global release 4 | %global release 5 | ||||||
| %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} | %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} | ||||||
| 
 | 
 | ||||||
| %global rubygems_version 2.4.5 | %global rubygems_version 2.4.5 | ||||||
| @ -881,6 +881,9 @@ make check TESTS="-v $DISABLE_TESTS" | |||||||
| %{ruby_libdir}/tkextlib | %{ruby_libdir}/tkextlib | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Tue Feb 03 2015 Vít Ondruch <vondruch@redhat.com> - 2.2.0-5 | ||||||
|  | - Make operating_system.rb more robust. | ||||||
|  | 
 | ||||||
| * Thu Jan 29 2015 Vít Ondruch <vondruch@redhat.com> - 2.2.0-4 | * Thu Jan 29 2015 Vít Ondruch <vondruch@redhat.com> - 2.2.0-4 | ||||||
| - Add missing rubygem-test-unit dependency on rubygem-power_assert. | - Add missing rubygem-test-unit dependency on rubygem-power_assert. | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user