autoproj 2.0.0.rc3 → 2.0.0.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +9 -29
- data/bin/autoproj_bootstrap +159 -3150
- data/bin/autoproj_bootstrap.in +4 -256
- data/bin/autoproj_install +225 -0
- data/bin/autoproj_install.in +14 -0
- data/lib/autoproj.rb +2 -1
- data/lib/autoproj/autobuild.rb +2 -2
- data/lib/autoproj/cli/bootstrap.rb +0 -39
- data/lib/autoproj/cli/build.rb +0 -3
- data/lib/autoproj/cli/main.rb +13 -1
- data/lib/autoproj/cli/osdeps.rb +1 -1
- data/lib/autoproj/cli/show.rb +1 -1
- data/lib/autoproj/cli/update.rb +4 -4
- data/lib/autoproj/cli/upgrade.rb +71 -0
- data/lib/autoproj/configuration.rb +18 -1
- data/lib/autoproj/exceptions.rb +7 -0
- data/lib/autoproj/installation_manifest.rb +23 -12
- data/lib/autoproj/manifest.rb +22 -48
- data/lib/autoproj/ops/build.rb +2 -2
- data/lib/autoproj/ops/configuration.rb +1 -1
- data/lib/autoproj/ops/import.rb +1 -1
- data/lib/autoproj/ops/install.rb +211 -0
- data/lib/autoproj/ops/main_config_switcher.rb +1 -5
- data/lib/autoproj/os_package_installer.rb +348 -0
- data/lib/autoproj/{osdeps.rb → os_package_resolver.rb} +56 -392
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +2 -2
- data/lib/autoproj/package_managers/bundler_manager.rb +179 -0
- data/lib/autoproj/package_managers/emerge_manager.rb +2 -2
- data/lib/autoproj/package_managers/gem_manager.rb +7 -6
- data/lib/autoproj/package_managers/homebrew_manager.rb +2 -2
- data/lib/autoproj/package_managers/manager.rb +5 -6
- data/lib/autoproj/package_managers/pacman_manager.rb +2 -2
- data/lib/autoproj/package_managers/pip_manager.rb +8 -8
- data/lib/autoproj/package_managers/pkg_manager.rb +2 -2
- data/lib/autoproj/package_managers/port_manager.rb +2 -2
- data/lib/autoproj/package_managers/shell_script_manager.rb +4 -4
- data/lib/autoproj/package_managers/unknown_os_manager.rb +2 -2
- data/lib/autoproj/package_managers/yum_manager.rb +2 -2
- data/lib/autoproj/package_managers/zypper_manager.rb +2 -2
- data/lib/autoproj/package_set.rb +10 -10
- data/lib/autoproj/reporter.rb +3 -2
- data/lib/autoproj/system.rb +1 -4
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +155 -32
- metadata +9 -3
data/bin/autoproj_bootstrap.in
CHANGED
@@ -5,260 +5,8 @@ if RUBY_VERSION < "1.9.2"
|
|
5
5
|
exit 1
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
module Autobuild
|
10
|
-
@windows = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
|
11
|
-
def self.windows?
|
12
|
-
@windows
|
13
|
-
end
|
14
|
-
|
15
|
-
@macos = RbConfig::CONFIG["host_os"] =~ %r!([Dd]arwin)!
|
16
|
-
def self.macos?
|
17
|
-
@macos
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'yaml'
|
22
|
-
require 'set'
|
23
|
-
|
24
|
-
module Autoproj
|
25
|
-
class ConfigError < RuntimeError; end
|
26
|
-
class << self
|
27
|
-
attr_reader :verbose
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.color(string, *args)
|
31
|
-
string
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.warn(str, *args)
|
35
|
-
STDERR.puts "WARN #{str}"
|
36
|
-
end
|
37
|
-
def self.message(str)
|
38
|
-
STDERR.puts " #{str}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
module Autobuild
|
43
|
-
class Exception < RuntimeError; end
|
44
|
-
|
45
|
-
def self.do_update
|
46
|
-
true
|
47
|
-
end
|
48
|
-
def self.message(str)
|
49
|
-
STDERR.puts " #{str}"
|
50
|
-
end
|
51
|
-
def self.progress(key, str)
|
52
|
-
STDERR.puts " #{str}"
|
53
|
-
end
|
54
|
-
def self.progress_done(key)
|
55
|
-
end
|
56
|
-
def self.message(str)
|
57
|
-
STDERR.puts " #{str}"
|
58
|
-
end
|
59
|
-
|
60
|
-
class << self
|
61
|
-
attr_reader :programs
|
62
|
-
end
|
63
|
-
@programs = Hash.new
|
64
|
-
def self.tool(name)
|
65
|
-
# Let the ability to set programs[name] to nil to make sure we don't use
|
66
|
-
# that program. This is used later on in this file to make sure we
|
67
|
-
# aren't using the wrong rubygems binary
|
68
|
-
if programs.has_key?(name)
|
69
|
-
programs[name]
|
70
|
-
else
|
71
|
-
name
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
module Subprocess
|
76
|
-
def self.run(name, phase, *cmd)
|
77
|
-
if cmd.last.kind_of?(Hash)
|
78
|
-
options = cmd.pop
|
79
|
-
(options[:env] || Hash.new).each do |k, v|
|
80
|
-
ENV[k] = v
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
output = `#{cmd.join(" ")}`
|
85
|
-
if $?.exitstatus != 0
|
86
|
-
STDERR.puts "ERROR: failed to run #{cmd.join(" ")}"
|
87
|
-
STDERR.puts "ERROR: command output is: #{output}"
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
BUILD_OPTION_CODE
|
95
|
-
CONFIG_CODE
|
96
|
-
module Autoproj
|
97
|
-
def self.config
|
98
|
-
@config ||= Configuration.new
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
OSDEPS_CODE
|
103
|
-
TOOLS_CODE
|
104
|
-
SYSTEM_CODE
|
105
|
-
|
106
|
-
DEFS = <<EODEFS
|
107
|
-
OSDEPS_DEFAULTS
|
108
|
-
EODEFS
|
109
|
-
|
110
|
-
# Override Autoproj.root_dir
|
111
|
-
module Autoproj
|
112
|
-
def self.root_dir
|
113
|
-
@root_dir
|
114
|
-
end
|
115
|
-
@root_dir = Dir.pwd
|
116
|
-
end
|
117
|
-
|
118
|
-
if File.directory?(File.join(Autoproj.root_dir, 'autoproj'))
|
119
|
-
STDERR.puts "there is already an autoproj/ directory here, cannot bootstrap"
|
120
|
-
STDERR.puts "Either delete it and attempt bootstrapping again, or source env.sh"
|
121
|
-
STDERR.puts "and use the usual autoproj workflow"
|
122
|
-
exit 1
|
123
|
-
end
|
124
|
-
|
125
|
-
if defined? Encoding # This is a 1.9-only thing
|
126
|
-
Encoding.default_internal = Encoding::UTF_8
|
127
|
-
Encoding.default_external = Encoding::UTF_8
|
128
|
-
end
|
129
|
-
|
130
|
-
if ENV['AUTOPROJ_CURRENT_ROOT'] && ENV['AUTOPROJ_CURRENT_ROOT'] != Dir.pwd
|
131
|
-
STDERR.puts "the env.sh from #{ENV['AUTOPROJ_CURRENT_ROOT']} seem to already be sourced"
|
132
|
-
STDERR.puts "start a new shell and try to bootstrap again"
|
133
|
-
exit 1
|
134
|
-
end
|
135
|
-
|
136
|
-
require 'set'
|
137
|
-
curdir_entries = Dir.entries('.').to_set - [".", "..", "autoproj_bootstrap", ".gems", 'env.sh'].to_set
|
138
|
-
if !curdir_entries.empty? && ENV['AUTOPROJ_BOOTSTRAP_IGNORE_NONEMPTY_DIR'] != '1'
|
139
|
-
while true
|
140
|
-
print "The current directory is not empty, continue bootstrapping anyway ? [yes] "
|
141
|
-
STDOUT.flush
|
142
|
-
answer = STDIN.readline.chomp
|
143
|
-
if answer == "no"
|
144
|
-
exit
|
145
|
-
elsif answer == "" || answer == "yes"
|
146
|
-
# Set the environment variable since we might restart the
|
147
|
-
# autoproj_bootstrap script and -- anyway -- will run "autoproj
|
148
|
-
# bootstrap" later on
|
149
|
-
break
|
150
|
-
else
|
151
|
-
STDOUT.puts "invalid answer. Please answer 'yes' or 'no'"
|
152
|
-
STDOUT.flush
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
# While in here, we don't have utilrb
|
158
|
-
module Kernel
|
159
|
-
def filter_options(options, defaults)
|
160
|
-
options = options.dup
|
161
|
-
filtered = Hash.new
|
162
|
-
defaults.each do |k, v|
|
163
|
-
filtered[k] =
|
164
|
-
if options.has_key?(k) then options.delete(k)
|
165
|
-
else v
|
166
|
-
end
|
167
|
-
end
|
168
|
-
return filtered, options
|
169
|
-
end
|
170
|
-
def validate_options(options, defaults)
|
171
|
-
defaults.merge(options)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Environment is clean, so just mark it as so unconditionally
|
176
|
-
ENV['AUTOPROJ_BOOTSTRAP_IGNORE_NONEMPTY_DIR'] = '1'
|
177
|
-
|
178
|
-
gem_home = ENV['AUTOPROJ_GEM_HOME'] || File.join(Dir.pwd, '.gems')
|
179
|
-
gem_path = ([gem_home] + Gem.default_path).join(":")
|
180
|
-
Gem.paths = Hash['GEM_HOME' => gem_home, 'GEM_PATH' => gem_path]
|
181
|
-
|
182
|
-
ENV['GEM_HOME'] = gem_home
|
183
|
-
ENV['GEM_PATH'] = gem_path
|
184
|
-
ENV['PATH'] = "#{ENV['GEM_HOME']}/bin:#{ENV['PATH']}"
|
185
|
-
|
186
|
-
Autoproj::OSDependencies.define_osdeps_mode_option
|
187
|
-
osdeps_mode = Autoproj::OSDependencies.osdeps_mode.join(",")
|
188
|
-
ENV['AUTOPROJ_OSDEPS_MODE'] = osdeps_mode
|
189
|
-
|
190
|
-
# First thing we do is install a proper ruby environment. We make sure that we
|
191
|
-
# aren't installing any gems for now (as we need to choose the right gem
|
192
|
-
# binary) by setting Autobuild.programs['gem'] to nil
|
193
|
-
Autobuild.programs['gem'] = nil
|
194
|
-
Autoproj::OSDependencies.autodetect_ruby
|
195
|
-
Autoproj::OSDependencies.autodetect_ruby_program
|
196
|
-
|
197
|
-
osdeps_management =
|
198
|
-
if ENV['AUTOPROJ_DEFAULT_OSDEPS']
|
199
|
-
Autoproj::OSDependencies.load(ENV['AUTOPROJ_DEFAULT_OSDEPS'])
|
200
|
-
else
|
201
|
-
Autoproj::OSDependencies.new(YAML.load(DEFS))
|
202
|
-
end
|
203
|
-
osdeps_management.silent = false
|
204
|
-
Autoproj::PackageManagers::GemManager.gem_home = gem_home
|
205
|
-
Autoproj::PackageManagers::GemManager.use_cache_dir
|
206
|
-
|
207
|
-
begin
|
208
|
-
STDERR.puts "autoproj: installing a proper Ruby environment (this can take a long time)"
|
209
|
-
osdeps_management.install(['ruby'])
|
210
|
-
rescue Autoproj::ConfigError => e
|
211
|
-
STDERR.puts "failed: #{e.message}"
|
212
|
-
exit(1)
|
213
|
-
end
|
214
|
-
|
215
|
-
# Now try to find out the name of the gem binary
|
216
|
-
PACKAGES = ['build-essential', 'sudo']
|
217
|
-
|
218
|
-
STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a long time)"
|
219
|
-
# First install the dependencies of autoproj, as we don't want them to be
|
220
|
-
# affected by the prerelease flag
|
221
|
-
begin
|
222
|
-
if !PACKAGES.empty?
|
223
|
-
osdeps_management.install(PACKAGES)
|
224
|
-
end
|
225
|
-
rescue Autoproj::ConfigError => e
|
226
|
-
STDERR.puts "failed: #{e.message}"
|
227
|
-
exit(1)
|
228
|
-
end
|
229
|
-
|
230
|
-
File.open('env.sh', 'w') do |io|
|
231
|
-
io.write <<-EOSHELL
|
232
|
-
export RUBYOPT=-rubygems
|
233
|
-
export GEM_PATH=#{gem_path}
|
234
|
-
export GEM_HOME=#{gem_home}
|
235
|
-
export PATH=$GEM_HOME/bin:$PATH
|
236
|
-
EOSHELL
|
237
|
-
end
|
238
|
-
|
239
|
-
# If the user specifies "dev" on the command line, install the prerelease
|
240
|
-
# version of autoproj. If it is "localdev", expect him to install autoproj and
|
241
|
-
# run autoproj bootstrap manually.
|
242
|
-
if ARGV.first != "localdev"
|
243
|
-
if ARGV.first == "dev"
|
244
|
-
ENV['AUTOPROJ_USE_PRERELEASE'] = '1'
|
245
|
-
ARGV.shift
|
246
|
-
end
|
247
|
-
|
248
|
-
Autoproj::PackageManagers::GemManager.with_prerelease =
|
249
|
-
(ENV['AUTOPROJ_USE_PRERELEASE'] == '1')
|
250
|
-
begin
|
251
|
-
osdeps_management.install(['autobuild'])
|
252
|
-
osdeps_management.install(['autoproj'])
|
253
|
-
rescue Autoproj::ConfigError => e
|
254
|
-
STDERR.puts "failed: #{e.message}"
|
255
|
-
exit(1)
|
256
|
-
end
|
257
|
-
Autoproj::PackageManagers::GemManager.with_prerelease = false
|
258
|
-
|
259
|
-
if !system('autoproj', 'bootstrap', *ARGV)
|
260
|
-
STDERR.puts "ERROR: failed to run autoproj bootstrap #{ARGV.join(", ")}"
|
261
|
-
exit 1
|
262
|
-
end
|
263
|
-
end
|
8
|
+
AUTOPROJ_OPS_INSTALL
|
264
9
|
|
10
|
+
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
11
|
+
ops.parse_options(ARGV)
|
12
|
+
ops.run
|
@@ -0,0 +1,225 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
|
3
|
+
if RUBY_VERSION < "1.9.2"
|
4
|
+
STDERR.puts "autoproj requires Ruby >= 1.9.2"
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'optparse'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'yaml'
|
11
|
+
|
12
|
+
module Autoproj
|
13
|
+
module Ops
|
14
|
+
# This class contains the functionality necessary to install autoproj in a
|
15
|
+
# clean root
|
16
|
+
#
|
17
|
+
# It can be required standalone (i.e. does not depend on anything else than
|
18
|
+
# ruby and the ruby standard library)
|
19
|
+
class Install
|
20
|
+
# The directory in which to install autoproj
|
21
|
+
attr_reader :root_dir
|
22
|
+
# Content of the Gemfile generated to install autoproj itself
|
23
|
+
attr_accessor :gemfile
|
24
|
+
|
25
|
+
def initialize(root_dir)
|
26
|
+
@root_dir = root_dir
|
27
|
+
@gemfile = default_gemfile_contents
|
28
|
+
@private_bundler = false
|
29
|
+
@private_autoproj = false
|
30
|
+
@private_gems = false
|
31
|
+
end
|
32
|
+
|
33
|
+
def dot_autoproj; File.join(root_dir, '.autoproj') end
|
34
|
+
def bin_dir; File.join(dot_autoproj, 'bin') end
|
35
|
+
def bundler_install_dir; File.join(dot_autoproj, 'bundler') end
|
36
|
+
def autoproj_install_dir; File.join(dot_autoproj, 'autoproj') end
|
37
|
+
# The path to the gemfile used to install autoproj
|
38
|
+
def autoproj_gemfile_path; File.join(autoproj_install_dir, 'Gemfile') end
|
39
|
+
def autoproj_config_path; File.join(dot_autoproj, 'config.yml') end
|
40
|
+
|
41
|
+
# Whether bundler should be installed locally in {#dot_autoproj}
|
42
|
+
def private_bundler?; @private_bundler end
|
43
|
+
# Whether autoproj should be installed locally in {#dot_autoproj}
|
44
|
+
def private_autoproj?; @private_autoproj end
|
45
|
+
# Whether bundler should be installed locally in the workspace
|
46
|
+
# prefix directory
|
47
|
+
def private_gems?; @private_gems end
|
48
|
+
|
49
|
+
def guess_gem_program
|
50
|
+
ruby_bin = RbConfig::CONFIG['RUBY_INSTALL_NAME']
|
51
|
+
ruby_bindir = RbConfig::CONFIG['bindir']
|
52
|
+
|
53
|
+
candidates = ['gem']
|
54
|
+
if ruby_bin =~ /^ruby(.+)$/
|
55
|
+
candidates << "gem#{$1}"
|
56
|
+
end
|
57
|
+
|
58
|
+
candidates.each do |gem_name|
|
59
|
+
if File.file?(gem_full_path = File.join(ruby_bindir, gem_name))
|
60
|
+
return gem_full_path
|
61
|
+
end
|
62
|
+
end
|
63
|
+
raise ArgumentError, "cannot find a gem program (tried #{candidates.sort.join(", ")} in #{ruby_bindir})"
|
64
|
+
end
|
65
|
+
|
66
|
+
# The content of the default {#gemfile}
|
67
|
+
#
|
68
|
+
# @param [String] autoproj_version a constraint on the autoproj version
|
69
|
+
# that should be used
|
70
|
+
# @return [String]
|
71
|
+
def default_gemfile_contents(autoproj_version = ">= 0")
|
72
|
+
["source \"https://rubygems.org\"",
|
73
|
+
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
|
74
|
+
end
|
75
|
+
|
76
|
+
# Parse the provided command line options and returns the non-options
|
77
|
+
def parse_options(args = ARGV)
|
78
|
+
options = OptionParser.new do |opt|
|
79
|
+
opt.on '--private-bundler', 'install bundler locally in the workspace' do
|
80
|
+
@private_bundler = true
|
81
|
+
end
|
82
|
+
opt.on '--private-autoproj', 'install autoproj locally in the workspace' do
|
83
|
+
@private_autoproj = true
|
84
|
+
end
|
85
|
+
opt.on '--private-gems', 'install gems locally in the prefix directory' do
|
86
|
+
@private_gems = true
|
87
|
+
end
|
88
|
+
opt.on '--private', 'whether bundler, autoproj and the workspace gems should be installed locally in the workspace' do
|
89
|
+
@private_bundler = true
|
90
|
+
@private_autoproj = true
|
91
|
+
@private_gems = true
|
92
|
+
end
|
93
|
+
opt.on '--version=VERSION_CONSTRAINT', String, 'use the provided string as a version constraint for autoproj' do |version|
|
94
|
+
@gemfile = default_gemfile_contents(version)
|
95
|
+
end
|
96
|
+
opt.on '--gemfile=PATH', String, 'use the given Gemfile to install autoproj instead of the default' do |path|
|
97
|
+
@gemfile = File.read(path)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
options.parse(ARGV)
|
101
|
+
end
|
102
|
+
|
103
|
+
def install_bundler
|
104
|
+
gem_program = guess_gem_program
|
105
|
+
puts "Detected 'gem' to be #{gem_program}"
|
106
|
+
|
107
|
+
result = system(
|
108
|
+
Hash['GEM_PATH' => nil,
|
109
|
+
'GEM_HOME' => bundler_install_dir],
|
110
|
+
gem_program, 'install', '--no-document', '--no-user-install', '--no-format-executable',
|
111
|
+
"--bindir=#{File.join(bundler_install_dir, 'bin')}", 'bundler')
|
112
|
+
|
113
|
+
if !result
|
114
|
+
STDERR.puts "FATAL: failed to install bundler in #{dot_autoproj}"
|
115
|
+
exit 1
|
116
|
+
end
|
117
|
+
File.join(bin_dir, 'bundler')
|
118
|
+
end
|
119
|
+
|
120
|
+
def save_env_sh
|
121
|
+
env = Autobuild::Environment.new
|
122
|
+
path = []
|
123
|
+
if private_bundler?
|
124
|
+
env.push_path 'PATH', File.join(bundler_install_dir, 'bin')
|
125
|
+
env.push_path 'GEM_PATH', bundler_install_dir
|
126
|
+
end
|
127
|
+
env.push_path 'PATH', File.join(autoproj_install_dir, 'bin')
|
128
|
+
env.inherit 'PATH'
|
129
|
+
if private_autoproj?
|
130
|
+
env.push_path 'GEM_PATH', autoproj_install_dir
|
131
|
+
end
|
132
|
+
|
133
|
+
# Generate environment files right now, we can at least use bundler
|
134
|
+
File.open(File.join(dot_autoproj, 'env.sh'), 'w') do |io|
|
135
|
+
env.export_env_sh(io)
|
136
|
+
end
|
137
|
+
|
138
|
+
File.open(File.join(root_dir, 'env.sh'), 'w') do |io|
|
139
|
+
io.write <<-EOSHELL
|
140
|
+
source "#{File.join(dot_autoproj, 'env.sh')}"
|
141
|
+
export AUTOPROJ_CURRENT_ROOT=#{root_dir}
|
142
|
+
EOSHELL
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def save_gemfile
|
147
|
+
FileUtils.mkdir_p File.dirname(autoproj_gemfile_path)
|
148
|
+
File.open(autoproj_gemfile_path, 'w') do |io|
|
149
|
+
io.write gemfile
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def install_autoproj(bundler)
|
154
|
+
# Force bundler to update. If the user does not want this, let him specify a
|
155
|
+
# Gemfile with tighter version constraints
|
156
|
+
lockfile = File.join(File.dirname(autoproj_gemfile_path), 'Gemfile.lock')
|
157
|
+
if File.exist?(lockfile)
|
158
|
+
FileUtils.rm lockfile
|
159
|
+
end
|
160
|
+
|
161
|
+
env = Hash['BUNDLE_GEMFILE' => nil, 'RUBYLIB' => nil]
|
162
|
+
opts = Array.new
|
163
|
+
|
164
|
+
if private_autoproj?
|
165
|
+
env = Hash['GEM_PATH' => bundler_install_dir,
|
166
|
+
'GEM_HOME' => nil]
|
167
|
+
opts << "--clean" << "--path=#{autoproj_install_dir}"
|
168
|
+
end
|
169
|
+
|
170
|
+
result = system(env,
|
171
|
+
bundler, 'install',
|
172
|
+
"--gemfile=#{autoproj_gemfile_path}",
|
173
|
+
"--binstubs=#{File.join(autoproj_install_dir, 'bin')}",
|
174
|
+
*opts)
|
175
|
+
if !result
|
176
|
+
STDERR.puts "FATAL: failed to install autoproj in #{dot_autoproj}"
|
177
|
+
exit 1
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def update_configuration
|
182
|
+
if File.exist?(autoproj_config_path)
|
183
|
+
config = YAML.load(File.read(autoproj_config_path)) || Hash.new
|
184
|
+
else
|
185
|
+
config = Hash.new
|
186
|
+
end
|
187
|
+
config['private_bundler'] = private_bundler?
|
188
|
+
config['private_autoproj'] = private_autoproj?
|
189
|
+
config['private_gems'] = private_gems?
|
190
|
+
File.open(autoproj_config_path, 'w') do |io|
|
191
|
+
YAML.dump(config, io)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def install
|
196
|
+
if private_bundler?
|
197
|
+
puts "Installing bundler in #{bundler_install_dir}"
|
198
|
+
bundler = install_bundler
|
199
|
+
end
|
200
|
+
save_gemfile
|
201
|
+
puts "Installing autoproj in #{dot_autoproj}"
|
202
|
+
install_autoproj(bundler || 'bundler')
|
203
|
+
end
|
204
|
+
|
205
|
+
# Actually perform the install
|
206
|
+
def run
|
207
|
+
install
|
208
|
+
ENV['BUNDLE_GEMFILE'] = autoproj_gemfile_path
|
209
|
+
require 'bundler'
|
210
|
+
Bundler.setup
|
211
|
+
require 'autobuild'
|
212
|
+
save_env_sh
|
213
|
+
update_configuration
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
ENV.delete('BUNDLE_GEMFILE')
|
222
|
+
ENV.delete('RUBYLIB')
|
223
|
+
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
224
|
+
ops.parse_options(ARGV)
|
225
|
+
ops.run
|