Skip to content

Commit 738d0ed

Browse files
fix shallow clone for tag and abort when fail
1 parent db96128 commit 738d0ed

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/ruby_wasm/build_system/product/ruby_source.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ def fetch
2323
case @params[:type]
2424
when "github"
2525
repo_url = "https://github.com/#{@params[:repo]}.git"
26-
FileUtils.mkdir_p src_dir
27-
system "git init", chdir: src_dir
28-
system "git remote add origin #{repo_url}", chdir: src_dir
29-
system "git fetch --depth 1 origin #{@params[:rev]}", chdir: src_dir
30-
system "git checkout #{@params[:rev]}", chdir: src_dir
26+
system "git clone --depth 1 -b #{@params[:rev]} #{repo_url} #{src_dir}" or
27+
raise "failed to clone #{repo_url}"
3128
when "local"
3229
FileUtils.mkdir_p File.dirname(src_dir)
3330
FileUtils.cp_r @params[:src], src_dir
@@ -43,8 +40,9 @@ def build
4340
fetch unless File.exist?(src_dir)
4441
unless File.exist?(configure_file)
4542
Dir.chdir(src_dir) do
46-
system "ruby tool/downloader.rb -d tool -e gnu config.guess config.sub"
47-
system "./autogen.sh"
43+
system "ruby tool/downloader.rb -d tool -e gnu config.guess config.sub" or
44+
raise "failed to download config.guess and config.sub"
45+
system "./autogen.sh" or raise "failed to run autogen.sh"
4846
end
4947
end
5048
end

0 commit comments

Comments
 (0)