From 534248d236471838b7a167c88546340d2bc516c2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 1 Apr 2014 10:36:50 +0200 Subject: [PATCH] Make it possible to override source URL To make test builds it can be useful to point gitian at an alternative repository. This commit makes this possible by adding a `--url PAIRS` command line option, that allows to optionally specify where to fetch the code, for example: gbuild --url bitcoin=https://github.com/laanwj/bitcoin.git --commit bitcoin=2014_03_... --- bin/gbuild | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/gbuild b/bin/gbuild index c1a7cef..308d87c 100755 --- a/bin/gbuild +++ b/bin/gbuild @@ -136,6 +136,9 @@ OptionParser.new do |opts| opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v| @options[:commit] = v end + opts.on("-u PAIRS", "--url PAIRS", "comma separated list of DIRECTORY=URL pairs") do |v| + @options[:url] = v + end end.parse! if !ENV["USE_LXC"] and !File.exist?("/dev/kvm") @@ -189,11 +192,23 @@ if @options[:commit] end end +urls = {} + +if @options[:url] + @options[:url].split(',').each do |pair| + (dir, url) = pair.split('=') + urls[dir] = url + end +end + build_desc["remotes"].each do |remote| if !remote["commit"] remote["commit"] = commits[remote["dir"]] raise "must specify a commit for directory #{remote["dir"]}" unless remote["commit"] end + if urls[remote["dir"]] + remote["url"] = urls[remote["dir"]] + end dir = sanitize(remote["dir"], remote["dir"]) unless File.exist?("inputs/#{dir}") system!("git init inputs/#{dir}")