Clone and create dummy gemspec in sequential build

This commit is contained in:
Nobuyoshi Nakada 2023-02-21 20:30:08 +09:00
parent 241c4cfdd4
commit 289080e4d8
Notes: git 2023-02-21 17:08:21 +00:00
2 changed files with 25 additions and 0 deletions

View File

@ -1411,6 +1411,20 @@ extract-gems$(gnumake:yes=-sequential): PHONY
-e 'end' \ -e 'end' \
gems/bundled_gems gems/bundled_gems
extract-gems$(gnumake:yes=-sequential): clone-bundled-gems-src
clone-bundled-gems-src: PHONY
$(Q) $(BASERUBY) -C "$(srcdir)" \
-Itool/lib -rbundled_gem -answ \
-e 'BEGIN {git = $$git}' \
-e 'gem, _, repo, rev = *$$F' \
-e 'next if !rev or /^#/=~gem' \
-e 'gemdir = "gems/src/#{gem}"' \
-e 'BundledGem.checkout(gemdir, repo, rev, git: git)' \
-e 'BundledGem.dummy_gemspec("#{gemdir}/#{gem}.gemspec")' \
-- -git="$(GIT)" \
gems/bundled_gems
outdate-bundled-gems: PHONY outdate-bundled-gems: PHONY
$(Q) $(BASERUBY) $(tooldir)/$@.rb --make="$(MAKE)" --mflags="$(MFLAGS)" "$(srcdir)" $(Q) $(BASERUBY) $(tooldir)/$@.rb --make="$(MAKE)" --mflags="$(MFLAGS)" "$(srcdir)"

View File

@ -83,4 +83,15 @@ module BundledGem
File.write(gemfile, spec.to_ruby) File.write(gemfile, spec.to_ruby)
end end
end end
def checkout(gemdir, repo, rev, git: $git)
return unless rev
unless File.exist?("#{gemdir}/.git")
puts "Cloning #{repo}"
system("#{git} clone #{repo} #{gemdir}") or raise
end
puts "Update #{File.basename(gemdir)} to #{rev}"
system("#{git} fetch origin #{rev}", chdir: gemdir)
system("#{git} checkout --detach #{rev}", chdir: gemdir)
end
end end