зеркало из https://github.com/github/ruby.git
[Bug #19340] Fix bundle gems with test revision
Build temporary gem package from cloned repository if test revision is set.
This commit is contained in:
Родитель
78fcc9847a
Коммит
17f5631c6e
|
@ -1402,10 +1402,10 @@ extract-gems$(gnumake:yes=-sequential): PHONY
|
|||
-e 'gem, ver, _, rev = *$$F' \
|
||||
-e 'next if !ver or /^#/=~gem' \
|
||||
-e 'g = "#{gem}-#{ver}"' \
|
||||
-e 'if File.directory?("#{d}/#{g}")' \
|
||||
-e 'elsif rev and File.exist?(gs = "gems/src/#{gem}/#{gem}.gemspec")' \
|
||||
-e 'BundledGem.copy(gs, ".bundle")' \
|
||||
-e 'else' \
|
||||
-e 'unless File.directory?("#{d}/#{g}")' \
|
||||
-e 'if rev and File.exist?(gs = "gems/src/#{gem}/#{gem}.gemspec")' \
|
||||
-e 'BundledGem.build(gs, ver, "gems")' \
|
||||
-e 'end' \
|
||||
-e 'BundledGem.unpack("gems/#{g}.gem", ".bundle")' \
|
||||
-e 'end' \
|
||||
gems/bundled_gems
|
||||
|
|
|
@ -326,27 +326,28 @@ $(srcdir)/.bundle/gems/%: $(srcdir)/gems/%.gem | .bundle/gems
|
|||
-Itool/lib -rbundled_gem \
|
||||
-e 'BundledGem.unpack("gems/$(@F).gem", ".bundle")'
|
||||
|
||||
define copy-gem
|
||||
define build-gem
|
||||
$(srcdir)/gems/src/$(1): | $(srcdir)/gems/src
|
||||
$(ECHO) Cloning $(4)
|
||||
$(Q) $(GIT) clone $(4) $$(@)
|
||||
|
||||
$(srcdir)/.bundle/gems/$(1)-$(2): | $(srcdir)/gems/src/$(1) .bundle/gems
|
||||
$(ECHO) Copying $(1)@$(3) to $$(@F)
|
||||
.PHONY: $(srcdir)/gems/$(1)-$(2).gem
|
||||
$(srcdir)/gems/$(1)-$(2).gem: | $(srcdir)/gems/src/$(1)
|
||||
$(ECHO) Building $(1)@$(3) to $$(@F)
|
||||
$(Q) $(CHDIR) "$(srcdir)/gems/src/$(1)" && \
|
||||
$(GIT) fetch origin $(3) && \
|
||||
$(GIT) checkout --detach $(3) && \
|
||||
:
|
||||
$(Q) $(BASERUBY) -C "$(srcdir)" \
|
||||
-Itool/lib -rbundled_gem \
|
||||
-e 'BundledGem.copy("gems/src/$(1)/$(1).gemspec", ".bundle")'
|
||||
-e 'BundledGem.build("gems/src/$(1)/$(1).gemspec", "$(2)", "gems")'
|
||||
|
||||
endef
|
||||
define copy-gem-0
|
||||
$(eval $(call copy-gem,$(1),$(2),$(3),$(4)))
|
||||
define build-gem-0
|
||||
$(eval $(call build-gem,$(1),$(2),$(3),$(4)))
|
||||
endef
|
||||
|
||||
$(call foreach-bundled-gems-rev,copy-gem-0)
|
||||
$(call foreach-bundled-gems-rev,build-gem-0)
|
||||
|
||||
$(srcdir)/gems/src:
|
||||
$(MAKEDIRS) $@
|
||||
|
|
|
@ -14,6 +14,19 @@ module BundledGem
|
|||
puts "Unpacked #{file}"
|
||||
end
|
||||
|
||||
def build(gemspec, version, outdir = ".", validation: true)
|
||||
outdir = File.expand_path(outdir)
|
||||
gemdir, gemfile = File.split(gemspec)
|
||||
Dir.chdir(gemdir) do
|
||||
spec = Gem::Specification.load(gemfile)
|
||||
abort "Failed to load #{gemspec}" unless spec
|
||||
abort "Unexpected version #{spec.version}" unless spec.version == Gem::Version.new(version)
|
||||
output = File.join(outdir, spec.file_name)
|
||||
FileUtils.rm_rf(output)
|
||||
Gem::Package.build(spec, validation == false, validation, output)
|
||||
end
|
||||
end
|
||||
|
||||
def copy(path, *rest)
|
||||
path, n = File.split(path)
|
||||
spec = Dir.chdir(path) {Gem::Specification.load(n)} or raise "Cannot load #{path}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче