diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-04 14:50:13 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-28 09:59:58 +0300 |
commit | 5954ca9ab687e8d137e8b67538ba2b5b17edcb9c (patch) | |
tree | 6e922b56fe7b5c3b84c5b3d7a06c7f36efab7219 /_support | |
parent | 57761a33a63a8cda40a137d487db1b4d3dd4acf8 (diff) |
support: Adapt test-boot script to support bundled Git
The test-boot script doesn't currently support bundled Git, so it will
only be able to bootstrap a server when a Git distribution is available.
Adapt the script to also support bundled Git so that we can use it in
contexts where it is the only Git execution environment available.
Diffstat (limited to '_support')
-rwxr-xr-x | _support/test-boot | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/_support/test-boot b/_support/test-boot index 4a9be6709..67be87553 100755 --- a/_support/test-boot +++ b/_support/test-boot @@ -2,14 +2,21 @@ require 'tempfile' require 'socket' +require 'optparse' ADDR = 'socket'.freeze -def main(gitaly_dir) - gitaly_dir = File.realpath(gitaly_dir) +def main(params) + gitaly_dir = File.realpath(params[:dir]) build_dir = File.join(gitaly_dir, '_build') bin_dir = File.join(build_dir, 'bin') - git_path = File.join(build_dir, 'deps', 'git', 'install', 'bin', 'git') + + git_path, use_bundled_git = + if params[:"bundled-git"] + ["", true] + else + [File.join(build_dir, 'deps', 'git', 'install', 'bin', 'git'), false] + end version = IO.popen("#{File.join(bin_dir, 'gitaly')} -version").read.delete_prefix('Gitaly, version ').strip version_from_file = IO.read(File.join(gitaly_dir, 'VERSION')).strip @@ -35,6 +42,7 @@ def main(gitaly_dir) path = "#{dir}" [git] + use_bundled_binaries = #{use_bundled_git} bin_path = "#{git_path}" [gitaly-ruby] @@ -85,8 +93,15 @@ def wait_connect abort end -unless ARGV.count == 1 - abort "Usage: #{$PROGRAM_NAME} GITALY_DIR" -end +params = {} +OptionParser.new do |parser| + parser.banner = "Usage: #{$PROGRAM_NAME} [options] <GITALY_DIR>" + parser.on('--[no-]bundled-git', 'Set up Gitaly with bundled Git binaries') +end.parse!(into: params) + +params[:dir] = ARGV.pop +abort "Gitaly source directory not provided" if params[:dir].nil? + +abort "Extra arguments" unless ARGV.count == 0 -main(ARGV.first) +main(params) |