#! /usr/bin/env ruby if RUBY_VERSION < "1.8.7" STDERR.puts "autoproj requires Ruby >= 1.8.7" exit 1 end require 'autoproj' require 'autoproj/autobuild' require 'open-uri' require 'autoproj/cmdline' include Autoproj InputError = Autoproj::InputError def color(*args) Autoproj.console.color(*args) end def report(debug) Autobuild::Reporting.report do yield end Autobuild::Reporting.success rescue ConfigError => e STDERR.puts STDERR.puts color(e.message, :red, :bold) if Autoproj.in_autoproj_installation?(Dir.pwd) root_dir = /^#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/ e.backtrace.find_all { |path| path =~ root_dir }. each do |path| STDERR.puts color(" in #{path}", :red, :bold) end end if debug then raise else exit 1 end rescue Interrupt STDERR.puts STDERR.puts color("Interrupted by user", :red, :bold) if debug then raise else exit 1 end end Autoproj::OSDependencies.autodetect_ruby # Find the autoproj root dir report(Autobuild.debug) do selected_packages = begin Autoproj::CmdLine.parse_arguments(ARGV.dup) rescue RuntimeError => e if Autoproj::CmdLine.bootstrap? && !Autoproj.in_autoproj_installation?(Dir.pwd) STDERR.puts < where 'vcs_type' is git, svn, darcs, cvs 'vcs_url' is the vcs-specific URL to the repository, and 'vcs_options' are optional values that can be given to the chosen VCS EOTEXT end raise e end # Expand directories in the selected_packages set, before we chdir to the # autoproj root root_dir = Autoproj.root_dir selected_packages.map! do |name| if File.directory?(name) File.expand_path(name) else name end end Dir.chdir(root_dir) # Basic initialization Autoproj::CmdLine.initialize if selected_packages.empty? Autoproj::CmdLine.update_myself Autoproj::CmdLine.update_configuration end Autoproj::CmdLine.load_configuration manifest = Autoproj.manifest # Once thing left to do: handle the Autoproj.auto_update configuration # parameter # # Namely, we must check if Autobuild.do_update has been explicitely set to # true or false. If that is the case, don't do anything. Otherwise, set it # to the value of Autoproj.auto_update if Autobuild.do_update.nil? Autobuild.do_update = Autoproj.auto_update? end # If in verbose mode, or if we only update sources, list the sources if Autoproj.verbose || Autoproj::CmdLine.display_configuration? Autoproj::CmdLine.display_sources(manifest) end if Autoproj::CmdLine.bootstrap? STDERR.puts <