Merge pull request #51 from laanwj/master

Make it possible to override source URL
This commit is contained in:
Dev Random 2014-04-01 08:57:45 -07:00
commit f0ec85e788

View File

@ -136,6 +136,9 @@ OptionParser.new do |opts|
opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v| opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v|
@options[:commit] = v @options[:commit] = v
end end
opts.on("-u PAIRS", "--url PAIRS", "comma separated list of DIRECTORY=URL pairs") do |v|
@options[:url] = v
end
end.parse! end.parse!
if !ENV["USE_LXC"] and !File.exist?("/dev/kvm") if !ENV["USE_LXC"] and !File.exist?("/dev/kvm")
@ -189,11 +192,23 @@ if @options[:commit]
end end
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| build_desc["remotes"].each do |remote|
if !remote["commit"] if !remote["commit"]
remote["commit"] = commits[remote["dir"]] remote["commit"] = commits[remote["dir"]]
raise "must specify a commit for directory #{remote["dir"]}" unless remote["commit"] raise "must specify a commit for directory #{remote["dir"]}" unless remote["commit"]
end end
if urls[remote["dir"]]
remote["url"] = urls[remote["dir"]]
end
dir = sanitize(remote["dir"], remote["dir"]) dir = sanitize(remote["dir"], remote["dir"])
unless File.exist?("inputs/#{dir}") unless File.exist?("inputs/#{dir}")
system!("git init inputs/#{dir}") system!("git init inputs/#{dir}")