mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
outdate-bundled-gems.rb: Pass platform and version explicitly
For different version baseruby, use the target platform and version instead of the info of baseruby.
This commit is contained in:
parent
8f61617a95
commit
963131a2d9
2 changed files with 21 additions and 10 deletions
|
@ -1533,7 +1533,9 @@ clone-bundled-gems-src: PHONY
|
|||
gems/bundled_gems
|
||||
|
||||
outdate-bundled-gems: PHONY
|
||||
$(Q) $(BASERUBY) $(tooldir)/$@.rb --make="$(MAKE)" --mflags="$(MFLAGS)" "$(srcdir)"
|
||||
$(Q) $(BASERUBY) $(tooldir)/$@.rb --make="$(MAKE)" --mflags="$(MFLAGS)" \
|
||||
--ruby-platform=$(arch) --ruby-version=$(ruby_version) \
|
||||
"$(srcdir)"
|
||||
|
||||
update-bundled_gems: PHONY
|
||||
$(Q) $(RUNRUBY) -rrubygems \
|
||||
|
|
|
@ -14,6 +14,14 @@ until ARGV.empty?
|
|||
# just to run when `make -n`
|
||||
when /\A--mflags=(.*)/
|
||||
fu = FileUtils::DryRun if /\A-\S*n/ =~ $1
|
||||
when /\A--gem[-_]platform=(.*)/im
|
||||
gem_platform = $1
|
||||
ruby_platform = nil
|
||||
when /\A--ruby[-_]platform=(.*)/im
|
||||
ruby_platform = $1
|
||||
gem_platform = nil
|
||||
when /\A--ruby[-_]version=(.*)/im
|
||||
ruby_version = $1
|
||||
when /\A-/
|
||||
raise "#{$0}: unknown option: #{ARGV.first}"
|
||||
else
|
||||
|
@ -22,6 +30,9 @@ until ARGV.empty?
|
|||
ARGV.shift
|
||||
end
|
||||
|
||||
gem_platform ||= (ruby_platform ? Gem::Platform.new(ruby_platform) : Gem::Platform.local).to_s
|
||||
ruby_version ||= RbConfig::CONFIG['ruby_version'] # This may not have "-static"
|
||||
|
||||
class Removal
|
||||
attr_reader :base
|
||||
|
||||
|
@ -104,29 +115,27 @@ curdir.glob(".bundle/gems/*/") do |dir|
|
|||
end
|
||||
end
|
||||
|
||||
platform = Gem::Platform.local.to_s
|
||||
curdir.glob(".bundle/{extensions,.timestamp}/*/") do |dir|
|
||||
unless File.basename(dir) == platform
|
||||
unless File.fnmatch?(gem_platform, File.basename(dir))
|
||||
curdir.rmdir(dir)
|
||||
end
|
||||
end
|
||||
|
||||
baseruby_version = RbConfig::CONFIG['ruby_version'] # This may not have "-static"
|
||||
curdir.glob(".bundle/{extensions,.timestamp}/#{platform}/*/") do |dir|
|
||||
version = File.basename(dir).split('-', 2).first # Remove "-static" if exists
|
||||
unless version == baseruby_version
|
||||
curdir.glob(".bundle/{extensions,.timestamp}/#{gem_platform}/*/") do |dir|
|
||||
unless File.fnmatch?(ruby_version, File.basename(dir, '-static'))
|
||||
curdir.rmdir(dir)
|
||||
end
|
||||
end
|
||||
|
||||
curdir.glob(".bundle/extensions/#{platform}/#{baseruby_version}/*/") do |dir|
|
||||
curdir.glob(".bundle/extensions/#{gem_platform}/#{ruby_version}/*/") do |dir|
|
||||
unless curdir.exist?(".bundle/specifications/#{File.basename(dir)}.gemspec")
|
||||
curdir.rmdir(dir)
|
||||
end
|
||||
end
|
||||
|
||||
curdir.glob(".bundle/.timestamp/#{platform}/#{baseruby_version}/.*.time") do |stamp|
|
||||
unless curdir.directory?(File.join(".bundle", stamp[%r[/\.([^/]+)\.time\z], 1].gsub('.-.', '/')))
|
||||
curdir.glob(".bundle/.timestamp/#{gem_platform}/#{ruby_version}/.*.time") do |stamp|
|
||||
dir = stamp[%r[/\.([^/]+)\.time\z], 1].gsub('.-.', '/')[%r[\A[^/]+/[^/]+]]
|
||||
unless curdir.directory?(File.join(".bundle", dir))
|
||||
curdir.unlink(stamp)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue