autoproj 2.0.0.b1 → 2.0.0.b2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1e302cab6677a8cb13970ecc83bd4df3b88be03
4
- data.tar.gz: 5e4a7dfe45bbeab8e593c941990d30dd0c78d913
3
+ metadata.gz: c2c8af79b50be1a3374d16bb769a5f8ca0015638
4
+ data.tar.gz: 355d629ec40fca2793098e454aee5a71e745a2f3
5
5
  SHA512:
6
- metadata.gz: f2238a795517a8bfa3261f8e8a2a14a1e1be30d90fbb56469cb6634520a5aed280bb1746c511fe1db7443725142d9f8a1a39a67422432977787dae61b6f02446
7
- data.tar.gz: e02d859e9a811a1bd09bb1ac30e69d0c5ee3425ae28e1f704e938217b53c01bd4042d927ea54b9d24e9a3af0690c89c3d24cbc25cff5df7bff938c63bbf683d7
6
+ metadata.gz: c0c2f5ea2df76ec3ac590a0fd9c4bd7d9b7f48c9c1812b1e371ebb736d533d36fc0a534dd93e1328fea9f6753b30e1eec798ee5280c2ba7f3c1ae5cf4f867bef
7
+ data.tar.gz: 83a685f81470eab8d5be0b4ec400b997568c2d91f83987bf42bf655b75a5c4032b1a688a19e4b3fdee570ce9219adcc8b2087606aa07ec2a1b8d6f60d9d76349
data/Rakefile CHANGED
@@ -20,7 +20,8 @@ Utilrb::Rake.hoe do
20
20
  extra_deps <<
21
21
  ['autobuild', '~> 1.9', '>= 1.9.0'] <<
22
22
  ['utilrb', '~> 2.0', '>= 2.0.0'] <<
23
- ['highline', '~> 1.7', '>= 1.7.0']
23
+ ['highline', '~> 1.7', '>= 1.7.0'] <<
24
+ ['thor', '~> 0.19.0', '>= 0.19.1']
24
25
  end
25
26
  end
26
27
  end
@@ -273,7 +273,6 @@ module Autoproj
273
273
  if doc[-1, 1] != "?"
274
274
  doc = "#{doc}:"
275
275
  end
276
- Autoproj.message " #{doc} #{value}"
277
276
  displayed_options[key] = value
278
277
  end
279
278
  value
@@ -33,7 +33,7 @@ module Autoproj
33
33
  return args, options
34
34
  end
35
35
 
36
- def restart_if_needed
36
+ def restart_if_needed(ws)
37
37
  # Check if the .autoprojrc changed the PATH and therefore which autoproj script
38
38
  # should be executed ... and restart if it did
39
39
  autoproj_path = Autobuild.find_in_path('autoproj')
@@ -71,9 +71,13 @@ module Autoproj
71
71
 
72
72
  def run(buildconf_info, options)
73
73
  ws = Workspace.new(root_dir)
74
+ if config_path = options[:seed_config]
75
+ FileUtils.cp config_path, File.join(ws.config_dir, 'config.yml')
76
+ end
77
+
74
78
  ws.setup
75
79
  install_autoproj_gem_in_new_root(ws)
76
- restart_if_needed
80
+ restart_if_needed(ws)
77
81
 
78
82
  switcher = Ops::MainConfigSwitcher.new(ws)
79
83
  begin
@@ -10,7 +10,7 @@ module Autoproj
10
10
  selected_packages = ['.']
11
11
  end
12
12
 
13
- if !options.has_key?(:deps)
13
+ if options[:deps].nil?
14
14
  options[:deps] =
15
15
  !(options[:rebuild] || options[:force])
16
16
  end
@@ -25,7 +25,13 @@ module Autoproj
25
25
  Autobuild.ignore_errors = options[:keep_going]
26
26
 
27
27
  command_line_selection, source_packages, osdep_packages =
28
- super(selected_packages, options.merge(checkout_only: true))
28
+ super(selected_packages, options.merge(checkout_only: true, apply_post_install: false))
29
+
30
+ # Disable all packages that are not selected
31
+ ws.manifest.each_autobuild_package do |pkg|
32
+ next if source_packages.include?(pkg.name)
33
+ pkg.disable
34
+ end
29
35
 
30
36
  ops = Ops::Build.new(ws.manifest)
31
37
  if build_options[:rebuild] || build_options[:force]
@@ -64,6 +70,7 @@ module Autoproj
64
70
  Autobuild.do_build = true
65
71
  ops.build_packages(source_packages)
66
72
  Autobuild.apply(source_packages, "autoproj-build", ['install'])
73
+ ws.apply_post_install
67
74
  end
68
75
  end
69
76
  end
@@ -18,12 +18,14 @@ module Autoproj
18
18
 
19
19
  def run(cache_dir, options = Hash.new)
20
20
  options = Kernel.validate_options options,
21
- keep_going: false
21
+ keep_going: false,
22
+ checkout_only: false
22
23
 
23
24
  initialize_and_load
25
+ finalize_setup
24
26
 
25
27
  cache_op = Autoproj::Ops::Cache.new(cache_dir, ws.manifest)
26
- cache_op.create_or_update(options[:keep_going])
28
+ cache_op.create_or_update(options)
27
29
  end
28
30
  end
29
31
  end
@@ -14,7 +14,7 @@ module Autoproj
14
14
 
15
15
  options = Kernel.validate_options options,
16
16
  shell_helpers: ws.config.shell_helpers?
17
- ws.env.export_env_sh(shell_helpers: options[:shell_helpers])
17
+ ws.export_env_sh(shell_helpers: options[:shell_helpers])
18
18
  end
19
19
  end
20
20
  end
@@ -48,6 +48,7 @@ module Autoproj
48
48
  source_packages, osdep_packages, resolved_selection =
49
49
  resolve_selection(ws.manifest, packages, options)
50
50
  ws.finalize_setup
51
+ ws.apply_post_install
51
52
  ws.export_installation_manifest
52
53
  return source_packages, osdep_packages, resolved_selection, config_selected
53
54
  end
@@ -11,6 +11,7 @@ module Autoproj
11
11
 
12
12
  def initialize(ws = nil)
13
13
  super
14
+ self.ws.load_config
14
15
 
15
16
  @installation_manifest = Autoproj::InstallationManifest.new(self.ws.root_dir)
16
17
  if !File.file?(installation_manifest.default_manifest_path)
@@ -24,22 +25,41 @@ module Autoproj
24
25
  return selected.first, options
25
26
  end
26
27
 
28
+ def result_value(pkg, options)
29
+ if options[:build]
30
+ if pkg.builddir
31
+ pkg.builddir
32
+ else
33
+ raise ConfigError, "#{pkg.name} does not have a build directory"
34
+ end
35
+ else
36
+ pkg.srcdir
37
+ end
38
+ end
39
+
27
40
  def run(selection, options = Hash.new)
28
41
  if !selection
29
- puts ws.root_dir
42
+ if options[:build]
43
+ puts ws.prefix_dir
44
+ else
45
+ puts ws.root_dir
46
+ end
30
47
  return
31
48
  end
32
49
 
50
+ if File.directory?(selection)
51
+ selection = File.expand_path(selection)
52
+ end
53
+
33
54
  selection_rx = Regexp.new(Regexp.quote(selection))
34
55
  candidates = []
35
56
  installation_manifest.each do |pkg|
36
57
  name = pkg.name
37
- srcdir = pkg.srcdir
38
- if name == selection
39
- puts srcdir
58
+ if name == selection || pkg.srcdir == selection
59
+ puts result_value(pkg, options)
40
60
  return
41
61
  elsif name =~ selection_rx
42
- candidates << srcdir
62
+ candidates << pkg
43
63
  end
44
64
  end
45
65
 
@@ -59,12 +79,11 @@ module Autoproj
59
79
  candidates_strict = []
60
80
  installation_manifest.each do |pkg|
61
81
  name = pkg.name
62
- srcdir = pkg.srcdir
63
82
  if name =~ rx
64
- candidates << srcdir
83
+ candidates << pkg
65
84
  end
66
85
  if name =~ rx_strict
67
- candidates_strict << srcdir
86
+ candidates_strict << pkg
68
87
  end
69
88
  end
70
89
 
@@ -76,7 +95,7 @@ module Autoproj
76
95
  if candidates.size > 1
77
96
  # If there is more than one candidate, check if there are some that are not
78
97
  # present on disk
79
- present = candidates.find_all { |dir| File.directory?(dir) }
98
+ present = candidates.find_all { |pkg| File.directory?(pkg.srcdir) }
80
99
  if present.size == 1
81
100
  candidates = present
82
101
  end
@@ -87,7 +106,7 @@ module Autoproj
87
106
  elsif candidates.size > 1
88
107
  raise ArgumentError, "multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}"
89
108
  else
90
- puts candidates.first
109
+ puts result_value(candidates.first, options)
91
110
  end
92
111
  end
93
112
  end
@@ -41,6 +41,9 @@ module Autoproj
41
41
  option :reuse,
42
42
  banner: 'DIR',
43
43
  desc: 'reuse packages already built within the DIR autoproj workspace in this installation, if DIR is not given, reuses the installation whose env.sh is currently sourced'
44
+ option :seed_config,
45
+ banner: 'SEED_CONFIG',
46
+ desc: "a configuration file used to seed the bootstrap's configuration"
44
47
  def bootstrap(*args)
45
48
  run_autoproj_cli(:bootstrap, :Bootstrap, Hash[], *args)
46
49
  end
@@ -116,6 +119,8 @@ module Autoproj
116
119
  desc 'cache CACHE_DIR', 'create or update a cache directory that can be given to AUTOBUILD_CACHE_DIR'
117
120
  option :keep_going, aliases: :k,
118
121
  desc: 'do not stop on errors'
122
+ option :checkout_only, aliases: :c, type: :boolean, default: false,
123
+ desc: "only checkout packages, do not update already-cached ones"
119
124
  def cache(cache_dir)
120
125
  run_autoproj_cli(:cache, :Cache, Hash[], cache_dir)
121
126
  end
@@ -128,6 +133,8 @@ module Autoproj
128
133
  end
129
134
 
130
135
  desc 'locate [PACKAGE]', 'return the path to the given package, or the path to the root if no packages are given on the command line'
136
+ option :build, aliases: :b, type: :boolean,
137
+ desc: "outputs the package's build directory instead of its source directory"
131
138
  def locate(package = nil)
132
139
  run_autoproj_cli(:locate, :Locate, Hash[], *Array(package))
133
140
  end
@@ -32,12 +32,15 @@ module Autoproj
32
32
  selected_packages, config_selected =
33
33
  normalize_command_line_package_selection(selected_packages)
34
34
 
35
+ if options[:apply_post_install].nil?
36
+ options[:apply_post_install] = true
37
+ end
38
+
35
39
  if options[:config].nil?
36
40
  options[:config] = selected_packages.empty? || config_selected
37
41
  end
38
42
 
39
43
  ws.setup
40
- ws.install_ruby_shims
41
44
 
42
45
  # Do that AFTER we have properly setup ws.osdeps as to avoid
43
46
  # unnecessarily redetecting the operating system
@@ -112,15 +115,17 @@ module Autoproj
112
115
  ignore_errors: options[:keep_going])
113
116
 
114
117
  ws.finalize_setup
115
- load_all_available_package_manifests
118
+ if options[:apply_post_install]
119
+ ws.apply_post_install
120
+ end
116
121
  ws.export_installation_manifest
117
122
 
118
123
  if options[:osdeps] && !osdep_packages.empty?
119
124
  ws.osdeps.install(osdep_packages, osdeps_options)
120
125
  end
121
126
 
122
- ws.env.export_env_sh
123
- Autoproj.message "autoproj: updated #{ws.root_dir}/#{Autoproj::ENV_FILENAME}", :green
127
+ ws.export_env_sh(source_packages)
128
+ Autoproj.message " updated #{ws.root_dir}/#{Autoproj::ENV_FILENAME}", :green
124
129
 
125
130
  return command_line_selection, source_packages, osdep_packages
126
131
  end
@@ -14,7 +14,7 @@ module Autoproj
14
14
 
15
15
  def validate_options(packages, options = Hash.new)
16
16
  packages, options = super
17
- if options.has_key?(:save)
17
+ if options[:save].nil?
18
18
  options[:save] = case options[:save]
19
19
  when '.'
20
20
  nil
@@ -77,7 +77,6 @@ module Autoproj
77
77
  if doc[-1, 1] != "?"
78
78
  doc = "#{doc}:"
79
79
  end
80
- Autoproj.message " #{doc} #{value}"
81
80
  displayed_options[key] = value
82
81
  end
83
82
  value
@@ -1,7 +1,7 @@
1
1
  module Autoproj
2
2
  # Manifest of installed packages imported from another autoproj installation
3
3
  class InstallationManifest
4
- Package = Struct.new :name, :srcdir, :prefix
4
+ Package = Struct.new :name, :srcdir, :prefix, :builddir, :dependencies
5
5
 
6
6
  DEFAULT_MANIFEST_NAME = ".autoproj-installation-manifest"
7
7
 
@@ -9,15 +9,59 @@ module Autoproj
9
9
  attr_reader :packages
10
10
  def initialize(path)
11
11
  @path = path
12
+ @packages = Hash.new
12
13
  end
13
14
 
14
15
  def default_manifest_path
15
16
  File.join(path, DEFAULT_MANIFEST_NAME)
16
17
  end
18
+
19
+ def exist?
20
+ File.exist?(default_manifest_path)
21
+ end
22
+
23
+ def [](name)
24
+ packages[name]
25
+ end
26
+
27
+ def []=(name, pkg)
28
+ packages[name] = pkg
29
+ end
30
+
31
+ def delete_if
32
+ packages.delete_if { |_, pkg| yield(pkg) }
33
+ end
17
34
 
18
35
  def load(path = default_manifest_path)
19
- @packages = CSV.read(path).map do |row|
20
- Package.new(*row)
36
+ @packages = Hash.new
37
+ raw = YAML.load(File.open(path))
38
+ if raw.respond_to?(:to_str) # old CSV-based format
39
+ CSV.read(path).map do |row|
40
+ name, srcdir, prefix, builddir = *row
41
+ builddir = nil if builddir && builddir.empty?
42
+ packages[name] = Package.new(name, srcdir, prefix, builddir, [])
43
+ end
44
+ save(path)
45
+ else
46
+ raw.each do |entry|
47
+ pkg = Package.new(
48
+ entry['name'], entry['srcdir'], entry['prefix'],
49
+ entry['builddir'], entry['dependencies'])
50
+ packages[pkg.name] = pkg
51
+ end
52
+ end
53
+ end
54
+
55
+ def save(path = default_manifest_path)
56
+ File.open(path, 'w') do |io|
57
+ marshalled_packages = packages.values.map do |v|
58
+ Hash['name' => v.name,
59
+ 'srcdir' => v.srcdir,
60
+ 'builddir' => (v.builddir if v.respond_to?(:builddir)),
61
+ 'prefix' => v.prefix,
62
+ 'dependencies' => v.dependencies]
63
+ end
64
+ YAML.dump(marshalled_packages, io)
21
65
  end
22
66
  end
23
67
 
@@ -26,17 +70,17 @@ module Autoproj
26
70
  end
27
71
 
28
72
  def [](name)
29
- packages.find { |pkg| pkg.name == name }
73
+ packages.each_value.find { |pkg| pkg.name == name }
30
74
  end
31
75
 
32
76
  def self.from_root(root_dir)
33
77
  manifest = InstallationManifest.new(root_dir)
34
- manifest_file = File.join(root_dir, ".autoproj-installation-manifest")
35
- if !File.file?(manifest_file)
36
- raise ConfigError.new, "no .autoproj-installation-manifest file exists in #{root_dir}. You should probably rerun autoproj envsh in that folder first"
78
+ if !manifest.exist?
79
+ raise ConfigError.new, "no #{DEFAULT_MANIFEST_NAME} file exists in #{root_dir}. You should probably rerun autoproj envsh in that folder first"
37
80
  end
38
- manifest.load(manifest_file)
81
+ manifest.load
39
82
  manifest
40
83
  end
41
84
  end
42
85
  end
86
+
@@ -27,8 +27,12 @@ module Autoproj
27
27
  File.join(cache_dir, 'git')
28
28
  end
29
29
 
30
- def cache_git(pkg)
30
+ def cache_git(pkg, options = Hash.new)
31
31
  pkg.importdir = File.join(git_cache_dir, pkg.name)
32
+ if options[:checkout_only] && File.directory?(pkg.importdir)
33
+ return
34
+ end
35
+
32
36
  pkg.importer.local_branch = nil
33
37
  pkg.importer.remote_branch = nil
34
38
  pkg.importer.remote_name = 'autobuild'
@@ -56,7 +60,13 @@ module Autoproj
56
60
  end
57
61
  end
58
62
 
59
- def create_or_update(keep_going = false)
63
+ def create_or_update(options = Hash.new)
64
+ options = Kernel.validate_options options,
65
+ keep_going: false,
66
+ checkout_only: false
67
+ keep_going = options[:keep_going]
68
+ checkout_only = options[:checkout_only]
69
+
60
70
  FileUtils.mkdir_p cache_dir
61
71
 
62
72
  packages = manifest.each_autobuild_package.
@@ -64,11 +74,12 @@ module Autoproj
64
74
  total = packages.size
65
75
  Autoproj.message "Handling #{total} packages"
66
76
  packages.each_with_index do |pkg, i|
77
+ next if pkg.srcdir != pkg.importdir # No need to process this one, it is uses another package's import
67
78
  begin
68
79
  case pkg.importer
69
80
  when Autobuild::Git
70
81
  Autoproj.message " [#{i}/#{total}] caching #{pkg.name} (git)"
71
- cache_git(pkg)
82
+ cache_git(pkg, checkout_only: checkout_only)
72
83
  when Autobuild::ArchiveImporter
73
84
  Autoproj.message " [#{i}/#{total}] caching #{pkg.name} (archive)"
74
85
  cache_archive(pkg)
@@ -62,22 +62,19 @@ module Autoproj
62
62
  end
63
63
  new_packages
64
64
  end
65
-
66
- def import_packages(selection, options = Hash.new)
65
+
66
+ # Import all packages from the given selection, and their
67
+ # dependencies
68
+ def import_selected_packages(selection, updated_packages, options = Hash.new)
67
69
  options, import_options = Kernel.filter_options options,
68
- warn_about_ignored_packages: true,
69
- warn_about_excluded_packages: true,
70
70
  recursive: true
71
71
 
72
72
  manifest = ws.manifest
73
73
 
74
- updated_packages = Array.new
75
74
  selected_packages = selection.each_source_package_name.map do |pkg_name|
76
75
  manifest.find_autobuild_package(pkg_name)
77
76
  end.to_set
78
77
 
79
- # The set of all packages that are currently selected by +selection+
80
- all_processed_packages = Set.new
81
78
  # The reverse dependencies for the package tree. It is discovered as
82
79
  # we go on with the import
83
80
  #
@@ -86,6 +83,8 @@ module Autoproj
86
83
  # package exclusion (and that does not affect optional dependencies)
87
84
  reverse_dependencies = Hash.new { |h, k| h[k] = Set.new }
88
85
 
86
+ # The set of all packages that are currently selected by +selection+
87
+ all_processed_packages = Set.new
89
88
  package_queue = selected_packages.to_a.sort_by(&:name)
90
89
  while !package_queue.empty?
91
90
  pkg = package_queue.shift
@@ -137,34 +136,41 @@ module Autoproj
137
136
  Autoproj.each_post_import_block(pkg) do |block|
138
137
  block.call(pkg)
139
138
  end
140
- pkg.update_environment
141
139
 
142
140
  new_packages = import_next_step(pkg, reverse_dependencies)
143
141
 
144
142
  # Excluded dependencies might have caused the package to be
145
143
  # excluded as well ... do not add any dependency to the
146
144
  # processing queue if it is the case
147
- if !manifest.excluded?(pkg.name) && options[:recursive]
145
+ if manifest.excluded?(pkg.name)
146
+ selection.filter_excluded_and_ignored_packages(manifest)
147
+ elsif options[:recursive]
148
148
  package_queue.concat(new_packages.sort_by(&:name))
149
149
  end
150
-
151
- # Verify that everything is still OK with the new
152
- # exclusions/ignores
153
- selection.filter_excluded_and_ignored_packages(manifest)
154
150
  end
151
+ all_processed_packages
152
+ end
153
+
154
+ def finalize_package_load(processed_packages)
155
+ manifest = ws.manifest
155
156
 
156
- # Now run optional dependency resolution. This is done now, as
157
- # some optional dependencies might have been excluded during the
158
- # resolution process above
159
- all_enabled_sources, all_enabled_osdeps =
160
- Set.new, selection.each_osdep_package_name.to_set
161
- package_queue = selection.each_source_package_name.to_a
157
+ all = Set.new
158
+ package_queue = manifest.all_layout_packages(false).each_source_package_name.to_a
162
159
  while !package_queue.empty?
163
160
  pkg_name = package_queue.shift
164
- next if all_enabled_sources.include?(pkg_name)
165
- all_enabled_sources << pkg_name
161
+ next if all.include?(pkg_name)
162
+ all << pkg_name
163
+
164
+ next if manifest.ignored?(pkg_name) || manifest.excluded?(pkg_name)
166
165
 
167
166
  pkg = manifest.find_autobuild_package(pkg_name)
167
+ if !processed_packages.include?(pkg.name)
168
+ manifest.load_package_manifest(pkg.name)
169
+ Autoproj.each_post_import_block(pkg) do |block|
170
+ block.call(pkg)
171
+ end
172
+ end
173
+
168
174
  packages, osdeps = pkg.partition_optional_dependencies
169
175
  packages.each do |pkg_name|
170
176
  if !manifest.ignored?(pkg_name) && !manifest.excluded?(pkg_name)
@@ -172,19 +178,29 @@ module Autoproj
172
178
  end
173
179
  end
174
180
  pkg.os_packages.merge(osdeps)
175
- all_enabled_osdeps |= pkg.os_packages
176
-
177
- pkg.prepare if !pkg.disabled?
181
+ pkg.prepare
178
182
  Rake::Task["#{pkg.name}-prepare"].instance_variable_set(:@already_invoked, true)
179
-
180
- if options[:recursive]
181
- package_queue.concat(pkg.dependencies)
182
- end
183
+ pkg.update_environment
184
+ package_queue.concat(pkg.dependencies)
183
185
  end
186
+ all
187
+ end
184
188
 
185
- if Autoproj.verbose
186
- Autoproj.message "autoproj: finished importing packages"
187
- end
189
+ def import_packages(selection, options = Hash.new)
190
+ options, import_options = Kernel.filter_options options,
191
+ warn_about_ignored_packages: true,
192
+ warn_about_excluded_packages: true,
193
+ recursive: true
194
+
195
+ manifest = ws.manifest
196
+
197
+ updated_packages = Array.new
198
+ all_processed_packages = import_selected_packages(
199
+ selection, updated_packages, import_options.merge(recursive: options[:recursive]))
200
+ finalize_package_load(all_processed_packages)
201
+
202
+ all_enabled_osdeps = selection.each_osdep_package_name.to_set
203
+ all_enabled_sources = all_processed_packages
188
204
 
189
205
  if options[:warn_about_excluded_packages]
190
206
  selection.exclusions.each do |sel, pkg_names|
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.0.0.b1"
2
+ VERSION = "2.0.0.b2"
3
3
  end
@@ -173,6 +173,8 @@ module Autoproj
173
173
  Autoproj::OSDependencies.define_osdeps_mode_option(config)
174
174
  osdeps.load_default
175
175
  osdeps.osdeps_mode
176
+
177
+ install_ruby_shims
176
178
  end
177
179
 
178
180
  def install_ruby_shims
@@ -220,7 +222,7 @@ module Autoproj
220
222
  did_update =
221
223
  begin
222
224
  saved_flag = PackageManagers::GemManager.with_prerelease
223
- PackageManagers::GemManager.with_prerelease = Autoproj.config.use_prerelease?
225
+ PackageManagers::GemManager.with_prerelease = config.use_prerelease?
224
226
  osdeps.install(%w{autobuild autoproj})
225
227
  ensure
226
228
  PackageManagers::GemManager.with_prerelease = saved_flag
@@ -346,7 +348,7 @@ module Autoproj
346
348
  next if manifest.has_package_set?(pkg_or_set)
347
349
 
348
350
  # This is not known. Check if we can auto-add it
349
- full_path = File.expand_path(File.join(Autoproj.root_dir, layout_level, pkg_or_set))
351
+ full_path = File.expand_path(File.join(root_dir, layout_level, pkg_or_set))
350
352
  next if !File.directory?(full_path)
351
353
 
352
354
  handler, srcdir = Autoproj.package_handler_for(full_path)
@@ -446,19 +448,23 @@ module Autoproj
446
448
  pkg = manifest.find_autobuild_package(pkg_name)
447
449
  pkg.srcdir = File.join(root_dir, srcdir)
448
450
  if pkg.respond_to?(:builddir)
449
- # If we're given an absolute build dir, we have to append the
450
- # package name to it to make it unique
451
- if Pathname.new(build_dir).absolute?
452
- pkg.builddir = File.join(build_dir, pkg_name)
453
- else
454
- pkg.builddir = build_dir
455
- end
451
+ pkg.builddir = compute_builddir(pkg)
456
452
  end
457
453
 
458
454
  pkg.prefix = File.join(prefix_dir, prefixdir)
459
455
  pkg.doc_target_dir = File.join(prefix_dir, 'doc', pkg_name)
460
456
  pkg.logdir = File.join(pkg.prefix, "log")
461
457
  end
458
+
459
+ def compute_builddir(pkg)
460
+ # If we're given an absolute build dir, we have to append the
461
+ # package name to it to make it unique
462
+ if Pathname.new(build_dir).absolute?
463
+ File.join(build_dir, pkg.name)
464
+ else
465
+ build_dir
466
+ end
467
+ end
462
468
 
463
469
  # Finalizes the configuration loading
464
470
  #
@@ -479,7 +485,7 @@ module Autoproj
479
485
  load_if_present(source, source.local_dir, "overrides.rb")
480
486
  end
481
487
 
482
- Dir.glob(File.join( Autoproj.overrides_dir, "*.rb" ) ).sort.each do |file|
488
+ Dir.glob(File.join( overrides_dir, "*.rb" ) ).sort.each do |file|
483
489
  load file
484
490
  end
485
491
  end
@@ -499,37 +505,54 @@ module Autoproj
499
505
  end
500
506
  end
501
507
 
502
- setup_environment_from_packages
503
-
504
508
  # We now have processed the process setup blocks. All configuration
505
509
  # should be done and we can save the configuration data.
506
510
  config.save
507
511
  end
508
512
 
509
- def setup_environment_from_packages
510
- set_as_main_workspace
511
- manifest.reused_installations.each do |reused_manifest|
512
- reused_manifest.each do |pkg|
513
- # The reused installations might have packages we do not
514
- # know about, just ignore them
515
- if pkg = manifest.find_autobuild_package(pkg)
516
- pkg.update_environment
517
- end
518
- end
513
+ def all_present_packages
514
+ manifest.each_autobuild_package.
515
+ find_all { |pkg| File.directory?(pkg.srcdir) }.
516
+ map(&:name)
517
+ end
518
+
519
+ def export_installation_manifest(package_names = all_present_packages)
520
+ install_manifest = InstallationManifest.new(root_dir)
521
+ if install_manifest.exist?
522
+ install_manifest.load
523
+ end
524
+ # Delete obsolete entries
525
+ install_manifest.delete_if do |pkg|
526
+ !manifest.find_autobuild_package(pkg.name) ||
527
+ !File.directory?(pkg.srcdir)
519
528
  end
529
+ # Update the new entries
530
+ package_names.each do |pkg_name|
531
+ install_manifest[pkg_name] =
532
+ manifest.find_autobuild_package(pkg_name)
533
+ end
534
+ # And save
535
+ install_manifest.save
536
+ end
520
537
 
521
- # Make sure that we have the environment of all selected packages
522
- manifest.all_selected_packages(false).each do |pkg_name|
523
- manifest.find_autobuild_package(pkg_name).update_environment
538
+ def export_env_sh(package_names = all_present_packages, shell_helpers: true)
539
+ env = self.env.dup
540
+ manifest.all_selected_packages.each do |pkg_name|
541
+ pkg = manifest.find_autobuild_package(pkg_name)
542
+ if File.directory?(pkg.srcdir) && !pkg.applied_post_install?
543
+ pkg.apply_post_install
544
+ end
545
+
546
+ pkg.apply_env(env)
524
547
  end
548
+ env.export_env_sh(shell_helpers: shell_helpers)
525
549
  end
526
550
 
527
- def export_installation_manifest
528
- File.open(File.join(root_dir, ".autoproj-installation-manifest"), 'w') do |io|
529
- manifest.all_selected_packages(false).each do |pkg_name|
530
- if pkg = manifest.find_autobuild_package(pkg_name)
531
- io.puts "#{pkg_name},#{pkg.srcdir},#{pkg.prefix}"
532
- end
551
+ def apply_post_install
552
+ manifest.all_selected_packages.each do |pkg_name|
553
+ pkg = manifest.find_autobuild_package(pkg_name)
554
+ if File.directory?(pkg.srcdir) && !pkg.applied_post_install?
555
+ pkg.apply_post_install
533
556
  end
534
557
  end
535
558
  end
data/shell/autoproj_sh CHANGED
@@ -1,6 +1,6 @@
1
1
  acd() {
2
2
  local pkg_path
3
- pkg_path=$(autoproj locate $1)
3
+ pkg_path=$(autoproj locate "$@")
4
4
 
5
5
  if [ $? != 0 ]; then
6
6
  return 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.b1
4
+ version: 2.0.0.b2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rock Core Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autobuild
@@ -70,6 +70,26 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 1.7.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: thor
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: 0.19.0
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.19.1
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.19.0
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.19.1
73
93
  - !ruby/object:Gem::Dependency
74
94
  name: rdoc
75
95
  requirement: !ruby/object:Gem::Requirement