Fix support for dependent^2 SCLs

This commit is contained in:
Pavel Valena 2016-08-12 16:55:06 +02:00
parent be68dfb460
commit ddcdf2b199
3 changed files with 18 additions and 7 deletions

View File

@ -38,6 +38,14 @@ module Gem
end end
private :rpmbuild? private :rpmbuild?
##
# Get enabled SCLs in order of (most) dependent SCL to base SCL
def x_scls
@x_scls ||= ENV['X_SCLS'].split(' ').reverse!
end
private :x_scls
## ##
# Default gems locations allowed on FHS system (/usr, /usr/share). # Default gems locations allowed on FHS system (/usr, /usr/share).
# The locations are derived from directories specified during build # The locations are derived from directories specified during build
@ -54,7 +62,7 @@ module Gem
if ENV['GEM_PATH'] if ENV['GEM_PATH']
gem_paths = ENV['GEM_PATH'].split(':') gem_paths = ENV['GEM_PATH'].split(':')
ENV['X_SCLS'].split(' ').each do |scl| x_scls.each do |scl|
next if scl == '@SCL@' next if scl == '@SCL@'
regexp = /#{scl}\/root\/usr\/share\/gems/ regexp = /#{scl}\/root\/usr\/share\/gems/
@ -64,7 +72,7 @@ module Gem
@default_locations["#{scl}_system".to_sym] = "#{prefix}#{scl}/root/usr" @default_locations["#{scl}_system".to_sym] = "#{prefix}#{scl}/root/usr"
@default_locations["#{scl}_local".to_sym] = "#{prefix}#{scl}/root/usr/local" @default_locations["#{scl}_local".to_sym] = "#{prefix}#{scl}/root/usr/local"
end end
end if ENV['X_SCLS'] end
end end
@default_locations @default_locations
@ -117,7 +125,7 @@ module Gem
def default_dir def default_dir
if opt_build_root? if opt_build_root?
scl_prefix = ENV['X_SCLS'].split(' ').detect {|c| c != '@SCL@'} scl_prefix = x_scls.detect {|c| c != '@SCL@'}
scl_prefix = scl_prefix ? scl_prefix + '_': nil scl_prefix = scl_prefix ? scl_prefix + '_': nil
Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir] Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir]
@ -135,7 +143,7 @@ module Gem
def default_bindir def default_bindir
if opt_build_root? if opt_build_root?
scl_prefix = ENV['X_SCLS'].split(' ').detect {|c| c != '@SCL@'} scl_prefix = x_scls.detect {|c| c != '@SCL@'}
scl_prefix = scl_prefix ? scl_prefix + '_': nil scl_prefix = scl_prefix ? scl_prefix + '_': nil
Gem.default_dirs[:"#{scl_prefix}system"][:bin_dir] Gem.default_dirs[:"#{scl_prefix}system"][:bin_dir]
@ -148,7 +156,7 @@ module Gem
def default_ext_dir_for base_dir def default_ext_dir_for base_dir
dir = if rpmbuild? dir = if rpmbuild?
scl_prefix = ENV['X_SCLS'].split(' ').detect {|c| c != '@SCL@' && base_dir =~ /\/#{c}\//} scl_prefix = x_scls.detect {|c| c != '@SCL@' && base_dir =~ /\/#{c}\//}
scl_prefix = scl_prefix ? scl_prefix + '_': nil scl_prefix = scl_prefix ? scl_prefix + '_': nil
build_dir = base_dir.chomp Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir] build_dir = base_dir.chomp Gem.default_dirs[:"#{scl_prefix}system"][:gem_dir]

View File

@ -23,7 +23,7 @@
%global ruby_archive %{ruby_archive}-%{?milestone}%{?!milestone:%{?revision:r%{revision}}} %global ruby_archive %{ruby_archive}-%{?milestone}%{?!milestone:%{?revision:r%{revision}}}
%endif %endif
%global release 61 %global release 62
%{!?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}}
# The RubyGems library has to stay out of Ruby directory three, since the # The RubyGems library has to stay out of Ruby directory three, since the
@ -972,6 +972,9 @@ TZ=UTC make check TESTS="-v $DISABLE_TESTS"
%{ruby_libdir}/tkextlib %{ruby_libdir}/tkextlib
%changelog %changelog
* Fri Aug 12 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-62
- Fix support for dependent^2 SCLs
* Mon Jul 25 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-61 * Mon Jul 25 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-61
- Add %%{scl}-runtime to Requires in libs subpackage - Add %%{scl}-runtime to Requires in libs subpackage

View File

@ -7,7 +7,7 @@ class TestDependentSCLS < Test::Unit::TestCase
def setup def setup
# Avoid caching # Avoid caching
Gem.class_eval("@default_locations, @default_dirs = nil, nil") Gem.class_eval("@x_scls, @default_locations, @default_dirs = nil, nil, nil")
# TODO: Different bin dir during build ("/builddir/build/BUILD/ruby-2.0.0-p247") # TODO: Different bin dir during build ("/builddir/build/BUILD/ruby-2.0.0-p247")
@bin_dir = Gem::ConfigMap[:bindir].split(File::SEPARATOR).last @bin_dir = Gem::ConfigMap[:bindir].split(File::SEPARATOR).last