Skip to content

Commit 2f643e7

Browse files
committed
[Bug #21388] Install snapshots of gems
If a snapshot gem is built install it instead of the downloaded release version.
1 parent 0b2c8e8 commit 2f643e7

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

common.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ INSTRUBY_ARGS = $(SCRIPT_ARGS) \
310310
--prog-mode=$(INSTALL_PROG_MODE) \
311311
--installed-list $(INSTALLED_LIST) \
312312
--mantype="$(MANTYPE)" \
313+
--have-git=$(HAVE_GIT) \
313314
$(INSTRUBY_OPTS)
314315
INSTALL_PROG_MODE = 0755
315316
INSTALL_DATA_MODE = 0644

tool/rbinstall.rb

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def parse_args(argv = ARGV)
9696
opt.on('--[no-]strip') {|strip| $strip = strip}
9797
opt.on('--gnumake') {gnumake = true}
9898
opt.on('--debug-symbols=SUFFIX', /\w+/) {|name| $debug_symbols = ".#{name}"}
99+
opt.on('--have-git=BOOL', %w[yes no]) {|git| $have_git = git == "yes"}
99100

100101
unless $install_procs.empty?
101102
w = (w = ENV["COLUMNS"] and (w = w.to_i) > 80) ? w - 30 : 50
@@ -1135,19 +1136,23 @@ class << (w = [])
11351136
# the newly installed ruby.
11361137
ENV.delete('RUBYOPT')
11371138

1138-
File.foreach("#{srcdir}/gems/bundled_gems") do |name|
1139-
next if /^\s*(?:#|$)/ =~ name
1140-
next unless /^(\S+)\s+(\S+).*/ =~ name
1141-
gem = $1
1142-
gem_name = "#$1-#$2"
1139+
require_relative 'lib/bundled_gem'
1140+
BundledGem.each(snapshot: $have_git) do |gem, ver, _, rev|
1141+
gem_name = "#{gem}-#{ver}"
11431142
path = [
1144-
# gemspec that removed duplicated dependencies of bundled gems
1145-
"#{srcdir}/.bundle/gems/#{gem_name}/#{gem}.gemspec",
1143+
# gemspec for snapshot C ext gems, It has the original dependencies
1144+
# ex .bundle/gems/debug-1.10.1.snapshot/debug-1.10.1.snapshot.gemspec
1145+
".bundle/specifications/#{gem_name}.gemspec",
1146+
1147+
# original gemspec generated by rubygems
1148+
"#{srcdir}/.bundle/specifications/#{gem_name}.gemspec",
1149+
11461150
# gemspec for C ext gems, It has the original dependencies
11471151
# ex .bundle/gems/debug-1.7.1/debug-1.7.1.gemspec
11481152
"#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec",
1149-
# original gemspec generated by rubygems
1150-
"#{srcdir}/.bundle/specifications/#{gem_name}.gemspec"
1153+
1154+
# gemspec that removed duplicated dependencies of bundled gems
1155+
"#{srcdir}/.bundle/gems/#{gem_name}/#{gem}.gemspec",
11511156
].find { |gemspec| File.exist?(gemspec) }
11521157
if path.nil?
11531158
skipped[gem_name] = "gemspec not found"

0 commit comments

Comments
 (0)