bin/autoproj_bootstrap in autoproj-1.9.7.rc11 vs bin/autoproj_bootstrap in autoproj-1.9.7.rc12

- old
+ new

@@ -72,10 +72,13 @@ def self.color(string, *args) string end + def self.warn(str, *args) + STDERR.puts "WARN #{str}" + end def self.message(str) STDERR.puts " #{str}" end end @@ -1145,13 +1148,15 @@ def self.os_from_os_release(filename = '/etc/os-release') return if !File.exists?(filename) fields = Hash.new File.readlines(filename).each do |line| + line = line.strip if line.strip =~ /^(\w+)=(?:["'])?([^"']+)(?:["'])?$/ fields[$1] = $2 - else Autoproj.warn "error parsing /etc/os-release, line: #{line.inspect}" + elsif !line.empty? + Autoproj.warn "could not parse line '#{line.inspect}' in /etc/os-release" end end names = [] versions = [] @@ -1785,10 +1790,18 @@ # Autobuild.programs['automake'] = 'automake1.9' def tool(name) programs[name.to_sym] || programs[name.to_s] || name.to_s end + def find_in_path(file) + path = ENV['PATH'].split(File::PATH_SEPARATOR). + find { |dir| File.exists?(File.join(dir, file)) } + if path + return File.join(path, file) + end + end + # Resolves the absolute path to a given tool def tool_in_path(name) path, path_name, path_env = programs_in_path[name] current = tool(name) if path_env != ENV['PATH'] || path_name != current @@ -1796,14 +1809,10 @@ programs_in_path.delete(name) if current[0, 1] == "/" # This is already a full path path = current else - path = ENV['PATH'].split(':'). - find { |dir| File.exists?(File.join(dir, current)) } - if path - path = File.join(path, current) - end + path = find_in_path(current) end if !path raise ArgumentError, "tool #{name}, set to #{current}, can not be found in PATH=#{path_env}" end