autoproj 1.7.11 → 1.7.12.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +62 -0
- data/bin/autolocate +9 -0
- data/bin/autoproj +10 -1
- data/bin/autoproj_bootstrap +35 -19
- data/lib/autoproj/autobuild.rb +42 -19
- data/lib/autoproj/cmdline.rb +3 -3
- data/lib/autoproj/default.osdeps +3 -0
- data/lib/autoproj/gitorious.rb +12 -0
- data/lib/autoproj/manifest.rb +224 -45
- data/lib/autoproj/options.rb +4 -0
- data/lib/autoproj/osdeps.rb +15 -11
- data/lib/autoproj/system.rb +14 -8
- data/lib/autoproj/version.rb +1 -1
- metadata +13 -9
data/History.txt
CHANGED
@@ -1,3 +1,65 @@
|
|
1
|
+
= Version 1.7.12
|
2
|
+
* improved some error messages
|
3
|
+
* fixed error if config.yml is empty
|
4
|
+
* fixed issues with implicitly selecting ignored or excluded packages on the
|
5
|
+
command line
|
6
|
+
* added metapackage support. One can now "group" packages under a certain name,
|
7
|
+
said name being used in the manifest' layout, exclude_packgaes and/or
|
8
|
+
ignore_packages.
|
9
|
+
|
10
|
+
This is used in the autobuild files with
|
11
|
+
|
12
|
+
metapackage 'name', 'package1', 'package2', ...
|
13
|
+
|
14
|
+
The "default" metapackage, i.e. the list of packages that are selected when a
|
15
|
+
package set name is used in layout/exclude/ignore, can also be configured
|
16
|
+
with
|
17
|
+
|
18
|
+
default_packages 'package1', 'package2', ...
|
19
|
+
|
20
|
+
When a package set 'pkg_set' is created, two metapackages are created:
|
21
|
+
|
22
|
+
pkg_set
|
23
|
+
pkg_set.all
|
24
|
+
|
25
|
+
The first one is configurable with default_packages, while the second one
|
26
|
+
always lists all packages directly defined in pkg_set
|
27
|
+
|
28
|
+
* added support for custom source handlers. Custom source handlers are a way to
|
29
|
+
declare shortcuts for importers.
|
30
|
+
|
31
|
+
For instance,
|
32
|
+
|
33
|
+
Autoproj.gitorious_server_configuration('SPACEGIT', 'spacegit.dfki.uni-bremen.de')
|
34
|
+
|
35
|
+
defines a special 'spacegit' handler, and one can now do, in its source.yml,
|
36
|
+
|
37
|
+
version_control:
|
38
|
+
- my/package:
|
39
|
+
spacegit: imoby/scripts
|
40
|
+
|
41
|
+
The version control is then transparently expanded by autoproj to
|
42
|
+
|
43
|
+
- my/package:
|
44
|
+
type: git
|
45
|
+
url: git://spacegit.dfki.uni-bremen.de/imoby/scripts.git
|
46
|
+
push_to: git@spacegit.dfki.uni-bremen.de:imoby/scripts.git
|
47
|
+
|
48
|
+
These custom handlers can be used everywhere a version control specification
|
49
|
+
is required. They can be defined with Autoproj.add_source_handler (see the
|
50
|
+
API documentation)
|
51
|
+
|
52
|
+
* fix CVS support. This requires autobuild >= 1.5.42. The syntax in source.yml
|
53
|
+
is
|
54
|
+
|
55
|
+
type: cvs
|
56
|
+
url: <URL of the CVSROOT>
|
57
|
+
module: module_name
|
58
|
+
cvsup: ['options', 'for', 'cvsup']
|
59
|
+
cvsco: ['options', 'for', 'cvsco']
|
60
|
+
|
61
|
+
The default options for cvs up and cvs co are resp. -dP and -d.
|
62
|
+
|
1
63
|
= Version 1.7.11
|
2
64
|
* loads of fixes related to ignore_packages
|
3
65
|
- fix ignored packages being built if a package depends on them
|
data/bin/autolocate
CHANGED
@@ -62,6 +62,15 @@ if candidates.empty?
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
if candidates.size > 1
|
66
|
+
# If there is more than one candidate, check if there are some that are not
|
67
|
+
# present on disk
|
68
|
+
present = candidates.find_all { |dir| File.directory?(dir) }
|
69
|
+
if present.size == 1
|
70
|
+
candidates = present
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
65
74
|
if candidates.empty?
|
66
75
|
STDERR.puts Autoproj.console.color("cannot find #{selection} in the current autoproj installation", :bold, :red)
|
67
76
|
exit 1
|
data/bin/autoproj
CHANGED
@@ -104,6 +104,16 @@ EOTEXT
|
|
104
104
|
end
|
105
105
|
|
106
106
|
Autoproj::CmdLine.setup_all_package_directories
|
107
|
+
# resolve_user_selection auto-adds packages present on disk but not listed
|
108
|
+
# in the manifest. However, since we have not yet loaded overrides /
|
109
|
+
# package blocks, it is possible that it contains excluded / ignored
|
110
|
+
# packages
|
111
|
+
#
|
112
|
+
# First do the resolution to get auto-add, finalize the package
|
113
|
+
# configuration, and then re-resolve
|
114
|
+
Autoproj::CmdLine.resolve_user_selection(selected_packages)
|
115
|
+
# Now load the rest of the configuration, and filter out exclusions
|
116
|
+
Autoproj::CmdLine.finalize_package_setup
|
107
117
|
resolved_selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
|
108
118
|
if !selected_packages.empty?
|
109
119
|
command_line_selection = resolved_selected_packages.dup
|
@@ -112,7 +122,6 @@ EOTEXT
|
|
112
122
|
end
|
113
123
|
Autoproj.manifest.explicit_selection = resolved_selected_packages
|
114
124
|
selected_packages = resolved_selected_packages
|
115
|
-
Autoproj::CmdLine.finalize_package_setup
|
116
125
|
|
117
126
|
# If in verbose mode, or if we only update sources, list the sources
|
118
127
|
if Autoproj.verbose || Autoproj::CmdLine.display_configuration?
|
data/bin/autoproj_bootstrap
CHANGED
@@ -254,17 +254,21 @@ module Autoproj
|
|
254
254
|
# one.
|
255
255
|
#
|
256
256
|
# Examples: ['debian', ['sid', 'unstable']] or ['ubuntu', ['lucid lynx', '10.04']]
|
257
|
-
def self.operating_system
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
257
|
+
def self.operating_system(options = Hash.new)
|
258
|
+
options = Kernel.validate_options options, :force => false
|
259
|
+
|
260
|
+
if !options[:force]
|
261
|
+
if !@operating_system.nil?
|
262
|
+
return @operating_system
|
263
|
+
elsif Autoproj.has_config_key?('operating_system')
|
264
|
+
os = Autoproj.user_config('operating_system')
|
265
|
+
if os.respond_to?(:to_ary)
|
266
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
267
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
268
|
+
@operating_system = os
|
269
|
+
return os
|
270
|
+
end
|
271
|
+
end
|
268
272
|
end
|
269
273
|
end
|
270
274
|
|
@@ -1213,6 +1217,10 @@ module Autoproj
|
|
1213
1217
|
config_file = File.join(Autoproj.config_dir, "config.yml")
|
1214
1218
|
if File.exists?(config_file)
|
1215
1219
|
config = YAML.load(File.read(config_file))
|
1220
|
+
if !config
|
1221
|
+
return
|
1222
|
+
end
|
1223
|
+
|
1216
1224
|
config.each do |key, value|
|
1217
1225
|
@user_config[key] = [value, false]
|
1218
1226
|
end
|
@@ -1394,20 +1402,26 @@ module Autoproj
|
|
1394
1402
|
# If any error is detected, the backtrace will be filtered so that it is
|
1395
1403
|
# easier to understand by the user. Moreover, if +source+ is non-nil, the
|
1396
1404
|
# package set name will be mentionned.
|
1397
|
-
def self.load(
|
1405
|
+
def self.load(package_set, *path)
|
1398
1406
|
path = File.join(*path)
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1407
|
+
in_package_set(package_set, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')) do
|
1408
|
+
begin
|
1409
|
+
Kernel.load path
|
1410
|
+
rescue Interrupt
|
1411
|
+
raise
|
1412
|
+
rescue ConfigError => e
|
1413
|
+
raise
|
1414
|
+
rescue Exception => e
|
1415
|
+
filter_load_exception(e, package_set, path)
|
1416
|
+
end
|
1417
|
+
end
|
1404
1418
|
end
|
1405
1419
|
|
1406
1420
|
# Same as #load, but runs only if the file exists.
|
1407
|
-
def self.load_if_present(
|
1421
|
+
def self.load_if_present(package_set, *path)
|
1408
1422
|
path = File.join(*path)
|
1409
1423
|
if File.file?(path)
|
1410
|
-
self.load(
|
1424
|
+
self.load(package_set, *path)
|
1411
1425
|
end
|
1412
1426
|
end
|
1413
1427
|
|
@@ -1438,6 +1452,8 @@ end
|
|
1438
1452
|
|
1439
1453
|
DEFS = <<EODEFS
|
1440
1454
|
---
|
1455
|
+
cvs:
|
1456
|
+
debian,ubuntu: cvs
|
1441
1457
|
svn:
|
1442
1458
|
arch: subversion
|
1443
1459
|
gentoo: dev-util/subversion
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -238,12 +238,19 @@ module Autoproj
|
|
238
238
|
|
239
239
|
# Returns the information about the file that is currently being loaded
|
240
240
|
#
|
241
|
-
# The return value is [
|
242
|
-
# and +path+ is the path of the file w.r.t. the autoproj
|
241
|
+
# The return value is [package_set, path], where +package_set+ is the
|
242
|
+
# PackageSet instance and +path+ is the path of the file w.r.t. the autoproj
|
243
|
+
# root directory
|
243
244
|
def self.current_file
|
244
245
|
@file_stack.last
|
245
246
|
end
|
246
247
|
|
248
|
+
# The PackageSet object representing the package set that is currently being
|
249
|
+
# loaded
|
250
|
+
def self.current_package_set
|
251
|
+
current_file.first
|
252
|
+
end
|
253
|
+
|
247
254
|
def self.define(package_type, spec, &block)
|
248
255
|
package = Autobuild.send(package_type, spec)
|
249
256
|
Autoproj.manifest.register_package(package, block, *current_file)
|
@@ -251,7 +258,7 @@ module Autoproj
|
|
251
258
|
end
|
252
259
|
|
253
260
|
@loaded_autobuild_files = Set.new
|
254
|
-
def self.filter_load_exception(error,
|
261
|
+
def self.filter_load_exception(error, package_set, path)
|
255
262
|
raise error if Autoproj.verbose
|
256
263
|
rx_path = Regexp.quote(path)
|
257
264
|
if error_line = error.backtrace.find { |l| l =~ /#{rx_path}/ }
|
@@ -259,18 +266,18 @@ module Autoproj
|
|
259
266
|
line_number = "#{line_number}:"
|
260
267
|
end
|
261
268
|
|
262
|
-
if
|
269
|
+
if package_set.local?
|
263
270
|
raise ConfigError.new(path), "#{path}:#{line_number} #{error.message}", error.backtrace
|
264
271
|
else
|
265
|
-
raise ConfigError.new(path), "#{File.basename(path)}(
|
272
|
+
raise ConfigError.new(path), "#{File.basename(path)}(package_set=#{package_set.name}):#{line_number} #{error.message}", error.backtrace
|
266
273
|
end
|
267
274
|
else
|
268
275
|
raise error
|
269
276
|
end
|
270
277
|
end
|
271
278
|
|
272
|
-
def self.in_package_set(
|
273
|
-
@file_stack.push([
|
279
|
+
def self.in_package_set(package_set, path)
|
280
|
+
@file_stack.push([package_set, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')])
|
274
281
|
yield
|
275
282
|
ensure
|
276
283
|
@file_stack.pop
|
@@ -280,19 +287,10 @@ module Autoproj
|
|
280
287
|
attr_reader :loaded_autobuild_files
|
281
288
|
end
|
282
289
|
|
283
|
-
def self.import_autobuild_file(
|
290
|
+
def self.import_autobuild_file(package_set, path)
|
284
291
|
return if @loaded_autobuild_files.include?(path)
|
285
|
-
|
286
|
-
|
287
|
-
begin
|
288
|
-
Kernel.load path
|
289
|
-
rescue ConfigError => e
|
290
|
-
raise
|
291
|
-
rescue Exception => e
|
292
|
-
filter_load_exception(e, source, path)
|
293
|
-
end
|
294
|
-
@loaded_autobuild_files << path
|
295
|
-
end
|
292
|
+
Autoproj.load(package_set, path)
|
293
|
+
@loaded_autobuild_files << path
|
296
294
|
end
|
297
295
|
|
298
296
|
# Tries to find a handler automatically for 'full_path'
|
@@ -657,3 +655,28 @@ end
|
|
657
655
|
def move_package(name, new_dir)
|
658
656
|
Autoproj.manifest.move_package(name, new_dir)
|
659
657
|
end
|
658
|
+
|
659
|
+
# Removes all the packages currently added from the given metapackage
|
660
|
+
#
|
661
|
+
# Calling this function will make sure that the given metapackage is now empty.
|
662
|
+
def clear_metapackage(name)
|
663
|
+
meta = Autoproj.manifest.metapackage(name)
|
664
|
+
meta.packages.clear
|
665
|
+
end
|
666
|
+
|
667
|
+
# Declares a new metapackage, or adds packages to an existing one
|
668
|
+
def metapackage(name, *packages)
|
669
|
+
Autoproj.manifest.metapackage(name, *packages)
|
670
|
+
end
|
671
|
+
|
672
|
+
# This can be used only during the load of a package set
|
673
|
+
#
|
674
|
+
# It defines the set of packages that will be built if 'package_set_name' is
|
675
|
+
# used. By default, all of the package set's packages are included. After a call
|
676
|
+
# to default_packages, only the packages listed (and their dependencies) are.
|
677
|
+
def default_packages(*names)
|
678
|
+
pkg_set = Autoproj.current_package_set
|
679
|
+
clear_metapackage(pkg_set.name)
|
680
|
+
metapackage(pkg_set.name, *names)
|
681
|
+
end
|
682
|
+
|
data/lib/autoproj/cmdline.rb
CHANGED
@@ -130,7 +130,7 @@ module Autoproj
|
|
130
130
|
# Do that AFTER we have properly setup Autoproj.osdeps as to avoid
|
131
131
|
# unnecessarily redetecting the operating system
|
132
132
|
if update_os_dependencies? || osdeps?
|
133
|
-
Autoproj.
|
133
|
+
Autoproj.change_option('operating_system', Autoproj::OSDependencies.operating_system(:force => true), true)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -172,7 +172,7 @@ module Autoproj
|
|
172
172
|
|
173
173
|
# Load init.rb files. each_source must not load the source.yml file, as
|
174
174
|
# init.rb may define configuration options that are used there
|
175
|
-
manifest.
|
175
|
+
manifest.each_package_set(false) do |source|
|
176
176
|
Autoproj.load_if_present(source, source.local_dir, "init.rb")
|
177
177
|
end
|
178
178
|
|
@@ -468,7 +468,7 @@ module Autoproj
|
|
468
468
|
|
469
469
|
selected_packages, nonresolved = manifest.expand_package_selection(selected_packages)
|
470
470
|
|
471
|
-
# Try to auto-add stuff
|
471
|
+
# Try to auto-add stuff if nonresolved
|
472
472
|
nonresolved.delete_if do |sel|
|
473
473
|
next if !File.directory?(sel)
|
474
474
|
while sel != '/'
|
data/lib/autoproj/default.osdeps
CHANGED
data/lib/autoproj/gitorious.rb
CHANGED
@@ -79,6 +79,18 @@ module Autoproj
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
83
|
+
Autoproj.add_source_handler name.downcase do |url, options|
|
84
|
+
if url !~ /\.git$/
|
85
|
+
url += ".git"
|
86
|
+
end
|
87
|
+
if url !~ /^\//
|
88
|
+
url = "/#{url}"
|
89
|
+
end
|
90
|
+
base_url = Autoproj.user_config("#{name}_ROOT")
|
91
|
+
base_push_url = Autoproj.user_config("#{name}_PUSH_ROOT")
|
92
|
+
return Hash[:type => 'git', :url => "#{base_url}#{url}", :push_to => "#{base_push_url}#{url}"].merge(options)
|
93
|
+
end
|
82
94
|
end
|
83
95
|
end
|
84
96
|
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -111,7 +111,7 @@ module Autoproj
|
|
111
111
|
# (to_absolute_url might be called on installations that are being
|
112
112
|
# bootstrapped, and as such don't have a root dir yet).
|
113
113
|
url = Autoproj.single_expansion(url, 'HOME' => ENV['HOME'])
|
114
|
-
if url && url !~ /^(\w+:\/)
|
114
|
+
if url && url !~ /^(\w+:\/)?\/|^[:\w]+\@|^(\w+\@)?[\w\.-]+:/
|
115
115
|
url = File.expand_path(url, root_dir || Autoproj.root_dir)
|
116
116
|
end
|
117
117
|
url
|
@@ -137,33 +137,105 @@ module Autoproj
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
140
|
+
@custom_source_handlers = Hash.new
|
141
|
+
|
142
|
+
# Returns true if +vcs+ refers to a source handler name added by
|
143
|
+
# #add_source_handler
|
144
|
+
def self.has_source_handler?(vcs)
|
145
|
+
@custom_source_handlers.has_key?(vcs.to_s)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the source handlers associated with +vcs+
|
149
|
+
#
|
150
|
+
# Source handlers are added by Autoproj.add_source_handler. The returned
|
151
|
+
# value is an object that responds to #call(url, options) and return a VCS
|
152
|
+
# definition as a hash
|
153
|
+
def self.call_source_handler(vcs, url, options)
|
154
|
+
handler = @custom_source_handlers[vcs.to_s]
|
155
|
+
if !handler
|
156
|
+
raise ArgumentError, "there is no source handler for #{vcs}"
|
157
|
+
else
|
158
|
+
return handler.call(url, options)
|
148
159
|
end
|
160
|
+
end
|
149
161
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
162
|
+
# call-seq:
|
163
|
+
# Autoproj.add_source_handler name do |url, options|
|
164
|
+
# # build a hash that represent source configuration
|
165
|
+
# # and return it
|
166
|
+
# end
|
167
|
+
#
|
168
|
+
# Add a custom source handler named +name+
|
169
|
+
#
|
170
|
+
# Custom source handlers are shortcuts that can be used to represent VCS
|
171
|
+
# information. For instance, the gitorious_server_configuration method
|
172
|
+
# defines a source handler that allows to easily add new gitorious packages:
|
173
|
+
#
|
174
|
+
# gitorious_server_configuration 'GITORIOUS', 'gitorious.org'
|
175
|
+
#
|
176
|
+
# defines the "gitorious" source handler, which allows people to write
|
177
|
+
#
|
178
|
+
#
|
179
|
+
# version_control:
|
180
|
+
# - tools/orocos.rb
|
181
|
+
# gitorious: rock-toolchain/orocos-rb
|
182
|
+
# branch: test
|
183
|
+
#
|
184
|
+
#
|
185
|
+
def self.add_source_handler(name, &handler)
|
186
|
+
@custom_source_handlers[name.to_s] = lambda(&handler)
|
187
|
+
end
|
157
188
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
189
|
+
def self.vcs_definition_to_hash(spec)
|
190
|
+
options = Hash.new
|
191
|
+
|
192
|
+
plain = Array.new
|
193
|
+
filtered_spec = Hash.new
|
194
|
+
spec.each do |key, value|
|
195
|
+
keys = key.to_s.split(/\s+/)
|
196
|
+
plain.concat(keys[0..-2])
|
197
|
+
filtered_spec[keys[-1].to_sym] = value
|
198
|
+
end
|
199
|
+
spec = filtered_spec
|
200
|
+
|
201
|
+
if plain.size > 1
|
202
|
+
raise ConfigError.new, "invalid syntax"
|
203
|
+
elsif plain.size == 1
|
204
|
+
short_url = plain.first
|
205
|
+
vcs, *url = short_url.split(':')
|
206
|
+
|
207
|
+
# Check if VCS is a known version control system or source handler
|
208
|
+
# shortcut. If it is not, look for a local directory called
|
209
|
+
# short_url
|
210
|
+
if Autobuild.respond_to?(vcs)
|
211
|
+
spec.merge!(:type => vcs, :url => url.join(':'))
|
212
|
+
elsif has_source_handler?(vcs)
|
213
|
+
spec = call_source_handler(vcs, url.join(':'), spec)
|
214
|
+
else
|
215
|
+
source_dir = File.expand_path(File.join(Autoproj.config_dir, short_url))
|
216
|
+
if !File.directory?(source_dir)
|
217
|
+
raise ConfigError.new, "'#{spec.inspect}' is neither a remote source specification, nor a local source definition"
|
218
|
+
end
|
219
|
+
spec.merge!(:type => 'local', :url => source_dir)
|
220
|
+
end
|
162
221
|
end
|
163
222
|
|
164
223
|
spec, vcs_options = Kernel.filter_options spec, :type => nil, :url => nil
|
224
|
+
spec.merge!(vcs_options)
|
225
|
+
if !spec[:url]
|
226
|
+
# Verify that none of the keys are source handlers. If it is the
|
227
|
+
# case, convert
|
228
|
+
filtered_spec = Hash.new
|
229
|
+
spec.dup.each do |key, value|
|
230
|
+
if has_source_handler?(key)
|
231
|
+
spec.delete(key)
|
232
|
+
spec = call_source_handler(key, value, spec)
|
233
|
+
break
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
165
237
|
|
166
|
-
|
238
|
+
spec
|
167
239
|
end
|
168
240
|
|
169
241
|
# Autoproj configuration files accept VCS definitions in three forms:
|
@@ -278,6 +350,18 @@ module Autoproj
|
|
278
350
|
# automatically loaded by autoproj
|
279
351
|
def auto_imports?; !!@auto_imports end
|
280
352
|
|
353
|
+
# Returns the Metapackage object that has the same name than this
|
354
|
+
# package set
|
355
|
+
def metapackage
|
356
|
+
manifest.metapackage(name)
|
357
|
+
end
|
358
|
+
|
359
|
+
# List of the packages that are built if the package set is selected in
|
360
|
+
# the layout
|
361
|
+
def default_packages
|
362
|
+
metapackage.packages
|
363
|
+
end
|
364
|
+
|
281
365
|
# Create this source from a VCSDefinition object
|
282
366
|
def initialize(manifest, vcs)
|
283
367
|
@manifest = manifest
|
@@ -713,6 +797,32 @@ module Autoproj
|
|
713
797
|
end
|
714
798
|
end
|
715
799
|
|
800
|
+
# A set of packages that can be referred to by name
|
801
|
+
class Metapackage
|
802
|
+
# The metapackage name
|
803
|
+
attr_reader :name
|
804
|
+
# The packages listed in this metapackage
|
805
|
+
attr_reader :packages
|
806
|
+
|
807
|
+
def initialize(name)
|
808
|
+
@name = name
|
809
|
+
@packages = []
|
810
|
+
end
|
811
|
+
# Adds a package to this metapackage
|
812
|
+
def add(pkg)
|
813
|
+
@packages << pkg
|
814
|
+
end
|
815
|
+
def each_package(&block)
|
816
|
+
@packages.each(&block)
|
817
|
+
end
|
818
|
+
def include?(pkg)
|
819
|
+
if !pkg.respond_to?(:to_str)
|
820
|
+
pkg = pkg.name
|
821
|
+
end
|
822
|
+
@packages.any? { |p| p.name == pkg }
|
823
|
+
end
|
824
|
+
end
|
825
|
+
|
716
826
|
# The Manifest class represents the information included in the main
|
717
827
|
# manifest file, and allows to manipulate it
|
718
828
|
class Manifest
|
@@ -809,6 +919,8 @@ module Autoproj
|
|
809
919
|
|
810
920
|
attr_reader :constant_definitions
|
811
921
|
|
922
|
+
attr_reader :metapackages
|
923
|
+
|
812
924
|
def initialize
|
813
925
|
@file = nil
|
814
926
|
@data = nil
|
@@ -819,6 +931,7 @@ module Autoproj
|
|
819
931
|
@disabled_imports = Set.new
|
820
932
|
@moved_packages = Hash.new
|
821
933
|
@osdeps_overrides = Hash.new
|
934
|
+
@metapackages = Hash.new
|
822
935
|
|
823
936
|
@constant_definitions = Hash.new
|
824
937
|
if Autoproj.has_config_key?('manifest_source')
|
@@ -843,8 +956,8 @@ module Autoproj
|
|
843
956
|
data['ignore_packages'].any? do |l|
|
844
957
|
if package_name == l
|
845
958
|
true
|
846
|
-
elsif
|
847
|
-
|
959
|
+
elsif (pkg_set = metapackages[l]) && pkg_set.include?(package_name)
|
960
|
+
true
|
848
961
|
else
|
849
962
|
false
|
850
963
|
end
|
@@ -926,7 +1039,7 @@ module Autoproj
|
|
926
1039
|
#
|
927
1040
|
# And honestly I don't think someone will have 20 000 package sets
|
928
1041
|
done_something = false
|
929
|
-
|
1042
|
+
each_package_set(false) do |source|
|
930
1043
|
next if source_name && source.name != source_name
|
931
1044
|
done_something = true
|
932
1045
|
|
@@ -936,7 +1049,7 @@ module Autoproj
|
|
936
1049
|
end
|
937
1050
|
|
938
1051
|
if source_name && !done_something
|
939
|
-
raise ConfigError.new(file), "in #{file}:
|
1052
|
+
raise ConfigError.new(file), "in #{file}: package set '#{source_name}' does not exist"
|
940
1053
|
end
|
941
1054
|
end
|
942
1055
|
|
@@ -946,7 +1059,7 @@ module Autoproj
|
|
946
1059
|
return enum_for(:each_source_file)
|
947
1060
|
end
|
948
1061
|
|
949
|
-
|
1062
|
+
each_package_set(false) do |source|
|
950
1063
|
Dir.glob(File.join(source.local_dir, "*.osdeps")).each do |file|
|
951
1064
|
yield(source, file)
|
952
1065
|
end
|
@@ -972,7 +1085,7 @@ module Autoproj
|
|
972
1085
|
false
|
973
1086
|
end
|
974
1087
|
|
975
|
-
# Like #
|
1088
|
+
# Like #each_package_set, but filters out local package sets
|
976
1089
|
def each_remote_package_set(load_description = true)
|
977
1090
|
if !block_given?
|
978
1091
|
enum_for(:each_remote_package_set, load_description)
|
@@ -1078,6 +1191,10 @@ module Autoproj
|
|
1078
1191
|
# changes on the manifest's data structures
|
1079
1192
|
def cache_package_sets
|
1080
1193
|
@package_sets = each_package_set(false).to_a
|
1194
|
+
@package_sets.each do |pkg_set|
|
1195
|
+
@metapackages[pkg_set.name] ||= Metapackage.new(pkg_set.name)
|
1196
|
+
@metapackages["#{pkg_set.name}.all"] ||= Metapackage.new(pkg_set.name)
|
1197
|
+
end
|
1081
1198
|
end
|
1082
1199
|
|
1083
1200
|
# Register a new package
|
@@ -1087,6 +1204,8 @@ module Autoproj
|
|
1087
1204
|
pkg.add_setup_block(block)
|
1088
1205
|
end
|
1089
1206
|
@packages[package.name] = pkg
|
1207
|
+
@metapackages[pkg.package_set.name].add(pkg.autobuild)
|
1208
|
+
@metapackages["#{pkg.package_set.name}.all"].add(pkg.autobuild)
|
1090
1209
|
end
|
1091
1210
|
|
1092
1211
|
def definition_source(package_name)
|
@@ -1104,14 +1223,29 @@ module Autoproj
|
|
1104
1223
|
packages[name]
|
1105
1224
|
end
|
1106
1225
|
|
1107
|
-
# Lists all defined packages
|
1108
|
-
def
|
1226
|
+
# Lists all defined packages as PackageDefinition objects
|
1227
|
+
def each_package_definition(&block)
|
1228
|
+
if !block_given?
|
1229
|
+
return enum_for(:each_package_definition)
|
1230
|
+
end
|
1231
|
+
packages.each_value(&block)
|
1232
|
+
end
|
1233
|
+
|
1234
|
+
# Lists all defined autobuild packages as instances of
|
1235
|
+
# Autobuild::Package and its subclasses
|
1236
|
+
def each_autobuild_package
|
1109
1237
|
if !block_given?
|
1110
1238
|
return enum_for(:each_package)
|
1111
1239
|
end
|
1112
1240
|
packages.each_value { |pkg| yield(pkg.autobuild) }
|
1113
1241
|
end
|
1114
1242
|
|
1243
|
+
# DEPRECATED: use either #each_autobuild_package and
|
1244
|
+
# #each_package_definition
|
1245
|
+
def each_package(&block)
|
1246
|
+
each_autobuild_package(&block)
|
1247
|
+
end
|
1248
|
+
|
1115
1249
|
# The VCS object for the main configuration itself
|
1116
1250
|
attr_reader :vcs
|
1117
1251
|
|
@@ -1255,7 +1389,7 @@ module Autoproj
|
|
1255
1389
|
package_set
|
1256
1390
|
end
|
1257
1391
|
|
1258
|
-
sources =
|
1392
|
+
sources = each_package_set.to_a.dup
|
1259
1393
|
|
1260
1394
|
# Remove sources listed before the package source
|
1261
1395
|
while !sources.empty? && sources[0].name != package_source.name
|
@@ -1323,17 +1457,54 @@ module Autoproj
|
|
1323
1457
|
if Autobuild::Package[name]
|
1324
1458
|
[name]
|
1325
1459
|
else
|
1326
|
-
pkg_set =
|
1460
|
+
pkg_set = find_metapackage(name)
|
1327
1461
|
if !pkg_set
|
1328
|
-
raise ConfigError.new, "#{name} is neither a package nor a
|
1462
|
+
raise ConfigError.new, "#{name} is neither a package nor a package set name. Packages in autoproj must be declared in an autobuild file."
|
1329
1463
|
end
|
1330
|
-
|
1331
|
-
|
1332
|
-
map { |pkg| pkg.autobuild.name }.
|
1464
|
+
pkg_set.each_package.
|
1465
|
+
map(&:name).
|
1333
1466
|
find_all { |pkg_name| !Autoproj.osdeps || !Autoproj.osdeps.has?(pkg_name) }
|
1334
1467
|
end
|
1335
1468
|
end
|
1336
1469
|
|
1470
|
+
def find_metapackage(name)
|
1471
|
+
@metapackages[name.to_s]
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
# call-seq:
|
1475
|
+
# metapackage 'meta_name' => Metapackage
|
1476
|
+
# metapackage 'meta_name', 'pkg1', 'pkg2' => Metapackage
|
1477
|
+
#
|
1478
|
+
# Metapackage definition
|
1479
|
+
#
|
1480
|
+
# In the first form, returns a Metapackage instance for the metapackage
|
1481
|
+
# named 'meta_name'.
|
1482
|
+
#
|
1483
|
+
# In the second form, adds the listed packages to the metapackage and
|
1484
|
+
# returns the Metapackage instance
|
1485
|
+
def metapackage(name, *packages, &block)
|
1486
|
+
meta = (@metapackages[name.to_s] ||= Metapackage.new(name))
|
1487
|
+
packages.each do |pkg_name|
|
1488
|
+
package_names = resolve_package_set(pkg_name)
|
1489
|
+
package_names.each do |pkg_name|
|
1490
|
+
meta.add(Autobuild::Package[pkg_name])
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
if block
|
1495
|
+
meta.instance_eval(&block)
|
1496
|
+
end
|
1497
|
+
meta
|
1498
|
+
end
|
1499
|
+
|
1500
|
+
# Lists all defined metapackages
|
1501
|
+
#
|
1502
|
+
# Autoproj defines one metapackage per package set, which by default
|
1503
|
+
# includes all the packages that the package set defines.
|
1504
|
+
def each_metapackage(&block)
|
1505
|
+
metapackages.each_value(&block)
|
1506
|
+
end
|
1507
|
+
|
1337
1508
|
# Returns the packages contained in the provided layout definition
|
1338
1509
|
#
|
1339
1510
|
# If recursive is false, yields only the packages at this level.
|
@@ -1343,7 +1514,9 @@ module Autoproj
|
|
1343
1514
|
normalized_layout.each_key do |pkg_or_set|
|
1344
1515
|
begin
|
1345
1516
|
resolve_package_set(pkg_or_set).each do |pkg_name|
|
1346
|
-
|
1517
|
+
if !excluded?(pkg_name) && !ignored?(pkg_name)
|
1518
|
+
result << pkg_name
|
1519
|
+
end
|
1347
1520
|
Autobuild::Package[pkg_name].all_dependencies(result)
|
1348
1521
|
end
|
1349
1522
|
rescue ConfigError
|
@@ -1377,8 +1550,11 @@ module Autoproj
|
|
1377
1550
|
|
1378
1551
|
# Returns all the packages that can be built in this installation
|
1379
1552
|
def all_packages
|
1380
|
-
|
1381
|
-
|
1553
|
+
result = Set.new
|
1554
|
+
each_package_set do |pkg_set|
|
1555
|
+
result |= metapackage(pkg_set.name).packages.map(&:name).to_set
|
1556
|
+
end
|
1557
|
+
result.to_a.
|
1382
1558
|
find_all { |pkg_name| !Autoproj.osdeps || !Autoproj.osdeps.has?(pkg_name) }
|
1383
1559
|
end
|
1384
1560
|
|
@@ -1480,7 +1656,9 @@ module Autoproj
|
|
1480
1656
|
end
|
1481
1657
|
|
1482
1658
|
manifest_path = File.join(package.srcdir, "manifest.xml")
|
1483
|
-
if !File.
|
1659
|
+
if !File.directory?(package.srcdir)
|
1660
|
+
return
|
1661
|
+
elsif !File.file?(manifest_path)
|
1484
1662
|
Autoproj.warn "#{package.name} from #{source.name} does not have a manifest"
|
1485
1663
|
return
|
1486
1664
|
end
|
@@ -1614,12 +1792,13 @@ module Autoproj
|
|
1614
1792
|
matches[sel] = packages
|
1615
1793
|
expanded_packages |= packages
|
1616
1794
|
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1795
|
+
each_metapackage do |pkg|
|
1796
|
+
if pkg.name =~ sel
|
1797
|
+
packages = resolve_package_set(pkg.name).to_set
|
1798
|
+
packages = (packages & all_layout_packages)
|
1799
|
+
matches[sel] |= packages
|
1800
|
+
expanded_packages |= packages
|
1801
|
+
end
|
1623
1802
|
end
|
1624
1803
|
end
|
1625
1804
|
|
data/lib/autoproj/options.rb
CHANGED
@@ -177,6 +177,10 @@ module Autoproj
|
|
177
177
|
config_file = File.join(Autoproj.config_dir, "config.yml")
|
178
178
|
if File.exists?(config_file)
|
179
179
|
config = YAML.load(File.read(config_file))
|
180
|
+
if !config
|
181
|
+
return
|
182
|
+
end
|
183
|
+
|
180
184
|
config.each do |key, value|
|
181
185
|
@user_config[key] = [value, false]
|
182
186
|
end
|
data/lib/autoproj/osdeps.rb
CHANGED
@@ -155,17 +155,21 @@ module Autoproj
|
|
155
155
|
# one.
|
156
156
|
#
|
157
157
|
# Examples: ['debian', ['sid', 'unstable']] or ['ubuntu', ['lucid lynx', '10.04']]
|
158
|
-
def self.operating_system
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
158
|
+
def self.operating_system(options = Hash.new)
|
159
|
+
options = Kernel.validate_options options, :force => false
|
160
|
+
|
161
|
+
if !options[:force]
|
162
|
+
if !@operating_system.nil?
|
163
|
+
return @operating_system
|
164
|
+
elsif Autoproj.has_config_key?('operating_system')
|
165
|
+
os = Autoproj.user_config('operating_system')
|
166
|
+
if os.respond_to?(:to_ary)
|
167
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
168
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
169
|
+
@operating_system = os
|
170
|
+
return os
|
171
|
+
end
|
172
|
+
end
|
169
173
|
end
|
170
174
|
end
|
171
175
|
|
data/lib/autoproj/system.rb
CHANGED
@@ -166,20 +166,26 @@ module Autoproj
|
|
166
166
|
# If any error is detected, the backtrace will be filtered so that it is
|
167
167
|
# easier to understand by the user. Moreover, if +source+ is non-nil, the
|
168
168
|
# package set name will be mentionned.
|
169
|
-
def self.load(
|
169
|
+
def self.load(package_set, *path)
|
170
170
|
path = File.join(*path)
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
in_package_set(package_set, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')) do
|
172
|
+
begin
|
173
|
+
Kernel.load path
|
174
|
+
rescue Interrupt
|
175
|
+
raise
|
176
|
+
rescue ConfigError => e
|
177
|
+
raise
|
178
|
+
rescue Exception => e
|
179
|
+
filter_load_exception(e, package_set, path)
|
180
|
+
end
|
181
|
+
end
|
176
182
|
end
|
177
183
|
|
178
184
|
# Same as #load, but runs only if the file exists.
|
179
|
-
def self.load_if_present(
|
185
|
+
def self.load_if_present(package_set, *path)
|
180
186
|
path = File.join(*path)
|
181
187
|
if File.file?(path)
|
182
|
-
self.load(
|
188
|
+
self.load(package_set, *path)
|
183
189
|
end
|
184
190
|
end
|
185
191
|
|
data/lib/autoproj/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424039
|
5
|
+
prerelease: 7
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
|
9
|
+
- 12
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.7.12.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Sylvain Joyeux
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-
|
20
|
+
date: 2011-07-14 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: autobuild
|
@@ -242,12 +244,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
245
|
none: false
|
244
246
|
requirements:
|
245
|
-
- - "
|
247
|
+
- - ">"
|
246
248
|
- !ruby/object:Gem::Version
|
247
|
-
hash:
|
249
|
+
hash: 25
|
248
250
|
segments:
|
249
|
-
-
|
250
|
-
|
251
|
+
- 1
|
252
|
+
- 3
|
253
|
+
- 1
|
254
|
+
version: 1.3.1
|
251
255
|
requirements: []
|
252
256
|
|
253
257
|
rubyforge_project: autobuild
|