bin/autoproj_bootstrap in autoproj-1.7.8 vs bin/autoproj_bootstrap in autoproj-1.7.9
- old
+ new
@@ -253,11 +253,11 @@
# both the version number (as a string) and/or the codename if there is
# one.
#
# Examples: ['debian', ['sid', 'unstable']] or ['ubuntu', ['lucid lynx', '10.04']]
def self.operating_system
- if @operating_system
+ if !@operating_system.nil?
return @operating_system
elsif Autoproj.has_config_key?('operating_system')
os = Autoproj.user_config('operating_system')
if os.respond_to?(:to_ary)
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
@@ -266,23 +266,32 @@
return os
end
end
end
- Autoproj.progress " autodetecting the operating system"
- name, versions = os_from_lsb
- if name
- if name != "debian"
- if File.exists?("/etc/debian_version")
- @operating_system = [[name, "debian"], versions]
- else
- @operating_system = [[name], versions]
+ if user_os = ENV['AUTOPROJ_OS']
+ if user_os.empty?
+ @operating_system = false
+ else
+ names, versions = user_os.split(':')
+ @operating_system = [names.split(','), versions.split(',')]
+ end
+ else
+ Autoproj.progress " autodetecting the operating system"
+ name, versions = os_from_lsb
+ if name
+ if name != "debian"
+ if File.exists?("/etc/debian_version")
+ @operating_system = [[name, "debian"], versions]
+ else
+ @operating_system = [[name], versions]
+ end
end
end
end
- if !@operating_system
+ if @operating_system.nil?
# Need to do some heuristics unfortunately
@operating_system =
if File.exists?('/etc/debian_version')
codenames = [File.read('/etc/debian_version').strip]
if codenames.first =~ /sid/
@@ -332,16 +341,31 @@
# and returns true if it is the case
def self.dpkg_package_installed?(package_name)
if !@dpkg_installed_packages
@dpkg_installed_packages = Set.new
dpkg_status = File.readlines('/var/lib/dpkg/status')
- dpkg_status.grep(/^(Package|Status)/).
- each_slice(2) do |package, status|
- if status.chomp == "Status: install ok installed"
- @dpkg_installed_packages << package.split[1].chomp
+
+ current_packages = []
+ is_installed = false
+ dpkg_status.each do |line|
+ line = line.chomp
+ if line == ""
+ if is_installed
+ current_packages.each do |pkg|
+ @dpkg_installed_packages << pkg
+ end
+ current_packages.clear
+ is_installed = false
end
+ elsif line =~ /Package: (.*)$/
+ current_packages << $1
+ elsif line =~ /Provides: (.*)$/
+ current_packages << $1
+ elsif line == "Status: install ok installed"
+ is_installed = true
end
+ end
end
if package_name =~ /^(\w[a-z0-9+-.]+)/
@dpkg_installed_packages.include?($1)
else
@@ -408,10 +432,14 @@
dep_def = definitions[name]
if !dep_def
return NO_PACKAGE
end
+ if dep_def == 'ignore'
+ return IGNORE
+ end
+
if !os_names
return UNKNOWN_OS
end
# Find a matching entry for the OS name
@@ -697,10 +725,12 @@
Finally, OS dependencies can be installed by calling "autoproj osdeps"
with the corresponding option (--all, --ruby, --os or --none). Calling
"autoproj osdeps" without arguments will also give you information as
to what you should install to compile the software successfully.
+
+So, what do you want ? (ruby or none)
EOT
message = [ "Which prepackaged software (a.k.a. 'osdeps') should autoproj install automatically (ruby, none) ?", long_doc.strip ]
Autoproj.configuration_option 'osdeps_mode', 'string',
:default => 'ruby',
@@ -734,10 +764,12 @@
an autoproj operation with the --reconfigure option (e.g. autoproj update
--reconfigure).
Finally, OS dependencies can be installed by calling "autoproj osdeps"
with the corresponding option (--all, --ruby, --os or --none).
+
+So, what do you want ? (all, ruby, os or none)
EOT
message = [ "Which prepackaged software (a.k.a. 'osdeps') should autoproj install automatically (all, ruby, os, none) ?", long_doc.strip ]
Autoproj.configuration_option 'osdeps_mode', 'string',
:default => 'all',
@@ -823,10 +855,10 @@
attr_reader :installed_packages
def osdeps_interaction_unknown_os(osdeps)
puts <<-EOMSG
#{Autoproj.color("The build process requires some other software packages to be installed on our operating system", :bold)}
- #{Autoproj.color("If they are already installed, simply ignore this message", :red)}"
+ #{Autoproj.color("If they are already installed, simply ignore this message", :red)}
#{osdeps.join("\n ")}
EOMSG
print Autoproj.color("Press ENTER to continue", :bold)