autoproj 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ = Version 1.2.0
2
+ * added the rebuild and force-build modes
3
+ * added a local source that allows to override imported package sets and so on.
4
+ * improved documentation on the subject of customizing the installation
5
+
1
6
  = Version 1.1.3
2
7
  * fix --reconfigure on installations where the main configuration is managed by
3
8
  a VCS
data/Manifest.txt CHANGED
@@ -9,6 +9,7 @@ doc/guide/ext/previous_next.rb
9
9
  doc/guide/ext/rdoc_links.rb
10
10
  doc/guide/src/autobuild.page
11
11
  doc/guide/src/autoproj_bootstrap
12
+ doc/guide/src/customization.page
12
13
  doc/guide/src/default.css
13
14
  doc/guide/src/default.template
14
15
  doc/guide/src/htmldoc.metainfo
@@ -28,7 +29,10 @@ lib/autoproj/options.rb
28
29
  lib/autoproj/osdeps.rb
29
30
  lib/autoproj/system.rb
30
31
  lib/autoproj/version.rb
31
- samples/manifest
32
+ samples/autoproj/init.rb
33
+ samples/autoproj/manifest
34
+ samples/autoproj/overrides.rb
35
+ samples/autoproj/overrides.yml
32
36
  samples/manifest.xml
33
37
  samples/osdeps.yml
34
38
  test/data/test_manifest/autoproj/local/local.autobuild
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ begin
14
14
  self.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
15
15
 
16
16
  extra_deps <<
17
- ['autobuild', '>= 1.3.0'] <<
17
+ ['autobuild', '>= 1.4.0'] <<
18
18
  ['rmail', '>= 1.0.0'] <<
19
19
  ['utilrb', '>= 1.3.3'] <<
20
20
  ['nokogiri', '>= 1.3.3'] <<
data/bin/autoproj CHANGED
@@ -31,6 +31,8 @@ parser = OptionParser.new do |opts|
31
31
  autoproj mode [options]
32
32
  where 'mode' is one of:
33
33
  build: import, build and install all selected packages
34
+ force-build: triggers all build commands, i.e. don't be lazy like in "build"
35
+ rebuild: remove all build products, thus triggering a full rebuild
34
36
  doc: generate and install documentation for packages that have some
35
37
  update: only import/update packages, do not build them
36
38
  status: displays the state of the packages w.r.t. their source VCS
@@ -184,15 +186,25 @@ def do_bootstrap(*args)
184
186
  end
185
187
  Autobuild.logdir = File.join('build', 'log')
186
188
 
187
- if args.empty? # no argument, simply add a manifest template
189
+ if args.size > 2
190
+ raise ConfigError, "usage: autoproj bootstrap [manifest_url | vcs_type vcs_url]"
191
+ end
192
+
193
+ # Check if we are being called from another GEM_HOME. If it is the case,
194
+ # assume that we are bootstrapping from another installation directory and
195
+ # start by copying the .gems directory
196
+ if ENV['GEM_HOME'] && ENV['GEM_HOME'] != File.join(Dir.pwd, ".gems")
197
+ FileUtils.cp_r ENV['GEM_HOME'], ".gems"
198
+ end
199
+
200
+ # If we are not getting the installation setup from a VCS, copy the template
201
+ # files
202
+ if args.empty? || args.size == 1
188
203
  sample_dir = File.expand_path(File.join("..", "samples"), File.dirname(__FILE__))
189
- manifest_data = File.read(File.join(sample_dir, "manifest"))
190
- FileUtils.mkdir_p "autoproj"
191
- File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
192
- io.write(manifest_data)
193
- end
204
+ FileUtils.cp_r File.join(sample_dir, "autoproj"), "autoproj"
205
+ end
194
206
 
195
- elsif args.size == 1 # must be a manifest file
207
+ if args.size == 1 # the user asks us to download a manifest
196
208
  manifest_url = args.first
197
209
  STDERR.puts color("autoproj: downloading manifest file #{manifest_url}", :bold)
198
210
  manifest_data =
@@ -201,12 +213,11 @@ def do_bootstrap(*args)
201
213
  raise ConfigError, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
202
214
  end
203
215
 
204
- FileUtils.mkdir_p "autoproj"
205
216
  File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
206
217
  io.write(manifest_data)
207
218
  end
208
219
 
209
- else # is a VCS definition for the manifest itself ...
220
+ elsif args.size == 2 # is a VCS definition for the manifest itself ...
210
221
  vcs_def = Hash.new
211
222
  vcs_def[:type] = args.shift
212
223
  vcs_def[:url] = args.shift
@@ -234,6 +245,27 @@ manifest_source:
234
245
  EOTEXT
235
246
  end
236
247
  end
248
+
249
+ # Finally, generate an env.sh script
250
+ File.open('env.sh', 'w') do |io|
251
+ io.write <<-EOSHELL
252
+ export RUBYOPT=-rubygems
253
+ export GEM_HOME=#{Dir.pwd}/.gems
254
+ export PATH=$GEM_HOME/bin:$PATH
255
+ EOSHELL
256
+ end
257
+
258
+ STDERR.puts <<EOTEXT
259
+
260
+ add the following line at the bottom of your .bashrc:
261
+ source #{Dir.pwd}/env.sh
262
+
263
+ WARNING: autoproj will not work until your restart all
264
+ your consoles, or run the following in them:
265
+ $ source #{Dir.pwd}/env.sh
266
+
267
+ EOTEXT
268
+
237
269
  end
238
270
 
239
271
  # Find the autoproj root dir
@@ -254,6 +286,10 @@ begin
254
286
  only_update_sources = true
255
287
 
256
288
  when "build"
289
+ when "force-build"
290
+ Autobuild.do_forced_build = true
291
+ when "rebuild"
292
+ Autobuild.do_rebuild = true
257
293
  when "update"
258
294
  Autobuild.do_build = false
259
295
  when "status"
@@ -286,9 +322,9 @@ begin
286
322
  raise ConfigError, "RubyGems is already loaded with a different GEM_HOME, make sure you are loading the right env.sh script !"
287
323
  end
288
324
  end
289
- # Set the initial environment
290
- Autoproj.set_initial_env
291
325
  # Set up some important autobuild parameters
326
+ Autoproj.env_inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB'
327
+ Autoproj.env_set 'GEM_HOME', Autoproj.gem_home
292
328
  Autobuild.prefix = Autoproj.build_dir
293
329
  Autobuild.srcdir = root_dir
294
330
  Autobuild.logdir = File.join(Autobuild.prefix, 'log')
@@ -344,14 +380,7 @@ begin
344
380
  # Load init.rb files. each_source must not load the source.yml file, as
345
381
  # init.rb may define configuration options that are used there
346
382
  manifest.each_source(false) do |source|
347
- init_rb = File.join(source.local_dir, "init.rb")
348
- if File.exists?(init_rb)
349
- begin
350
- load init_rb
351
- rescue Exception => e
352
- Autoproj.filter_load_exception(e, source, init_rb)
353
- end
354
- end
383
+ Autoproj.load_if_present(source, source.local_dir, "init.rb")
355
384
  end
356
385
 
357
386
  # Load the required autobuild definitions
@@ -363,6 +392,13 @@ begin
363
392
  Autoproj.import_autobuild_file source, name
364
393
  end
365
394
 
395
+ # Load the package's override files. each_source must not load the
396
+ # source.yml file, as init.rb may define configuration options that are used
397
+ # there
398
+ manifest.each_source(false).to_a.reverse.each do |source|
399
+ Autoproj.load_if_present(source, source.local_dir, "overrides.rb")
400
+ end
401
+
366
402
  # The user is asked for configuration values both during the manifest
367
403
  # loading and the loading of autobuild files. Save it now.
368
404
  Autoproj.save_config
@@ -519,12 +555,6 @@ begin
519
555
  manifest.install_os_dependencies(all_enabled_packages)
520
556
  end
521
557
 
522
- # Call the prepare target now, after we did the import *and* loaded
523
- # the manifests
524
- prepare_targets = all_enabled_packages.map { |pkg| "#{pkg}-prepare" }
525
- task "autoproj-#{name}-prepare" => prepare_targets
526
- Rake::Task["autoproj-#{name}-prepare"].invoke
527
-
528
558
  # And now build
529
559
  if Autobuild.only_doc
530
560
  STDERR.puts color(" building and installing documentation", :bold)
@@ -532,7 +562,7 @@ begin
532
562
  STDERR.puts color(" building and installing packages", :bold)
533
563
  end
534
564
 
535
- Autobuild.apply(enabled_packages, "autoproj-#{name}")
565
+ Autobuild.apply(all_enabled_packages, "autoproj-#{name}")
536
566
  Autobuild::Reporting.success
537
567
  end
538
568
  end
@@ -0,0 +1,168 @@
1
+ ---
2
+ title: Customizing the installation
3
+ sort_info: 75
4
+ ---
5
+
6
+ Changing the installation's layout
7
+ ----------------------------------
8
+
9
+ The <tt>layout</tt> section of <tt>autoproj/manifest</tt> offers two things:
10
+ * select which packages/package sets to build and
11
+ * build packages in specific subdirectories
12
+
13
+ This section lists packages or package sets that ought to be built by autoproj.
14
+ For instance, in the following example, only the <tt>orocos/rtt</tt> and
15
+ <tt>orocos/ocl</tt>
16
+ packages of the rubim.orocos source will be built. The other will be excluded
17
+ from the build.
18
+
19
+ {coderay:: yaml}
20
+ package_sets:
21
+ - type: git
22
+ url: git://github.com/doudou/rubim.orocos.git
23
+
24
+ layout:
25
+ - orocos/rtt
26
+ - orocos/ocl
27
+ {coderay}
28
+
29
+ Instead of giving a package name, the name of a package set can be provided,
30
+ which translates into "all the packages of that set".
31
+
32
+ As we mentionned before, the layout mechanism also allows you to place packages
33
+ in subdirectories of the main installation. For instance, the following snippet
34
+ will build the <tt>typelib</tt>, <tt>utilmm</tt> and <tt>utilrb</tt> libraries of rubim.orocos into
35
+ the <tt>lib/</tt> subdirectory and all the <tt>orocos/</tt> packages in the root.
36
+
37
+ {coderay:: yaml}
38
+ layout:
39
+ - lib:
40
+ - typelib
41
+ - utilmm
42
+ - utilrb
43
+ - orocos/
44
+ {coderay}
45
+
46
+ Finally, names of sublayouts can be used as arguments in the autoproj command
47
+ line, instead of package names:
48
+
49
+ autoproj build lib
50
+ {.commandline}
51
+
52
+ Removing packages from the build
53
+ --------------------------------
54
+ Instead of having to list all packages that you do want to build, it is possible
55
+ to list the packages that you don't want to build. Simply list them in the
56
+ <tt>exclude\_packages</tt> section of the manifest file. In the following example, all
57
+ of the rubim.orocos package set will be built *but* the pocosim-log package.
58
+
59
+ {coderay:: yaml}
60
+ layout:
61
+ - rubim.orocos
62
+
63
+ exclude_packages:
64
+ - pocosim-log
65
+ {coderay}
66
+
67
+ Using packages that are already installed
68
+ -----------------------------------------
69
+
70
+ If some packages are already installed elsewhere, and you want to use that
71
+ version instead of the one listed in the package sets, list them in the
72
+ <tt>ignore\_packages</tt> section of the manifest. In the following example, the
73
+ <tt>orocos/rtt</tt> package will *not* be built by autoproj.
74
+
75
+ {coderay:: yaml}
76
+ layout:
77
+ - rubim.orocos
78
+
79
+ exclude_packages:
80
+ - pocosim-log
81
+
82
+ ignore_packages:
83
+ - orocos/rtt
84
+ {coderay}
85
+
86
+ This differs from the <tt>exclude\_packages</tt> mechanism: packages listed in
87
+ <tt>ignore\_packages</tt> are assumed to be present even though autoproj does not manage
88
+ them, while packages in <tt>exclude\_packages</tt> are assumed to be absent and therefore
89
+ issue an error if another package in the installation depend on them.
90
+
91
+ Local overrides of version control information
92
+ ----------------------------------------------
93
+
94
+ The <tt>autoproj/overrides.yml</tt> allows you to override version control information
95
+ for specific packages. It has the same format than the source.yml file of
96
+ package sets, so [check that page out](source_yml.html) for more information.
97
+
98
+ This file can in particular be used to avoid further updates to a given software
99
+ package. Simply do:
100
+
101
+ {coderay:: yaml}
102
+ version_control:
103
+ - orocos/rtt:
104
+ type: none
105
+ {coderay}
106
+
107
+ Building local packages
108
+ -----------------------
109
+
110
+ You can list local packages that are not in an imported package set by placing
111
+ the definitions in autoproj/, in a file ending with <tt>.autobuild</tt>. See [this
112
+ page](source_yml.html) for information on how to write autobuild files.
113
+
114
+ Setting up the path to specific commands (make, parallel_builds)
115
+ ----------------------------------------------------------------
116
+
117
+ The autobuild API allows to specify what specific installed command to use for
118
+ each tool needed during the build. These commands can be used in
119
+ <tt>autoproj/init.rb</tt> to tune the build system. Example:
120
+
121
+ {coderay:: ruby}
122
+ Autobuild.commands['make'] = '/path/to/ccmake'
123
+ Autobuild.parallel_build_level = 10 # build with -j10
124
+ {coderay}
125
+
126
+ More complex customization
127
+ --------------------------
128
+
129
+ More complex customization can be achieved by accessing the Autoproj and
130
+ Autobuild API directly in the <tt>autoproj/init.rb</tt> and
131
+ <tt>autoproj/overrides.rb</tt>
132
+ files. The former is loaded before all source files and the latter is loaded
133
+ after all source files.
134
+
135
+ Building packages selectively on the command line
136
+ -------------------------------------------------
137
+
138
+ The autoproj command line accepts subdirectories defined in the layout as well
139
+ as package names.
140
+
141
+ For instance, with the following layout:
142
+
143
+ {coderay:: yaml}
144
+ layout:
145
+ - typelib
146
+ - asguard:
147
+ - modules/base
148
+ - modules/logger
149
+ {coderay}
150
+
151
+ If the command line is
152
+
153
+ autoproj build modules/logger
154
+ {.cmdline}
155
+
156
+ then only modules/logger and modules/base will be built -- assuming
157
+ modules/logger depends on modules/base -- but typelib will be left alone
158
+ _regardless of its state_. It may speed up the build process tremendously, but
159
+ also may generate errors if other packages needed to be updated.
160
+
161
+ Idem, if the command line is:
162
+
163
+ autoproj build asguard
164
+ {.cmdline}
165
+
166
+ then all packages or asguard/ are built _but none of the dependencies that are
167
+ defined in other places in the layout_.
168
+
@@ -12,12 +12,14 @@ Structure
12
12
  A autoproj installation is characterized by a autoproj/ directory in which all
13
13
  autoproj-related configuration is saved. The contained files are as follows:
14
14
 
15
- * autoproj/manifest: list of available package sets, layout of the
16
- installation. See "Management" below.
15
+ * autoproj/manifest: list of available package sets, customization options.
16
+ The first part is covered here, the second in the next page.
17
17
  * .remotes/\*: package sets that are imported from a remote version
18
18
  control system
19
19
  * autoproj/\*/: local sets, i.e. sets that have not been imported from a remote
20
20
  version control system.
21
+ * autoproj\/init.rb, autoproj\/overrides.rb and autoproj\/overrides.yml:
22
+ installation customization
21
23
 
22
24
  The build is done in two steps:
23
25
 
@@ -30,38 +32,23 @@ Moreover, the <tt>build/log</tt> directory contains the output of all commands
30
32
  that have been run during the build. Finally, a <tt>env.sh</tt> script is
31
33
  generated to set up your shell for the use of the installed software.
32
34
 
33
- Toplevel manifest
34
- -----------------
35
- The <tt>autoproj/manifest</tt> file is a yaml file which describes the package
36
- sets that are available, and how packages are organized in the installation. It
37
- looks like this:
35
+ Listing and adding package sets
36
+ -------------------------------
37
+ Package sets are listed in the <tt>package\_sets</tt> section of
38
+ <tt>autoproj/manifest</tt> file. This section looks like this:
38
39
 
39
40
  {coderay:: yaml}
40
- layout:
41
- - autoproj.orocos
42
- - asguard:
43
- - dfki.imoby
44
-
45
41
  package_sets:
46
42
  - imoby
47
43
  - type: git
48
44
  url: git://github.com/doudou/autoproj-orocos.git
49
45
  {coderay}
50
46
 
51
- The first section, the <tt>layout</tt> section, lists the packages or package
52
- sets we want to have in this installation. It is a layout, meaning that some packages
53
- can be built and installed in a subdirectory of the main installation
54
- (see "Layouts and dependencies" below). Packages are referred to by the name they
55
- have in the autobuild file (see [this page for more details](source_yml.hml)).
56
- Package sets are referred to by the name given in the [set's <tt>source.yml</tt>
57
- file](source_yml.html), and are interpreted as "build all packages of the given
58
- set".
59
-
60
- The second section, the <tt>package_sets</tt> section, lists both local and remote
61
- sets that are available to this installation. Local sets are
62
- subdirectories of the <tt>autoproj/</tt> directory: for instance, in the above
63
- example, autoproj will look at the <tt>autoproj/imoby/</tt> directory. Remote
64
- sets are taken from remote version control systems. Its general format is:
47
+ It lists both local and remote sets that are available for this installation.
48
+ Local sets are subdirectories of the <tt>autoproj/</tt> directory: for instance,
49
+ in the above example, autoproj will look at the <tt>autoproj/imoby/</tt>
50
+ directory. Remote sets are taken from remote version control systems. Its
51
+ general format is:
65
52
 
66
53
  {coderay:: yaml}
67
54
  - type: version_control_type # git, svn, cvs, darcs
@@ -76,6 +63,9 @@ For the git importer, one of 'branch' or 'tag' options can be provided as well:
76
63
  tag: tag_to_stick_to # it is branch OR tag
77
64
  {coderay}
78
65
 
66
+ Imported package sets are saved in the <tt>.remotes</tt> directory of the
67
+ autoproj installation.
68
+
79
69
  Management
80
70
  ----------
81
71
 
@@ -105,6 +95,18 @@ If, on the other hand, you only want to update the source code, do
105
95
  autoproj update
106
96
  {.commandline}
107
97
 
98
+ Finally, if you want to make sure that your build is fresh, then do
99
+
100
+ autoproj rebuild
101
+ {.commandline}
102
+
103
+ A less intrusive version of it only forces all tools to reconsider building. It
104
+ is mainly useful for CMake when the build environment changed -- cmake caches a
105
+ lot of values. To trigger this, do
106
+
107
+ autoproj force-build
108
+ {.commandline}
109
+
108
110
  To add a new set, one edits the <tt>autoproj/manifest</tt> file and adds it
109
111
  there. Then, simply starting the build will update everything and rebuild what
110
112
  is needed.
@@ -114,40 +116,10 @@ Documentation is generated only when asked explicitely:
114
116
  autoproj doc
115
117
  {.commandline}
116
118
 
117
- Building packages selectively on the command line
118
- -------------------------------------------------
119
-
120
- All the build-related commands given above (i.e. build, doc, and update) can be
121
- given a package name or a name used as a subdirectory in the layout section of
122
- the manifest.
123
-
124
- In the first case, only the package and the dependencies _that are on the same
125
- level on the installation layout_ are built. It means that with the following
126
- layout:
119
+ All these commands (i.e. build, doc, and update) accept a package name as
120
+ argument, thus triggering build only for this package and its dependencies. For
121
+ instance:
127
122
 
128
- {coderay:: yaml}
129
- layout:
130
- - typelib
131
- - asguard:
132
- - modules/base
133
- - modules/logger
134
- {coderay}
135
-
136
- If the command line is
137
-
138
- autoproj build modules/logger
139
- {.cmdline}
140
-
141
- then only modules/logger and modules/base will be built -- assuming
142
- modules/logger depends on modules/base -- but typelib will be left alone
143
- _regardless of its state_. It may speed up the build process tremendously, but
144
- also may generate errors if other packages needed to be updated.
145
-
146
- Idem, if the command line is:
147
-
148
- autoproj build asguard
149
- {.cmdline}
150
-
151
- then all packages or asguard/ are built _but none of the dependencies that are
152
- defined in other places in the layout_.
123
+ autoproj build orocos/rtt
124
+ {.commandline}
153
125
 
@@ -61,7 +61,7 @@ module Autoproj
61
61
 
62
62
  @file_stack.push([source, File.basename(path)])
63
63
  begin
64
- load path
64
+ Kernel.load path
65
65
  rescue Exception => e
66
66
  filter_load_exception(e, source, path)
67
67
  end
@@ -86,10 +86,16 @@ def package_common(package_type, spec)
86
86
 
87
87
  begin
88
88
  Rake::Task[package_name]
89
- Autoproj.warn "#{package_name} in #{Autoproj.current_file[0]} has been overriden in #{Autoproj.definition_source(package_name)}"
89
+ Autoproj.warn "#{package_name} from #{Autoproj.current_file[0]} is overriden by the definition in #{Autoproj.definition_source(package_name)}"
90
+ return
90
91
  rescue
91
92
  end
92
93
 
94
+ # Check if this package is ignored
95
+ if Autoproj.manifest.ignored?(package_name)
96
+ return Autoproj.define(:dummy, spec)
97
+ end
98
+
93
99
  Autoproj.define(package_type, spec) do |pkg|
94
100
  pkg.srcdir = pkg.name
95
101
  yield(pkg) if block_given?
@@ -129,6 +135,22 @@ def autotools_package(options, &block)
129
135
  end
130
136
 
131
137
  def ruby_common(pkg)
138
+ def pkg.prepare_for_forced_build
139
+ super
140
+ extdir = File.join(srcdir, 'ext')
141
+ if File.directory?(extdir)
142
+ FileUtils.rm_rf File.join(extdir, "build", "CMakeCache.txt")
143
+ FileUtils.rm_rf File.join(extdir, "Makefile")
144
+ end
145
+ end
146
+ def pkg.prepare_for_rebuild
147
+ super
148
+ extdir = File.join(srcdir, 'ext')
149
+ if File.directory?(extdir)
150
+ FileUtils.rm_rf File.join(extdir, "build")
151
+ end
152
+ end
153
+
132
154
  def pkg.prepare
133
155
  super
134
156
  Autobuild.update_environment srcdir
@@ -28,18 +28,19 @@ module Autoproj
28
28
  # Perform constant expansion on the defined environment variables,
29
29
  # including the option set
30
30
  options = Autoproj.option_set
31
- if Autoproj.manifest
32
- loop do
33
- new_value = Autoproj.manifest.single_expansion(value, options)
34
- if new_value == value
35
- break
36
- else
37
- value = new_value
38
- end
31
+ options.each_key do |k|
32
+ options[k] = options[k].to_s
33
+ end
34
+
35
+ loop do
36
+ new_value = Autoproj.single_expansion(value, options)
37
+ if new_value == value
38
+ break
39
+ else
40
+ value = new_value
39
41
  end
40
- else
41
- value
42
42
  end
43
+ value
43
44
  end
44
45
 
45
46
  @env_inherit = Set.new
@@ -75,7 +76,7 @@ module Autoproj
75
76
 
76
77
  def initialize(type, url, options)
77
78
  @type, @url, @options = type, url, options
78
- if type != "local" && !Autobuild.respond_to?(type)
79
+ if type != "none" && type != "local" && !Autobuild.respond_to?(type)
79
80
  raise ConfigError, "version control #{type} is unknown to autoproj"
80
81
  end
81
82
  end
@@ -85,6 +86,8 @@ module Autoproj
85
86
  end
86
87
 
87
88
  def create_autobuild_importer
89
+ return if type == "none"
90
+
88
91
  url = Autoproj.single_expansion(self.url, 'HOME' => ENV['HOME'])
89
92
  if url && url !~ /^(\w+:\/)?\/|^\w+\@/
90
93
  url = File.expand_path(url, Autoproj.root_dir)
@@ -202,7 +205,7 @@ module Autoproj
202
205
  raise ConfigError, "error in #{source_file}: #{e.message}"
203
206
  end
204
207
 
205
- if !source_definition
208
+ if !source_definition || !source_definition['name']
206
209
  raise ConfigError, "#{source_file} does not have a 'name' field"
207
210
  end
208
211
 
@@ -212,6 +215,10 @@ module Autoproj
212
215
  def load_name
213
216
  definition = raw_description_file
214
217
  @name = definition['name']
218
+ if @name == "local"
219
+ raise ConfigError, "source #{self} is named 'local', but this is a reserved name"
220
+ end
221
+
215
222
  rescue InternalError
216
223
  end
217
224
 
@@ -336,6 +343,33 @@ module Autoproj
336
343
  end
337
344
  end
338
345
 
346
+ class LocalSource < Source
347
+ def initialize
348
+ super(Autoproj.normalize_vcs_definition(:type => 'local', :url => Autoproj.config_dir))
349
+ end
350
+
351
+ def name
352
+ 'local'
353
+ end
354
+ def load_name
355
+ end
356
+
357
+ def raw_description_file
358
+ path = File.join(Autoproj.config_dir, "overrides.yml")
359
+ if File.file?(path)
360
+ begin
361
+ data = YAML.load(File.read(path)) || Hash.new
362
+ rescue ArgumentError => e
363
+ raise ConfigError, "error in #{source_file}: #{e.message}"
364
+ end
365
+ data['name'] = 'local'
366
+ data
367
+ else
368
+ { 'name' => 'local' }
369
+ end
370
+ end
371
+ end
372
+
339
373
  class Manifest
340
374
  FakePackage = Struct.new :name, :srcdir
341
375
  def self.load(file)
@@ -372,6 +406,30 @@ module Autoproj
372
406
  end
373
407
  end
374
408
 
409
+ # True if the given package should not be built, with the packages that
410
+ # depend on him have this dependency met.
411
+ #
412
+ # This is useful if the packages are already installed on this system.
413
+ def ignored?(package_name)
414
+ if data['ignored_packages']
415
+ data['ignored_packages'].any? { |l| Regexp.new(l) =~ package_name }
416
+ else
417
+ false
418
+ end
419
+ end
420
+ # True if the given package should not be built and its dependencies
421
+ # should be considered as met.
422
+ #
423
+ # This is useful to avoid building packages that are of no use for the
424
+ # user.
425
+ def excluded?(package_name)
426
+ if data['excluded_packages']
427
+ data['excluded_packages'].any? { |l| Regexp.new(l) =~ package_name }
428
+ else
429
+ false
430
+ end
431
+ end
432
+
375
433
  # Lists the autobuild files that are in the package sets we know of
376
434
  def each_autobuild_file(source_name = nil, &block)
377
435
  if !block_given?
@@ -427,6 +485,28 @@ module Autoproj
427
485
  end
428
486
  end
429
487
 
488
+ def source_from_spec(spec, load_description) # :nodoc:
489
+ # Look up for short notation (i.e. not an explicit hash). It is
490
+ # either vcs_type:url or just url. In the latter case, we expect
491
+ # 'url' to be a path to a local directory
492
+ vcs_def = begin
493
+ Autoproj.normalize_vcs_definition(spec)
494
+ rescue ConfigError => e
495
+ raise ConfigError, "in #{file}: #{e.message}"
496
+ end
497
+
498
+ source = Source.new(vcs_def)
499
+ if source.present? && load_description
500
+ source.load_description_file
501
+ else
502
+ # Try to load just the name from the source.yml file
503
+ source.load_name
504
+ end
505
+
506
+ source
507
+ end
508
+
509
+
430
510
  # call-seq:
431
511
  # each_source { |source_description| ... }
432
512
  #
@@ -439,25 +519,17 @@ module Autoproj
439
519
 
440
520
  return if !data['package_sets']
441
521
 
442
- data['package_sets'].each do |spec|
443
- # Look up for short notation (i.e. not an explicit hash). It is
444
- # either vcs_type:url or just url. In the latter case, we expect
445
- # 'url' to be a path to a local directory
446
- vcs_def = begin
447
- Autoproj.normalize_vcs_definition(spec)
448
- rescue ConfigError => e
449
- raise ConfigError, "in #{file}: #{e.message}"
450
- end
451
-
452
- source = Source.new(vcs_def)
453
- if source.present? && load_description
454
- source.load_description_file
455
- else
456
- # Try to load just the name from the source.yml file
457
- source.load_name
458
- end
522
+ # Load the local source first ...
523
+ local = LocalSource.new
524
+ if load_description
525
+ local.load_description_file
526
+ else
527
+ local.load_name
528
+ end
529
+ yield(local)
459
530
 
460
- yield(source)
531
+ data['package_sets'].each do |spec|
532
+ yield(source_from_spec(spec, load_description))
461
533
  end
462
534
  end
463
535
 
@@ -483,6 +555,7 @@ module Autoproj
483
555
 
484
556
  def self.update_remote_source(source)
485
557
  importer = source.vcs.create_autobuild_importer
558
+ return if !importer # updates have been disabled
486
559
  fake_package = FakePackage.new(source.automatic_name, source.local_dir)
487
560
 
488
561
  importer.import(fake_package)
@@ -493,6 +566,7 @@ module Autoproj
493
566
  attr_reader :vcs
494
567
  def self.import_whole_installation(vcs, into)
495
568
  importer = vcs.create_autobuild_importer
569
+ return if !importer # updates have been disabled
496
570
  fake_package = FakePackage.new('autoproj main configuration', into)
497
571
  importer.import(fake_package)
498
572
  rescue Autobuild::ConfigException => e
@@ -597,7 +671,7 @@ module Autoproj
597
671
  # and sublayout in order
598
672
  def each_package_set(selection, layout_name = '/', layout_def = data['layout'], &block)
599
673
  if !layout_def
600
- yield('', default_packages, default_packages)
674
+ yield('/', default_packages, default_packages)
601
675
  return nil
602
676
  end
603
677
 
@@ -605,6 +679,9 @@ module Autoproj
605
679
 
606
680
  # First of all, do the packages at this level
607
681
  packages = layout_packages(layout_def, false)
682
+ # Remove excluded packages
683
+ packages.delete_if { |pkg_name| excluded?(pkg_name) }
684
+
608
685
  if selection && !selection.any? { |sel| layout_name =~ /^\/?#{Regexp.new(sel)}\/?/ }
609
686
  selected_packages = packages.find_all { |pkg_name| selection.include?(pkg_name) }
610
687
  else
@@ -629,6 +706,7 @@ module Autoproj
629
706
  package.name
630
707
  end
631
708
  end
709
+ names = names.delete_if { |pkg_name| excluded?(pkg_name) }
632
710
  names.to_set
633
711
  end
634
712
 
@@ -50,7 +50,6 @@ module Autoproj
50
50
  Autoproj.env_set_path 'PATH', "#{Autoproj.gem_home}/bin", "/usr/local/bin", "/usr/bin", "/bin"
51
51
  Autoproj.env_set 'PKG_CONFIG_PATH'
52
52
  Autoproj.env_set 'RUBYLIB'
53
- Autoproj.env_inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB'
54
53
  end
55
54
 
56
55
  def self.export_env_sh(subdir)
@@ -68,5 +67,19 @@ module Autoproj
68
67
  end
69
68
  end
70
69
  end
70
+
71
+ def self.load(source, *path)
72
+ path = File.join(*path)
73
+ Kernel.load path
74
+ rescue Exception => e
75
+ Autoproj.filter_load_exception(e, source, path)
76
+ end
77
+
78
+ def self.load_if_present(source, *path)
79
+ path = File.join(*path)
80
+ if File.file?(path)
81
+ self.load(source, *path)
82
+ end
83
+ end
71
84
  end
72
85
 
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,23 @@
1
+ # Write in this file customization code that will get executed before all the
2
+ # soures are loaded.
3
+
4
+ # Set the path to 'make'
5
+ # Autobuild.commands['make'] = '/path/to/ccmake'
6
+
7
+ # Set the parallel build level (defaults to the number of CPUs)
8
+ # Autobuild.parallel_build_level = 10
9
+
10
+ # Uncomment to initialize the environment variables to default values. This is
11
+ # useful to ensure that the build is completely self-contained, but leads to
12
+ # miss external dependencies installed in non-standard locations.
13
+ #
14
+ # set_initial_env
15
+ #
16
+ # Additionally, you can set up your own custom environment with calls to env_add
17
+ # and env_set:
18
+ #
19
+ # env_add 'PATH', "/path/to/my/tool"
20
+ # env_set 'VAR', "value"
21
+ #
22
+ # Variables set like this are exported in the generated env.sh scripts.
23
+
@@ -0,0 +1,52 @@
1
+ # List of VCS information or subdirectories of autoproj/ in which to find
2
+ # package set definitions.
3
+ package_sets:
4
+ # Example from the RubyInMotion orocos package set
5
+ # - type: git
6
+ # url: git://github.com/doudou/rubim.orocos.git
7
+
8
+ # The layout section specifies what to build, and where to build it (as a
9
+ # subdirectory of the root installation directory). In the example below, all
10
+ # the packages of the rubim.orocos package set will be built, in the tools/
11
+ # subdirectory: source in tools/typelib, tools/orocos/rtt, ... and installed
12
+ # files in build/tools/typelib, build/tools/orocos/rtt, ...
13
+ #
14
+ # layout:
15
+ # - tools:
16
+ # - rubim.orocos
17
+ #
18
+ # Single packages can also be selected instead of whole package sets. The
19
+ # package names are interpreted as a regular expression, so it is possible to
20
+ # do:
21
+ #
22
+ # layout:
23
+ # - tools:
24
+ # - typelib
25
+ # - utilmm
26
+ # - orocos/
27
+ #
28
+ # The first two match the typelib and utilmm packages, while the second one
29
+ # match all packages in which "orocos/" is found.
30
+ #
31
+ # Again, note that if a layout section is present, only the packages listed
32
+ # there will be built.
33
+
34
+ # Package exclusion: packages can be completely excluded from the build. This is
35
+ # an alternative way than using the layout, mainly useful if you want to enable
36
+ # all packages but a few ones. As with layout, the names are actually regular
37
+ # expressions.
38
+ #
39
+ # exclude_packages:
40
+ # - orocos/
41
+
42
+ # Ignoring packages: same principle than package exclusion, but this time the
43
+ # packages are considered to be installed and up-to-date. This is useful if you
44
+ # want to use an already installed software package.
45
+ #
46
+ # For instance, let's assume the orocos/rtt is already installed on your
47
+ # machine. You would then simply do:
48
+ #
49
+ # ignored_packages:
50
+ # - orocos/rtt
51
+ #
52
+
@@ -0,0 +1,4 @@
1
+ # Write in this file customization code that will get executed after all the
2
+ # soures have beenloaded.
3
+
4
+
@@ -0,0 +1,8 @@
1
+ # This file has the same format than the source.yml files. It can be used to
2
+ # locally override version control information.
3
+ #
4
+ # version_control:
5
+ # - orocos/rtt:
6
+ # type: git
7
+ # url: git://my.own.git.server
8
+ #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-20 00:00:00 +02:00
12
+ date: 2009-10-25 01:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.3.0
23
+ version: 1.4.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rmail
@@ -139,6 +139,7 @@ files:
139
139
  - doc/guide/ext/rdoc_links.rb
140
140
  - doc/guide/src/autobuild.page
141
141
  - doc/guide/src/autoproj_bootstrap
142
+ - doc/guide/src/customization.page
142
143
  - doc/guide/src/default.css
143
144
  - doc/guide/src/default.template
144
145
  - doc/guide/src/htmldoc.metainfo
@@ -158,7 +159,10 @@ files:
158
159
  - lib/autoproj/osdeps.rb
159
160
  - lib/autoproj/system.rb
160
161
  - lib/autoproj/version.rb
161
- - samples/manifest
162
+ - samples/autoproj/init.rb
163
+ - samples/autoproj/manifest
164
+ - samples/autoproj/overrides.rb
165
+ - samples/autoproj/overrides.yml
162
166
  - samples/manifest.xml
163
167
  - samples/osdeps.yml
164
168
  - test/data/test_manifest/autoproj/local/local.autobuild
data/samples/manifest DELETED
@@ -1,18 +0,0 @@
1
- package_sets:
2
- # Example from the RubyInMotion orocos package set
3
- # - type: git
4
- # url: git://github.com/doudou/rubim.orocos.git
5
-
6
- # If you want to adapt the layout to your needs, uncomment the following (again,
7
- # RubyInMotion orocos package set)
8
- # layout:
9
- # - orocos:
10
- # - rubim.orocos
11
- #
12
- # The principle is to have a hierarchy of names, package names and names of
13
- # package sets. In the above example, all packages of the rubim.orocos package
14
- # set will be built under the orocos/ subdirectory. Alternatively, you could do:
15
- #
16
- # layout:
17
- # - tools:
18
- # - rubim.orocos