autoproj 2.0.0.rc37 → 2.0.0.rc38
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/.travis.yml +4 -2
- data/Rakefile +1 -1
- data/bin/autoproj_bootstrap +34 -2
- data/bin/autoproj_bootstrap.in +4 -2
- data/bin/autoproj_install +34 -2
- data/bin/autoproj_install.in +4 -2
- data/lib/autoproj.rb +9 -2
- data/lib/autoproj/autobuild.rb +13 -742
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +44 -0
- data/lib/autoproj/autobuild_extensions/dsl.rb +439 -0
- data/lib/autoproj/autobuild_extensions/git.rb +116 -0
- data/lib/autoproj/autobuild_extensions/package.rb +159 -0
- data/lib/autoproj/autobuild_extensions/svn.rb +11 -0
- data/lib/autoproj/cli/base.rb +17 -18
- data/lib/autoproj/cli/clean.rb +1 -2
- data/lib/autoproj/cli/envsh.rb +1 -2
- data/lib/autoproj/cli/inspection_tool.rb +12 -21
- data/lib/autoproj/cli/locate.rb +130 -73
- data/lib/autoproj/cli/main.rb +31 -5
- data/lib/autoproj/cli/main_plugin.rb +79 -0
- data/lib/autoproj/cli/main_test.rb +19 -5
- data/lib/autoproj/cli/osdeps.rb +1 -2
- data/lib/autoproj/cli/patcher.rb +21 -0
- data/lib/autoproj/cli/query.rb +34 -41
- data/lib/autoproj/cli/show.rb +121 -52
- data/lib/autoproj/cli/status.rb +4 -5
- data/lib/autoproj/cli/tag.rb +1 -1
- data/lib/autoproj/cli/test.rb +7 -6
- data/lib/autoproj/cli/update.rb +8 -22
- data/lib/autoproj/cli/versions.rb +1 -2
- data/lib/autoproj/configuration.rb +1 -1
- data/lib/autoproj/environment.rb +2 -7
- data/lib/autoproj/exceptions.rb +10 -8
- data/lib/autoproj/find_workspace.rb +46 -12
- data/lib/autoproj/installation_manifest.rb +34 -25
- data/lib/autoproj/local_package_set.rb +86 -0
- data/lib/autoproj/manifest.rb +448 -503
- data/lib/autoproj/metapackage.rb +31 -5
- data/lib/autoproj/ops/configuration.rb +46 -45
- data/lib/autoproj/ops/import.rb +150 -60
- data/lib/autoproj/ops/install.rb +25 -1
- data/lib/autoproj/ops/loader.rb +4 -1
- data/lib/autoproj/ops/main_config_switcher.rb +4 -4
- data/lib/autoproj/ops/snapshot.rb +4 -3
- data/lib/autoproj/os_package_installer.rb +105 -46
- data/lib/autoproj/os_package_resolver.rb +63 -36
- data/lib/autoproj/package_definition.rb +1 -0
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +30 -27
- data/lib/autoproj/package_managers/bundler_manager.rb +64 -18
- data/lib/autoproj/package_managers/gem_manager.rb +4 -2
- data/lib/autoproj/package_managers/manager.rb +26 -7
- data/lib/autoproj/package_managers/shell_script_manager.rb +4 -4
- data/lib/autoproj/package_managers/zypper_manager.rb +1 -1
- data/lib/autoproj/package_manifest.rb +154 -137
- data/lib/autoproj/package_selection.rb +16 -2
- data/lib/autoproj/package_set.rb +352 -309
- data/lib/autoproj/query.rb +13 -1
- data/lib/autoproj/system.rb +2 -2
- data/lib/autoproj/test.rb +164 -11
- data/lib/autoproj/variable_expansion.rb +15 -42
- data/lib/autoproj/vcs_definition.rb +93 -76
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +116 -80
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b53d93cd01cc0b8c5e434458cb24c73edfd49c9
|
4
|
+
data.tar.gz: a1d11757027126a5fbb843bf96f040b3d54f5964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab152231c4aa64cb65edcc79ffb0bf17493b3e538bb6197218b04c6436c8ea5990155e9173f2b03354b69b96567177bbdc2a4613d0e652003ecfd91ba4bc1bc4
|
7
|
+
data.tar.gz: 7fd86ca99c09b5445af96e027abe5a01fab4aaaec6fc678241f7dae7b1d9fe318d22f6474db539d7f3cd521a2e94fae844fc4b9473055d2d127d1033b203d18c
|
data/.travis.yml
CHANGED
@@ -12,8 +12,10 @@ matrix:
|
|
12
12
|
|
13
13
|
cache: bundler
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
install:
|
16
|
+
- gem install bundler
|
17
|
+
# Some tests expect gems to be present in vendor/bundle
|
18
|
+
- bundler install --path vendor/bundle
|
17
19
|
script:
|
18
20
|
- bundler exec rake
|
19
21
|
- bundler exec rake test
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ task 'bootstrap' do
|
|
19
19
|
|
20
20
|
%w{bootstrap install}.each do |install_script|
|
21
21
|
bootstrap_code = File.read(File.join(Dir.pwd, 'bin', "autoproj_#{install_script}.in")).
|
22
|
-
gsub('
|
22
|
+
gsub("require 'autoproj/ops/install'", autoproj_ops_install)
|
23
23
|
File.open(File.join(Dir.pwd, 'bin', "autoproj_#{install_script}"), 'w') do |io|
|
24
24
|
io.write bootstrap_code
|
25
25
|
end
|
data/bin/autoproj_bootstrap
CHANGED
@@ -43,6 +43,7 @@ module Autoproj
|
|
43
43
|
@root_dir = root_dir
|
44
44
|
@gem_source = "https://rubygems.org"
|
45
45
|
@gemfile = nil
|
46
|
+
@skip_stage2 = false
|
46
47
|
|
47
48
|
@autoproj_options = Array.new
|
48
49
|
|
@@ -113,6 +114,11 @@ module Autoproj
|
|
113
114
|
# @return [String]
|
114
115
|
def autoproj_config_path; File.join(dot_autoproj, 'config.yml') end
|
115
116
|
|
117
|
+
# Whether the stage2 install should be called or not
|
118
|
+
def skip_stage2?; !!@skip_stage2 end
|
119
|
+
# (see #skip_stage2?)
|
120
|
+
def skip_stage2=(flag); @skip_stage2 = flag end
|
121
|
+
|
116
122
|
# Whether we can access the network while installing
|
117
123
|
def local?; !!@local end
|
118
124
|
# (see #local?)
|
@@ -196,6 +202,9 @@ module Autoproj
|
|
196
202
|
opt.on '--local', 'do not access the network (may fail)' do
|
197
203
|
@local = true
|
198
204
|
end
|
205
|
+
opt.on '--skip-stage2', 'do not run the stage2 install' do
|
206
|
+
@skip_stage2 = true
|
207
|
+
end
|
199
208
|
opt.on '--gem-source=URL', String, "use this source for RubyGems instead of rubygems.org" do |url|
|
200
209
|
@gem_source = url
|
201
210
|
end
|
@@ -303,6 +312,8 @@ module Autoproj
|
|
303
312
|
self.class.rewrite_shims(shims_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
|
304
313
|
end
|
305
314
|
|
315
|
+
EXCLUDED_FROM_SHIMS = %w{rake thor}
|
316
|
+
|
306
317
|
def self.rewrite_shims(shim_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
|
307
318
|
FileUtils.mkdir_p shim_path
|
308
319
|
File.open(File.join(shim_path, 'ruby'), 'w') do |io|
|
@@ -316,6 +327,10 @@ module Autoproj
|
|
316
327
|
Dir.glob(File.join(shim_path, '*')) do |bin_script|
|
317
328
|
next if !File.file?(bin_script)
|
318
329
|
bin_name = File.basename(bin_script)
|
330
|
+
if EXCLUDED_FROM_SHIMS.include?(bin_name)
|
331
|
+
FileUtils.rm_f bin_script
|
332
|
+
next
|
333
|
+
end
|
319
334
|
next if bin_name == 'ruby'
|
320
335
|
|
321
336
|
bin_shim = File.join(shim_path, bin_name)
|
@@ -341,6 +356,7 @@ if defined?(Bundler)
|
|
341
356
|
end
|
342
357
|
end
|
343
358
|
|
359
|
+
ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
|
344
360
|
ENV['GEM_HOME'] = '#{gems_gem_home}'
|
345
361
|
ENV.delete('GEM_PATH')
|
346
362
|
Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
|
@@ -353,8 +369,10 @@ load Gem.bin_path('bundler', 'bundler')"
|
|
353
369
|
|
354
370
|
if defined?(Bundler)
|
355
371
|
Bundler.with_clean_env do
|
356
|
-
exec($0, *ARGV)
|
372
|
+
exec(Hash['RUBYLIB' => nil], $0, *ARGV)
|
357
373
|
end
|
374
|
+
elsif ENV['RUBYLIB']
|
375
|
+
exec(Hash['RUBYLIB' => nil], $0, *ARGV)
|
358
376
|
end
|
359
377
|
|
360
378
|
ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
|
@@ -401,6 +419,18 @@ require 'bundler/setup'
|
|
401
419
|
default_gemfile_contents
|
402
420
|
end
|
403
421
|
|
422
|
+
gemfile += [
|
423
|
+
"",
|
424
|
+
"config_path = File.join(__dir__, 'config.yml')",
|
425
|
+
"if File.file?(config_path)",
|
426
|
+
" require 'yaml'",
|
427
|
+
" config = YAML.load(File.read(config_path))",
|
428
|
+
" (config['plugins'] || Hash.new).each do |plugin_name, (version, options)|",
|
429
|
+
" gem plugin_name, version, **options",
|
430
|
+
" end",
|
431
|
+
"end"
|
432
|
+
].join("\n")
|
433
|
+
|
404
434
|
FileUtils.mkdir_p File.dirname(autoproj_gemfile_path)
|
405
435
|
File.open(autoproj_gemfile_path, 'w') do |io|
|
406
436
|
io.write gemfile
|
@@ -567,6 +597,8 @@ ENV.delete('RUBYLIB')
|
|
567
597
|
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
568
598
|
bootstrap_options = ops.parse_options(ARGV)
|
569
599
|
ops.stage1
|
570
|
-
ops.
|
600
|
+
if !ops.skip_stage2?
|
601
|
+
ops.call_stage2
|
602
|
+
end
|
571
603
|
ops.run_autoproj 'bootstrap', *bootstrap_options
|
572
604
|
|
data/bin/autoproj_bootstrap.in
CHANGED
@@ -8,13 +8,15 @@ elsif ENV['AUTOPROJ_CURRENT_ROOT'] && (ENV['AUTOPROJ_CURRENT_ROOT'] != Dir.pwd)
|
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
require 'autoproj/ops/install'
|
12
12
|
|
13
13
|
ENV.delete('BUNDLE_GEMFILE')
|
14
14
|
ENV.delete('RUBYLIB')
|
15
15
|
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
16
16
|
bootstrap_options = ops.parse_options(ARGV)
|
17
17
|
ops.stage1
|
18
|
-
ops.
|
18
|
+
if !ops.skip_stage2?
|
19
|
+
ops.call_stage2
|
20
|
+
end
|
19
21
|
ops.run_autoproj 'bootstrap', *bootstrap_options
|
20
22
|
|
data/bin/autoproj_install
CHANGED
@@ -43,6 +43,7 @@ module Autoproj
|
|
43
43
|
@root_dir = root_dir
|
44
44
|
@gem_source = "https://rubygems.org"
|
45
45
|
@gemfile = nil
|
46
|
+
@skip_stage2 = false
|
46
47
|
|
47
48
|
@autoproj_options = Array.new
|
48
49
|
|
@@ -113,6 +114,11 @@ module Autoproj
|
|
113
114
|
# @return [String]
|
114
115
|
def autoproj_config_path; File.join(dot_autoproj, 'config.yml') end
|
115
116
|
|
117
|
+
# Whether the stage2 install should be called or not
|
118
|
+
def skip_stage2?; !!@skip_stage2 end
|
119
|
+
# (see #skip_stage2?)
|
120
|
+
def skip_stage2=(flag); @skip_stage2 = flag end
|
121
|
+
|
116
122
|
# Whether we can access the network while installing
|
117
123
|
def local?; !!@local end
|
118
124
|
# (see #local?)
|
@@ -196,6 +202,9 @@ module Autoproj
|
|
196
202
|
opt.on '--local', 'do not access the network (may fail)' do
|
197
203
|
@local = true
|
198
204
|
end
|
205
|
+
opt.on '--skip-stage2', 'do not run the stage2 install' do
|
206
|
+
@skip_stage2 = true
|
207
|
+
end
|
199
208
|
opt.on '--gem-source=URL', String, "use this source for RubyGems instead of rubygems.org" do |url|
|
200
209
|
@gem_source = url
|
201
210
|
end
|
@@ -303,6 +312,8 @@ module Autoproj
|
|
303
312
|
self.class.rewrite_shims(shims_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
|
304
313
|
end
|
305
314
|
|
315
|
+
EXCLUDED_FROM_SHIMS = %w{rake thor}
|
316
|
+
|
306
317
|
def self.rewrite_shims(shim_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
|
307
318
|
FileUtils.mkdir_p shim_path
|
308
319
|
File.open(File.join(shim_path, 'ruby'), 'w') do |io|
|
@@ -316,6 +327,10 @@ module Autoproj
|
|
316
327
|
Dir.glob(File.join(shim_path, '*')) do |bin_script|
|
317
328
|
next if !File.file?(bin_script)
|
318
329
|
bin_name = File.basename(bin_script)
|
330
|
+
if EXCLUDED_FROM_SHIMS.include?(bin_name)
|
331
|
+
FileUtils.rm_f bin_script
|
332
|
+
next
|
333
|
+
end
|
319
334
|
next if bin_name == 'ruby'
|
320
335
|
|
321
336
|
bin_shim = File.join(shim_path, bin_name)
|
@@ -341,6 +356,7 @@ if defined?(Bundler)
|
|
341
356
|
end
|
342
357
|
end
|
343
358
|
|
359
|
+
ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
|
344
360
|
ENV['GEM_HOME'] = '#{gems_gem_home}'
|
345
361
|
ENV.delete('GEM_PATH')
|
346
362
|
Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
|
@@ -353,8 +369,10 @@ load Gem.bin_path('bundler', 'bundler')"
|
|
353
369
|
|
354
370
|
if defined?(Bundler)
|
355
371
|
Bundler.with_clean_env do
|
356
|
-
exec($0, *ARGV)
|
372
|
+
exec(Hash['RUBYLIB' => nil], $0, *ARGV)
|
357
373
|
end
|
374
|
+
elsif ENV['RUBYLIB']
|
375
|
+
exec(Hash['RUBYLIB' => nil], $0, *ARGV)
|
358
376
|
end
|
359
377
|
|
360
378
|
ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
|
@@ -401,6 +419,18 @@ require 'bundler/setup'
|
|
401
419
|
default_gemfile_contents
|
402
420
|
end
|
403
421
|
|
422
|
+
gemfile += [
|
423
|
+
"",
|
424
|
+
"config_path = File.join(__dir__, 'config.yml')",
|
425
|
+
"if File.file?(config_path)",
|
426
|
+
" require 'yaml'",
|
427
|
+
" config = YAML.load(File.read(config_path))",
|
428
|
+
" (config['plugins'] || Hash.new).each do |plugin_name, (version, options)|",
|
429
|
+
" gem plugin_name, version, **options",
|
430
|
+
" end",
|
431
|
+
"end"
|
432
|
+
].join("\n")
|
433
|
+
|
404
434
|
FileUtils.mkdir_p File.dirname(autoproj_gemfile_path)
|
405
435
|
File.open(autoproj_gemfile_path, 'w') do |io|
|
406
436
|
io.write gemfile
|
@@ -567,4 +597,6 @@ ENV.delete('RUBYLIB')
|
|
567
597
|
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
568
598
|
ops.parse_options(ARGV)
|
569
599
|
ops.stage1
|
570
|
-
ops.
|
600
|
+
if !ops.skip_stage2?
|
601
|
+
ops.call_stage2
|
602
|
+
end
|
data/bin/autoproj_install.in
CHANGED
@@ -8,11 +8,13 @@ elsif ENV['AUTOPROJ_CURRENT_ROOT'] && (ENV['AUTOPROJ_CURRENT_ROOT'] != Dir.pwd)
|
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
require 'autoproj/ops/install'
|
12
12
|
|
13
13
|
ENV.delete('BUNDLE_GEMFILE')
|
14
14
|
ENV.delete('RUBYLIB')
|
15
15
|
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
16
16
|
ops.parse_options(ARGV)
|
17
17
|
ops.stage1
|
18
|
-
ops.
|
18
|
+
if !ops.skip_stage2?
|
19
|
+
ops.call_stage2
|
20
|
+
end
|
data/lib/autoproj.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'rexml/streamlistener'
|
1
2
|
require "enumerator"
|
2
3
|
require 'utilrb/module/attr_predicate'
|
3
4
|
require 'pathname'
|
4
5
|
require 'concurrent'
|
5
6
|
require 'autobuild'
|
7
|
+
require 'autoproj/autobuild'
|
6
8
|
require 'autoproj/base'
|
7
9
|
require 'autoproj/exceptions'
|
8
10
|
require 'autoproj/version'
|
@@ -12,6 +14,7 @@
|
|
12
14
|
require 'autoproj/find_workspace'
|
13
15
|
require 'autoproj/vcs_definition'
|
14
16
|
require 'autoproj/package_set'
|
17
|
+
require 'autoproj/local_package_set'
|
15
18
|
require 'autoproj/package_definition'
|
16
19
|
require 'autoproj/package_selection'
|
17
20
|
require 'autoproj/metapackage'
|
@@ -57,9 +60,13 @@ def self.warn_deprecated_level=(level)
|
|
57
60
|
end
|
58
61
|
@warn_deprecated_level = 1
|
59
62
|
|
60
|
-
def self.warn_deprecated(method, msg, level = 0)
|
63
|
+
def self.warn_deprecated(method, msg = nil, level = 0)
|
61
64
|
if level >= @warn_deprecated_level
|
62
|
-
|
65
|
+
if msg
|
66
|
+
Autoproj.warn "#{method} is deprecated, #{msg}"
|
67
|
+
else
|
68
|
+
Autoproj.warn msg
|
69
|
+
end
|
63
70
|
caller.each { |l| Autoproj.warn " #{l}" }
|
64
71
|
end
|
65
72
|
end
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -1,748 +1,19 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
1
|
+
require 'autoproj/autobuild_extensions/package'
|
2
|
+
require 'autoproj/autobuild_extensions/archive_importer'
|
3
|
+
require 'autoproj/autobuild_extensions/git'
|
4
|
+
require 'autoproj/autobuild_extensions/svn'
|
5
|
+
require 'autoproj/autobuild_extensions/dsl'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
Autoproj.workspace.config.ruby_executable
|
9
|
-
end
|
10
|
-
|
11
|
-
module CmdLine
|
12
|
-
def self.ruby_executable
|
13
|
-
Autoproj.workspace.config.ruby_executable
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def explicit_osdeps_selection(name, config = Autoproj.config)
|
19
|
-
if !config.declared?("osdeps_#{name}")
|
20
|
-
if config.has_value_for?("osdeps_#{name}")
|
21
|
-
doc_string = "install #{name} from source ?"
|
22
|
-
else
|
23
|
-
# Declare the option
|
24
|
-
doc_string =<<-EOT
|
25
|
-
The #{name} package is listed as a dependency of #{self.name}. It is listed as an operating
|
26
|
-
system package for other operating systems than yours, and is also listed as a source package.
|
27
|
-
Since you requested manual updates, I have to ask you:
|
28
|
-
|
29
|
-
Do you want me to build #{name} from source ? If you say 'no', you will have to install it yourself.
|
30
|
-
EOT
|
31
|
-
end
|
32
|
-
|
33
|
-
config.declare(
|
34
|
-
"osdeps_#{name}", "boolean",
|
35
|
-
:default => "yes",
|
36
|
-
:doc => doc_string)
|
37
|
-
end
|
38
|
-
!config.get("osdeps_#{name}")
|
39
|
-
end
|
40
|
-
|
41
|
-
module Autobuild
|
42
|
-
class Package
|
43
|
-
attr_writer :ws
|
44
|
-
def ws
|
45
|
-
@ws ||= Autoproj.workspace
|
46
|
-
end
|
47
|
-
|
48
|
-
# The Autoproj::PackageManifest object that describes this package
|
49
|
-
attr_accessor :description
|
50
|
-
# The set of tags for this package. This is an union of the tags
|
51
|
-
# contained in +description+ and the ones explicitely added with
|
52
|
-
# #add_tag
|
53
|
-
def tags
|
54
|
-
result = (@added_tags || Set.new)
|
55
|
-
if description
|
56
|
-
result |= description.tags.to_set
|
57
|
-
end
|
58
|
-
result
|
59
|
-
end
|
60
|
-
# Tags explicitely added with #add_tag
|
61
|
-
attr_reader :added_tags
|
62
|
-
# Add a tag to the package. Use this if you don't want the tag to be
|
63
|
-
# shared with everyone that uses the package (i.e. cannot go in
|
64
|
-
# manifest.xml)
|
65
|
-
def add_tag(tag)
|
66
|
-
@added_tags ||= Set.new
|
67
|
-
@added_tags << tag
|
68
|
-
end
|
69
|
-
|
70
|
-
# True if this package is tagged with the given tag string
|
71
|
-
def has_tag?(tag)
|
72
|
-
tags.include?(tag.to_s)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Asks autoproj to remove references to the given obsolete oroGen
|
76
|
-
# package
|
77
|
-
def remove_obsolete_installed_orogen_package(name)
|
78
|
-
post_install do
|
79
|
-
path = File.join(prefix, 'lib', 'pkgconfig')
|
80
|
-
Dir.glob(File.join(path, "#{name}-*.pc")) do |pcfile|
|
81
|
-
Autoproj.message " removing obsolete file #{pcfile}", :bold
|
82
|
-
FileUtils.rm_f pcfile
|
83
|
-
end
|
84
|
-
pcfile = File.join(path, "orogen-project-#{name}.pc")
|
85
|
-
if File.exist?(pcfile)
|
86
|
-
Autoproj.message " removing obsolete file #{pcfile}", :bold
|
87
|
-
FileUtils.rm_f pcfile
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Asks autoproj to remove the given file in the package's installation
|
93
|
-
# prefix
|
94
|
-
def remove_obsolete_installed_file(*path)
|
95
|
-
post_install do
|
96
|
-
path = File.join(prefix, *path)
|
97
|
-
if File.exist?(path)
|
98
|
-
Autoproj.message " removing obsolete file #{path}", :bold
|
99
|
-
FileUtils.rm_f path
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# Ask autoproj to run the given block after this package has been
|
105
|
-
# imported
|
106
|
-
def post_import(&block)
|
107
|
-
Autoproj.post_import(self, &block)
|
108
|
-
end
|
109
|
-
|
110
|
-
def autoproj_name # :nodoc:
|
111
|
-
srcdir.gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')
|
112
|
-
end
|
113
|
-
|
114
|
-
alias __depends_on__ depends_on
|
115
|
-
def depends_on(name)
|
116
|
-
if name.respond_to?(:name) # probably a Package object
|
117
|
-
name = name.name
|
118
|
-
end
|
119
|
-
|
120
|
-
@os_packages ||= Set.new
|
121
|
-
pkg_autobuild, pkg_os = partition_package(name)
|
122
|
-
pkg_autobuild.each do |pkg|
|
123
|
-
__depends_on__(pkg)
|
124
|
-
end
|
125
|
-
@os_packages |= pkg_os.to_set
|
126
|
-
end
|
127
|
-
|
128
|
-
def depends_on_os_package(name)
|
129
|
-
depends_on(name)
|
130
|
-
end
|
131
|
-
|
132
|
-
def remove_dependency(name)
|
133
|
-
dependencies.delete name
|
134
|
-
optional_dependencies.delete name
|
135
|
-
os_packages.delete name
|
136
|
-
end
|
137
|
-
|
138
|
-
def optional_dependency(name)
|
139
|
-
optional_dependencies << name
|
140
|
-
end
|
141
|
-
|
142
|
-
def partition_package(pkg_name)
|
143
|
-
pkg_autobuild, pkg_osdeps = [], []
|
144
|
-
ws.manifest.resolve_package_name(pkg_name).each do |type, dep_name|
|
145
|
-
if type == :osdeps
|
146
|
-
pkg_osdeps << dep_name
|
147
|
-
elsif type == :package
|
148
|
-
pkg_autobuild << dep_name
|
149
|
-
else raise Autoproj::InternalError, "expected package type to be either :osdeps or :package, got #{type.inspect}"
|
150
|
-
end
|
151
|
-
end
|
152
|
-
return pkg_autobuild, pkg_osdeps
|
153
|
-
end
|
154
|
-
|
155
|
-
def partition_optional_dependencies
|
156
|
-
packages, osdeps = [], []
|
157
|
-
optional_dependencies.each do |name|
|
158
|
-
begin
|
159
|
-
pkg_autobuild, pkg_osdeps = partition_package(name)
|
160
|
-
packages.concat(pkg_autobuild)
|
161
|
-
osdeps.concat(pkg_osdeps)
|
162
|
-
rescue Autoproj::PackageNotFound
|
163
|
-
# Simply ignore non-existent optional dependencies
|
164
|
-
end
|
165
|
-
end
|
166
|
-
return packages, osdeps
|
167
|
-
end
|
168
|
-
|
169
|
-
def resolve_optional_dependencies
|
170
|
-
packages, osdeps = partition_optional_dependencies
|
171
|
-
packages.each { |pkg| __depends_on__(pkg) }
|
172
|
-
os_packages.merge(osdeps.to_set)
|
173
|
-
end
|
174
|
-
|
175
|
-
def optional_dependencies
|
176
|
-
@optional_dependencies ||= Set.new
|
177
|
-
end
|
178
|
-
|
179
|
-
def os_packages
|
180
|
-
@os_packages ||= Set.new
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
class Git
|
185
|
-
# Reconfigures this importer to use an already existing checkout located
|
186
|
-
# in the given autoproj root
|
187
|
-
#
|
188
|
-
# @param [Autobuild::Package] the package we are dealing with
|
189
|
-
# @param [Autoproj::InstallationManifest] the other root's installation
|
190
|
-
# manifest
|
191
|
-
def pick_from_autoproj_root(package, installation_manifest)
|
192
|
-
other_pkg = installation_manifest[package.name]
|
193
|
-
return if !other_pkg || !File.directory?(other_pkg.srcdir)
|
194
|
-
self.relocate(other_pkg.srcdir)
|
195
|
-
true
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
class ArchiveImporter
|
200
|
-
# Reconfigures this importer to use an already existing checkout located
|
201
|
-
# in the given autoproj root
|
202
|
-
#
|
203
|
-
# @param [Autobuild::Package] the package we are dealing with
|
204
|
-
# @param [Autoproj::InstallationManifest] the other root's installation
|
205
|
-
# manifest
|
206
|
-
def pick_from_autoproj_root(package, installation_manifest)
|
207
|
-
# Get the cachefile w.r.t. the autoproj root
|
208
|
-
cachefile = Pathname.new(self.cachefile).
|
209
|
-
relative_path_from(Pathname.new(Autoproj.root_dir)).to_s
|
210
|
-
|
211
|
-
# The cachefile in the other autoproj installation
|
212
|
-
other_cachefile = File.join(installation_manifest.path, cachefile)
|
213
|
-
if File.file?(other_cachefile)
|
214
|
-
self.relocate("file://" + other_cachefile)
|
215
|
-
true
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
module Autoproj
|
222
|
-
@file_stack = Array.new
|
223
|
-
|
224
|
-
def self.package_name_from_options(spec)
|
225
|
-
if spec.kind_of?(Hash)
|
226
|
-
spec.to_a.first.first.to_str
|
227
|
-
else
|
228
|
-
spec.to_str
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
# @deprecated use Autoproj.workspace.in_package_set or add a proper Loader object to your
|
233
|
-
# class
|
234
|
-
def self.in_package_set(package_set, path, &block)
|
235
|
-
Autoproj.workspace.in_package_set(package_set, path, &block)
|
236
|
-
end
|
237
|
-
# @deprecated use Autoproj.workspace.current_file or add a proper Loader object to your
|
238
|
-
# class
|
239
|
-
def self.current_file
|
240
|
-
Autoproj.workspace.current_file
|
241
|
-
end
|
242
|
-
# @deprecated use Autoproj.workspace.current_package_set or add a proper Loader object to your
|
243
|
-
# class
|
244
|
-
def self.current_package_set
|
245
|
-
Autoproj.workspace.current_package_set
|
246
|
-
end
|
247
|
-
|
248
|
-
def self.define(package_type, spec, &block)
|
249
|
-
package = Autobuild.send(package_type, spec)
|
250
|
-
Autoproj.workspace.manifest.register_package(package, block, *current_file)
|
251
|
-
package
|
252
|
-
end
|
253
|
-
|
254
|
-
def self.loaded_autobuild_files
|
255
|
-
Autoproj.workspace.loaded_autobuild_files
|
256
|
-
end
|
257
|
-
|
258
|
-
def self.import_autobuild_file(package_set, path)
|
259
|
-
Autoproj.workspace.import_autobuild_file(package_set, path)
|
260
|
-
end
|
261
|
-
|
262
|
-
def self.find_topmost_directory_containing(dir, glob_pattern = nil)
|
263
|
-
result = nil
|
264
|
-
while dir != "/"
|
265
|
-
match = false
|
266
|
-
if glob_pattern
|
267
|
-
if !Dir.glob(File.join(dir, glob_pattern)).empty?
|
268
|
-
match = true
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
if !match && block_given? && yield(dir)
|
273
|
-
match = true
|
274
|
-
end
|
275
|
-
if !match && result
|
276
|
-
return result
|
277
|
-
elsif match
|
278
|
-
result = dir
|
279
|
-
end
|
280
|
-
|
281
|
-
dir = File.dirname(dir)
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
# Tries to find a handler automatically for 'full_path'
|
286
|
-
def self.package_handler_for(full_path)
|
287
|
-
if !Dir.enum_for(:glob, File.join(full_path, "*.orogen")).to_a.empty?
|
288
|
-
return "orogen_package", full_path
|
289
|
-
elsif File.file?(File.join(full_path, "CMakeLists.txt"))
|
290
|
-
toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
|
291
|
-
cmakelists = File.join(dir, 'CMakeLists.txt')
|
292
|
-
File.file?(cmakelists) &&
|
293
|
-
(File.read(cmakelists) =~ /PROJECT/i)
|
294
|
-
end
|
295
|
-
toplevel_dir ||= find_topmost_directory_containing(full_path, 'CMakeLists.txt')
|
296
|
-
|
297
|
-
return "cmake_package", toplevel_dir
|
298
|
-
elsif dir = find_topmost_directory_containing(full_path, "Rakefile") ||
|
299
|
-
find_topmost_directory_containing(full_path, "lib/*.rb")
|
300
|
-
|
301
|
-
return "ruby_package", dir
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
def ignore(*paths)
|
307
|
-
paths.each do |p|
|
308
|
-
Autobuild.ignore(p)
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
# Adds a new setup block to an existing package
|
313
|
-
def setup_package(package_name, &block)
|
314
|
-
if !block
|
315
|
-
raise ConfigError.new, "you must give a block to #setup_package"
|
316
|
-
end
|
317
|
-
|
318
|
-
package_definition = Autoproj.workspace.manifest.package(package_name)
|
319
|
-
if !package_definition
|
320
|
-
raise ConfigError.new, "#{package_name} is not a known package"
|
321
|
-
elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage)
|
322
|
-
# Nothing to do!
|
323
|
-
else
|
324
|
-
package_definition.add_setup_block(block)
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
# Common setup for packages
|
329
|
-
def package_common(package_type, spec, &block)
|
330
|
-
package_name = Autoproj.package_name_from_options(spec)
|
331
|
-
|
332
|
-
if Autobuild::Package[package_name]
|
333
|
-
current_file = Autoproj.current_file[1]
|
334
|
-
old_file = Autoproj.workspace.manifest.definition_file(package_name)
|
335
|
-
Autoproj.warn "#{package_name} from #{current_file} is overridden by the definition in #{old_file}"
|
336
|
-
|
337
|
-
return Autobuild::Package[package_name]
|
338
|
-
end
|
339
|
-
|
340
|
-
pkg = Autoproj.define(package_type, spec, &block)
|
341
|
-
pkg.srcdir = pkg.name
|
342
|
-
pkg
|
343
|
-
end
|
344
|
-
|
345
|
-
def import_package(options, &block)
|
346
|
-
package_common(:import, options, &block)
|
347
|
-
end
|
348
|
-
|
349
|
-
def common_make_based_package_setup(pkg)
|
350
|
-
unless pkg.has_doc? && pkg.doc_dir
|
351
|
-
pkg.with_doc do
|
352
|
-
doc_html = File.join(pkg.builddir, 'doc', 'html')
|
353
|
-
if File.directory?(doc_html)
|
354
|
-
pkg.doc_dir = doc_html
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|
358
|
-
if !pkg.test_utility.has_task?
|
359
|
-
if !pkg.test_utility.source_dir
|
360
|
-
test_dir = File.join(pkg.srcdir, 'test')
|
361
|
-
if File.directory?(test_dir)
|
362
|
-
pkg.test_utility.source_dir = test_dir
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
if pkg.test_utility.source_dir
|
367
|
-
pkg.with_tests
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
# Define a cmake package
|
373
|
-
#
|
374
|
-
# Example:
|
375
|
-
#
|
376
|
-
# cmake_package 'package_name' do |pkg|
|
377
|
-
# pkg.define "CMAKE_BUILD_TYPE", "Release"
|
378
|
-
# end
|
379
|
-
#
|
380
|
-
# +pkg+ is an Autobuild::CMake instance. See the Autobuild API for more
|
381
|
-
# information.
|
382
|
-
def cmake_package(options, &block)
|
383
|
-
package_common(:cmake, options) do |pkg|
|
384
|
-
pkg.depends_on 'cmake'
|
385
|
-
common_make_based_package_setup(pkg)
|
386
|
-
yield(pkg) if block_given?
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
# Define an autotools package
|
391
|
-
#
|
392
|
-
# Example:
|
393
|
-
# autotools_package 'package_name' do |pkg|
|
394
|
-
# pkg.configureflags << "--enable-llvm"
|
395
|
-
# end
|
396
|
-
#
|
397
|
-
# +pkg+ is an Autobuild::Autotools instance. See the Autobuild API for more
|
398
|
-
# information.
|
399
|
-
def autotools_package(options, &block)
|
400
|
-
package_common(:autotools, options) do |pkg|
|
401
|
-
pkg.depends_on 'autotools'
|
402
|
-
common_make_based_package_setup(pkg)
|
403
|
-
yield(pkg) if block_given?
|
404
|
-
end
|
405
|
-
end
|
406
|
-
|
407
|
-
def env_set(name, value)
|
408
|
-
Autoproj.env.set(name, value)
|
7
|
+
Autobuild::Package.class_eval do
|
8
|
+
prepend Autoproj::AutobuildExtensions::Package
|
409
9
|
end
|
410
|
-
|
411
|
-
Autoproj
|
10
|
+
Autobuild::ArchiveImporter.class_eval do
|
11
|
+
prepend Autoproj::AutobuildExtensions::ArchiveImporter
|
412
12
|
end
|
413
|
-
|
414
|
-
|
415
|
-
# Defines a Ruby package
|
416
|
-
#
|
417
|
-
# Example:
|
418
|
-
#
|
419
|
-
# ruby_package 'package_name' do |pkg|
|
420
|
-
# pkg.doc_target = 'doc'
|
421
|
-
# end
|
422
|
-
#
|
423
|
-
# +pkg+ is an Autobuild::Importer instance. See the Autobuild API for more
|
424
|
-
# information.
|
425
|
-
def ruby_package(options)
|
426
|
-
package_common(:ruby, options) do |pkg|
|
427
|
-
# Documentation code. Ignore if the user provided its own documentation
|
428
|
-
# task, or disabled the documentation generation altogether by setting
|
429
|
-
# rake_doc_task to nil
|
430
|
-
if !pkg.has_doc? && pkg.rake_doc_task
|
431
|
-
pkg.with_doc
|
432
|
-
end
|
433
|
-
if !pkg.test_utility.has_task?
|
434
|
-
if !pkg.test_utility.source_dir
|
435
|
-
test_dir = File.join(pkg.srcdir, 'test')
|
436
|
-
if File.directory?(test_dir)
|
437
|
-
pkg.test_utility.source_dir = test_dir
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|
441
|
-
if pkg.test_utility.source_dir
|
442
|
-
pkg.with_tests
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
|
-
yield(pkg) if block_given?
|
447
|
-
end
|
13
|
+
Autobuild::Git.class_eval do
|
14
|
+
prepend Autoproj::AutobuildExtensions::Git
|
448
15
|
end
|
449
|
-
|
450
|
-
|
451
|
-
# called package_basename.orogen if the package is called dir/package_basename
|
452
|
-
#
|
453
|
-
# Example:
|
454
|
-
# orogen_package 'package_name' do |pkg|
|
455
|
-
# pkg.orogen_file = "my.orogen"
|
456
|
-
# pkg.corba = false
|
457
|
-
# end
|
458
|
-
#
|
459
|
-
# +pkg+ is an Autobuild::Orogen instance. See the Autobuild API for more
|
460
|
-
# information.
|
461
|
-
def orogen_package(options, &block)
|
462
|
-
package_common(:orogen, options) do |pkg|
|
463
|
-
common_make_based_package_setup(pkg)
|
464
|
-
yield(pkg) if block_given?
|
465
|
-
end
|
466
|
-
end
|
467
|
-
|
468
|
-
# Declare that the packages declared in the block should be built only on the
|
469
|
-
# given operating system. OS descriptions are space-separated strings containing
|
470
|
-
# OS name and version.
|
471
|
-
#
|
472
|
-
# The block will simply be ignored if run on another architecture
|
473
|
-
def only_on(*architectures)
|
474
|
-
architectures = architectures.map do |name|
|
475
|
-
if name.respond_to?(:to_str)
|
476
|
-
[name]
|
477
|
-
else name
|
478
|
-
end
|
479
|
-
end
|
480
|
-
|
481
|
-
os_names, os_versions = Autoproj.workspace.operating_system
|
482
|
-
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
483
|
-
if matching_archs.empty?
|
484
|
-
return
|
485
|
-
elsif matching_archs.none? { |arch| !arch[1] || os_versions.include?(arch[1].downcase) }
|
486
|
-
return
|
487
|
-
end
|
488
|
-
|
489
|
-
yield
|
490
|
-
end
|
491
|
-
|
492
|
-
# Declare that the packages declared in the block should not be built in the
|
493
|
-
# given operating system. OS descriptions are space-separated strings containing
|
494
|
-
# OS name and version.
|
495
|
-
#
|
496
|
-
# An error will occur if the user tries to build it on one of those
|
497
|
-
# architectures
|
498
|
-
def not_on(*architectures)
|
499
|
-
architectures = architectures.map do |name|
|
500
|
-
if name.respond_to?(:to_str)
|
501
|
-
[name]
|
502
|
-
else name
|
503
|
-
end
|
504
|
-
end
|
505
|
-
|
506
|
-
os_names, os_versions = Autoproj.workspace.operating_system
|
507
|
-
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
508
|
-
if matching_archs.empty?
|
509
|
-
return yield
|
510
|
-
elsif matching_archs.all? { |arch| arch[1] && !os_versions.include?(arch[1].downcase) }
|
511
|
-
return yield
|
512
|
-
end
|
513
|
-
|
514
|
-
# Simply get the current list of packages, yield the block, and exclude all
|
515
|
-
# packages that have been added
|
516
|
-
current_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set
|
517
|
-
yield
|
518
|
-
new_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set -
|
519
|
-
current_packages
|
520
|
-
|
521
|
-
new_packages.each do |pkg_name|
|
522
|
-
Autoproj.workspace.manifest.add_exclusion(pkg_name, "#{pkg_name} is disabled on this operating system")
|
523
|
-
end
|
524
|
-
end
|
525
|
-
|
526
|
-
# Defines an import-only package, i.e. a package that is simply checked out but
|
527
|
-
# not built in any way
|
528
|
-
def source_package(options)
|
529
|
-
package_common(options) do |pkg|
|
530
|
-
pkg.srcdir = pkg.name
|
531
|
-
yield(pkg) if block_given?
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
# Define a configuration option
|
536
|
-
#
|
537
|
-
# @see Autoproj::Configuration#declare
|
538
|
-
def configuration_option(*opts, &block)
|
539
|
-
Autoproj.config.declare(*opts, &block)
|
540
|
-
end
|
541
|
-
|
542
|
-
# Retrieves the configuration value for the given option
|
543
|
-
#
|
544
|
-
# See Autoproj.user_config
|
545
|
-
def user_config(key)
|
546
|
-
Autoproj.user_config(key)
|
547
|
-
end
|
548
|
-
|
549
|
-
class Autobuild::Git
|
550
|
-
# Get version information
|
551
|
-
#
|
552
|
-
# @option options [Boolean] local (true) whether the snapshot should access
|
553
|
-
# the remote repository to determine if the local commit is there, and
|
554
|
-
# determine what would be the best remote branch, or stick to information
|
555
|
-
# that is present locally
|
556
|
-
# @option options [Boolean] exact_state (true) whether the snapshot should
|
557
|
-
# point to a specific commit (either with a tag or with a commit ID), or
|
558
|
-
# only override the branch
|
559
|
-
# @return [Hash] the snapshot information, in a format that can be used by
|
560
|
-
# {#relocate}
|
561
|
-
def snapshot(package, target_dir = nil, only_local: true, exact_state: true)
|
562
|
-
if only_local
|
563
|
-
snapshot_local(package, exact_state: exact_state)
|
564
|
-
else
|
565
|
-
snapshot_against_remote(package, exact_state: exact_state)
|
566
|
-
end
|
567
|
-
end
|
568
|
-
|
569
|
-
def normalize_branch_name(name)
|
570
|
-
if name =~ /^refs\/heads\//
|
571
|
-
return name
|
572
|
-
else
|
573
|
-
"refs/heads/#{name}"
|
574
|
-
end
|
575
|
-
end
|
576
|
-
|
577
|
-
# Returns true if the given snapshot information is different from the
|
578
|
-
# configured importer state
|
579
|
-
#
|
580
|
-
# It tests only against the parameters returned by {#snapshot}
|
581
|
-
def snapshot_overrides?(snapshot)
|
582
|
-
# We have to normalize the branch and tag names
|
583
|
-
if snapshot_local = (snapshot['local_branch'] || snapshot['branch'])
|
584
|
-
snapshot_local = normalize_branch_name(snapshot_local)
|
585
|
-
local_branch = normalize_branch_name(self.local_branch)
|
586
|
-
return true if snapshot_local != local_branch
|
587
|
-
end
|
588
|
-
if snapshot_remote = (snapshot['remote_branch'] || snapshot['branch'])
|
589
|
-
snapshot_remote = normalize_branch_name(snapshot_remote)
|
590
|
-
remote_branch = normalize_branch_name(self.remote_branch)
|
591
|
-
return true if snapshot_remote != remote_branch
|
592
|
-
end
|
593
|
-
if snapshot_id = snapshot['commit']
|
594
|
-
return true if self.commit != snapshot_id
|
595
|
-
end
|
596
|
-
false
|
597
|
-
end
|
598
|
-
|
599
|
-
# @api private
|
600
|
-
def snapshot_against_remote(package, options = Hash.new)
|
601
|
-
info = Hash['tag' => nil, 'commit' => nil]
|
602
|
-
remote_revname = describe_commit_on_remote(package, 'HEAD', tags: options[:exact_state])
|
603
|
-
|
604
|
-
case remote_revname
|
605
|
-
when /^refs\/heads\/(.*)/
|
606
|
-
remote_branch = $1
|
607
|
-
if local_branch == remote_branch
|
608
|
-
info['branch'] = local_branch
|
609
|
-
else
|
610
|
-
info['local_branch'] = local_branch
|
611
|
-
info['remote_branch'] = remote_branch
|
612
|
-
end
|
613
|
-
when /^refs\/tags\/(.*)/
|
614
|
-
info['tag'] = $1
|
615
|
-
else
|
616
|
-
info['local_branch'] = local_branch
|
617
|
-
info['remote_branch'] = remote_revname
|
618
|
-
end
|
619
|
-
|
620
|
-
if options[:exact_state] && !info['tag']
|
621
|
-
info['commit'] = rev_parse(package, 'HEAD')
|
622
|
-
end
|
623
|
-
info
|
624
|
-
end
|
625
|
-
|
626
|
-
# @api private
|
627
|
-
def snapshot_local(package, options = Hash.new)
|
628
|
-
info = Hash.new
|
629
|
-
if local_branch != remote_branch
|
630
|
-
info['local_branch'] = local_branch
|
631
|
-
info['remote_branch'] = remote_branch
|
632
|
-
else
|
633
|
-
info['branch'] = branch
|
634
|
-
end
|
635
|
-
|
636
|
-
if options[:exact_state]
|
637
|
-
has_tag, described = describe_rev(package, 'HEAD')
|
638
|
-
if has_tag
|
639
|
-
info.merge('tag' => described, 'commit' => nil)
|
640
|
-
else
|
641
|
-
info.merge('tag' => nil, 'commit' => described)
|
642
|
-
end
|
643
|
-
else
|
644
|
-
info
|
645
|
-
end
|
646
|
-
end
|
647
|
-
end
|
648
|
-
|
649
|
-
class Autobuild::SVN
|
650
|
-
def snapshot(package, target_dir = nil, options = Hash.new)
|
651
|
-
version = svn_revision(package)
|
652
|
-
Hash['revision' => version]
|
653
|
-
end
|
654
|
-
end
|
655
|
-
|
656
|
-
class Autobuild::ArchiveImporter
|
657
|
-
def snapshot(package, target_dir = nil, options = Hash.new)
|
658
|
-
result = Hash[
|
659
|
-
'mode' => mode,
|
660
|
-
'no_subdirectory' => !has_subdirectory?,
|
661
|
-
'archive_dir' => archive_dir || tardir]
|
662
|
-
|
663
|
-
if target_dir
|
664
|
-
archive_dir = File.join(target_dir, 'archives')
|
665
|
-
FileUtils.mkdir_p archive_dir
|
666
|
-
FileUtils.cp @cachefile, archive_dir
|
667
|
-
|
668
|
-
result['url'] = "file://$AUTOPROJ_SOURCE_DIR/archives/#{File.basename(@cachefile)}"
|
669
|
-
else
|
670
|
-
result['url'] = @url.to_s
|
671
|
-
end
|
672
|
-
|
673
|
-
result
|
674
|
-
end
|
675
|
-
end
|
676
|
-
|
677
|
-
def package(name)
|
678
|
-
Autoproj.workspace.manifest.find_autobuild_package(name)
|
679
|
-
end
|
680
|
-
|
681
|
-
# Returns true if +name+ is a valid package and is neither excluded nor ignored
|
682
|
-
# from the build
|
683
|
-
def package_selected?(name)
|
684
|
-
Autoproj.workspace.manifest.package_selected?(name, false)
|
685
|
-
end
|
686
|
-
|
687
|
-
# Returns true if +name+ is a valid package and is included in the build
|
688
|
-
def package_enabled?(name)
|
689
|
-
Autoproj.workspace.manifest.package_enabled?(name, false)
|
690
|
-
end
|
691
|
-
|
692
|
-
# If used in init.rb, allows to disable automatic imports from specific package
|
693
|
-
# sets
|
694
|
-
def disable_imports_from(name)
|
695
|
-
Autoproj.workspace.manifest.disable_imports_from(name)
|
696
|
-
end
|
697
|
-
|
698
|
-
# Moves the given package to a new subdirectory
|
699
|
-
def move_package(name, new_dir)
|
700
|
-
Autoproj.workspace.manifest.move_package(name, new_dir)
|
701
|
-
end
|
702
|
-
|
703
|
-
# Removes all the packages currently added from the given metapackage
|
704
|
-
#
|
705
|
-
# Calling this function will make sure that the given metapackage is now empty.
|
706
|
-
def clear_metapackage(name)
|
707
|
-
meta = Autoproj.workspace.manifest.metapackage(name)
|
708
|
-
meta.packages.clear
|
709
|
-
end
|
710
|
-
|
711
|
-
# Declares a new metapackage, or adds packages to an existing one
|
712
|
-
def metapackage(name, *packages)
|
713
|
-
Autoproj.workspace.manifest.metapackage(name, *packages)
|
714
|
-
end
|
715
|
-
|
716
|
-
# This can be used only during the load of a package set
|
717
|
-
#
|
718
|
-
# It defines the set of packages that will be built if 'package_set_name' is
|
719
|
-
# used. By default, all of the package set's packages are included. After a call
|
720
|
-
# to default_packages, only the packages listed (and their dependencies) are.
|
721
|
-
def default_packages(*names)
|
722
|
-
pkg_set = Autoproj.current_package_set
|
723
|
-
clear_metapackage(pkg_set.name)
|
724
|
-
metapackage(pkg_set.name, *names)
|
725
|
-
end
|
726
|
-
|
727
|
-
# This can be used only during the load of a package set
|
728
|
-
#
|
729
|
-
# It removes the given packages from the set of packages that will be built if
|
730
|
-
# 'package_set_name' is used. By default, all of the package set's packages are
|
731
|
-
# included. After a call to default_packages, only the packages listed (and
|
732
|
-
# their dependencies) are.
|
733
|
-
def remove_from_default(*names)
|
734
|
-
pkg_set = Autoproj.current_package_set
|
735
|
-
Autoproj.workspace.manifest.metapackage(pkg_set.name).packages.delete_if do |pkg|
|
736
|
-
names.include?(pkg.name)
|
737
|
-
end
|
738
|
-
end
|
739
|
-
|
740
|
-
def renamed_package(current_name, old_name, options)
|
741
|
-
if options[:obsolete] && !Autoproj.workspace.manifest.explicitely_selected_in_layout?(old_name)
|
742
|
-
import_package old_name
|
743
|
-
Autoproj.workspace.manifest.add_exclusion old_name, "#{old_name} has been renamed to #{current_name}, you still have the option of using the old name by adding '- #{old_name}' explicitely in the layout in autoproj/manifest, but be warned that the name will stop being usable at all in the near future"
|
744
|
-
else
|
745
|
-
metapackage old_name, current_name
|
746
|
-
end
|
16
|
+
Autobuild::SVN.class_eval do
|
17
|
+
prepend Autoproj::AutobuildExtensions::SVN
|
747
18
|
end
|
748
19
|
|