bin/autoproj_bootstrap in autoproj-1.9.7.rc9 vs bin/autoproj_bootstrap in autoproj-1.9.7.rc10

- old
+ new

@@ -84,10 +84,18 @@ true end def self.message(str) STDERR.puts " #{str}" end + def self.progress(key, str) + STDERR.puts " #{str}" + end + def self.progress_done(key) + end + def self.message(str) + STDERR.puts " #{str}" + end class << self attr_reader :programs end @programs = Hash.new @@ -469,19 +477,19 @@ # Filters all paths that come from other autoproj installations out # of GEM_PATH def self.initialize_environment Autobuild::ORIGINAL_ENV['GEM_PATH'] = - (ENV['GEM_PATH'] || "").split(":").find_all do |p| + (ENV['GEM_PATH'] || "").split(File::PATH_SEPARATOR).find_all do |p| !Autoproj.in_autoproj_installation?(p) - end.join(":") + end.join(File::PATH_SEPARATOR) Autobuild.env_inherit 'GEM_PATH' Autobuild.env_init_from_env 'GEM_PATH' - orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(':') + orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(File::PATH_SEPARATOR) Autobuild::SYSTEM_ENV['GEM_PATH'] = Gem.default_path - Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(":") + Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(File::PATH_SEPARATOR) Autoproj.manifest.each_reused_autoproj_installation do |p| p_gems = File.join(Autoproj.root_dir, '.gems') if File.directory?(p_gems) Autobuild.env_add_path 'GEM_PATH', p_gems @@ -666,11 +674,11 @@ The following command line can be used to install them manually #{cmdlines.map { |c| c.join(" ") }.join("\n ")} - Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can + Autoproj expects these Gems to be installed in #{GemManager.gem_home} This can be overridden by setting the AUTOPROJ_GEM_HOME environment variable manually EOMSG print " #{Autoproj.color("Press ENTER to continue ", :bold)}" @@ -750,11 +758,11 @@ #{Autoproj.color("and you required autoproj to not do it itself", :bold)} The following command line can be used to install them manually #{cmdlines.map { |c| c.join(" ") }.join("\n ")} - Autoproj expects these Python packages to be installed in #{Autoproj.pip_home} This can + Autoproj expects these Python packages to be installed in #{PipManager.pip_home} This can be overridden by setting the AUTOPROJ_PYTHONUSERBASE environment variable manually EOMSG print " #{Autoproj.color("Press ENTER to continue ", :bold)}" @@ -1050,22 +1058,30 @@ names, versions = user_os.split(':') @operating_system = [names.split(','), versions.split(',')] end else Autobuild.progress :operating_system_autodetection, "autodetecting the operating system" - lsb_name, lsb_versions = os_from_lsb - if lsb_name - if lsb_name != 'debian' && File.exists?("/etc/debian_version") - @operating_system = [[lsb_name, "debian"], lsb_versions] - elsif lsb_name != 'arch' && File.exists?("/etc/arch-release") - @operating_system = [[lsb_name, "arch"], lsb_versions] - elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release") - @operating_system = [[lsb_name, "opensuse"], lsb_versions] - elsif lsb_name != 'debian' - # Debian unstable cannot be detected with lsb_release, - # so debian has its own detection logic - @operating_system = [[lsb_name], lsb_versions] + names, versions = os_from_os_release + # Don't use the os-release information on Debian, since they + # refuse to put enough information to detect 'unstable' + # reliably. So, we use Debian's heuristic detection method below + if names && names[0] != 'debian' + @operating_system = [names, versions] + else + lsb_name, lsb_versions = os_from_lsb + if lsb_name + if lsb_name != 'debian' && File.exists?("/etc/debian_version") + @operating_system = [[lsb_name, "debian"], lsb_versions] + elsif lsb_name != 'arch' && File.exists?("/etc/arch-release") + @operating_system = [[lsb_name, "arch"], lsb_versions] + elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release") + @operating_system = [[lsb_name, "opensuse"], lsb_versions] + elsif lsb_name != 'debian' + # Debian unstable cannot be detected with lsb_release, + # so debian has its own detection logic + @operating_system = [[lsb_name], lsb_versions] + end end end end if @operating_system.nil? @@ -1123,17 +1139,32 @@ @operating_system ensure Autobuild.progress_done :operating_system_autodetection end + def self.os_from_os_release(filename = '/etc/os-release') + return if !File.exists?(filename) + + fields = Hash.new + File.readlines(filename).each do |line| + if line.strip =~ /^(\w+)=(?:["'])?([^"']+)(?:["'])?$/ + fields[$1] = $2 + else Autoproj.warn "error parsing /etc/os-release, line: #{line.inspect}" + end + end + + names = [] + versions = [] + names << fields['ID'] << fields['ID_LIKE'] + versions << fields['VERSION_ID'] + version = fields['VERSION'] || '' + versions.concat(version.gsub(/[^\w.]/, ' ').split(' ')) + return names.compact.uniq, versions.compact.uniq + end + def self.os_from_lsb - has_lsb_release = nil - begin - has_lsb_release = `which lsb_release` - return unless $?.success? - rescue Exception => e - #seems which is not installes (e.g. on windows) + if !Autobuild.find_in_path('lsb_release') return end distributor = `lsb_release -i -s` distributor = distributor.strip.downcase @@ -2126,20 +2157,10 @@ def self.env_inherit(*names) Autobuild.env_inherit(*names) end - # Find the given program in PATH. It raises ArgumentError if the program - # can't be found - def self.find_in_path(name) - result = ENV['PATH'].split(':').find { |dir| File.file?(File.join(dir, name)) } - if !result - raise ArgumentError, "#{name} can not be found in PATH (#{ENV['PATH']})" - end - File.join(result, name) - end - # @deprecated use isolate_environment instead def self.set_initial_env isolate_environment end @@ -2291,15 +2312,24 @@ - ruby1.9.1-dev - rubygems1.9.1 - rake - rubygems-integration ubuntu: - - ruby1.9.1 - - ruby1.9.1-dev - - rubygems1.9.1 - - ri1.9.1 - - libopenssl-ruby1.9.1 - - rake + '12.04': + - ruby1.9.1 + - ruby1.9.1-dev + - rubygems1.9.1 + - ri1.9.1 + - libopenssl-ruby1.9.1 + - rake + default: + - ruby1.9.1 + - ruby1.9.1-dev + - rubygems1.9.1 + - ri1.9.1 + - libopenssl-ruby1.9.1 + - rake + - rubygems-integration gentoo: - dev-lang/ruby:1.9 - rake fedora: '17':