autoproj 1.4.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,7 @@ The above snippet being equivalent to calling <tt>cmake -DVAR=VALUE</tt>
31
31
 
32
32
  The "pkg" variable in the example above is an instance of
33
33
  [Autobuild::CMake](http://doudou.github.com/autobuild/Autobuild/CMake.html)
34
- {.block}
34
+ {: .block}
35
35
 
36
36
  Defining autotools packages {#autotools}
37
37
  ---------------------------
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  The 'pkg' variable in the example above is an instance of
48
48
  [Autobuild::Autotools](http://doudou.github.com/autobuild/Autobuild/Autotools.html)
49
- {.block}
49
+ {: .block}
50
50
 
51
51
  Defining Ruby packages
52
52
  ----------------------
@@ -64,8 +64,36 @@ convention:
64
64
 
65
65
  * programs are in bin/
66
66
  * the library itself is in lib/
67
- * if an extension needs to be built, a Rakefile has to be there with a "setup"
68
- target to do the job.
67
+
68
+ If a Rakefile is present in the root of the source package, its <tt>default</tt>
69
+ task will be called during the build, and its <tt>redocs</tt> task will be used
70
+ for documentation generation. The <tt>rake_setup_task</tt> and
71
+ <tt>rake_doc_task</tt> package properties can be used to override this default
72
+ setting:
73
+
74
+ {coderay::ruby}
75
+ ruby_package "package_name" do |pkg|
76
+ pkg.rake_setup_task = "setup"
77
+ pkg.rake_doc_task = "doc:all"
78
+ end
79
+ {coderay}
80
+
81
+ Additionally, they can be set to <tt>nil</tt> to disable either setup or documentation
82
+ generation. For instance, the following code disables documentation generation
83
+ and uses the +setup+ task at build time:
84
+
85
+ {coderay::ruby}
86
+ ruby_package "package_name" do |pkg|
87
+ pkg.rake_setup_task = "setup"
88
+ pkg.rake_doc_task = nil
89
+ end
90
+ {coderay}
91
+
92
+ The 'pkg' variable in the example above is an instance of
93
+ [Autobuild::ImporterPackage](http://doudou.github.com/autobuild/Autobuild/ImporterPackage.html),
94
+ with additional methods coming from [the RubyPackage
95
+ module](http://doudou.github.com/autoproj/api/Autoproj/RubyPackage.html)
96
+ {: .block}
69
97
 
70
98
  Defining oroGen packages
71
99
  ------------------------
@@ -82,7 +110,7 @@ documentation](http://doudou.github.com/orogen) for more information.
82
110
 
83
111
  The 'pkg' variable in the example above is an instance of
84
112
  [Autobuild::Orogen](http://doudou.github.com/autobuild/Autobuild/Orogen.html)
85
- {.block}
113
+ {: .block}
86
114
 
87
115
  Custom package building
88
116
  -----------------------
@@ -119,17 +147,13 @@ Inter-package dependencies can be defined with
119
147
  pkg.depends_on "package_name"
120
148
  {coderay}
121
149
 
122
- In the same way, if the source package depends on an OS package (see
123
- [Prepackaged dependencies](osdeps.html) for details), you can use
124
-
125
- {coderay:: ruby}
126
- pkg.depends_on_os_package "package_name"
127
- {coderay}
150
+ Where package name is either the name of another autoproj-built package, or the
151
+ name of a package that is to be [provided by the operating system](osdeps.html).
128
152
 
129
153
  Both methods should be used only for dynamic dependencies, i.e. dependencies
130
154
  that are dependent on build options (see below). Static dependencies should be
131
155
  defined in [the package's manifest.xml](manifest-xml.html)
132
- {.warning}
156
+ {: .warning}
133
157
 
134
158
  Finally, it is possible to give aliases to a package's name, by using the
135
159
  Autobuild::Package#provides method. If one does
@@ -173,5 +197,5 @@ Do not try to have too many options, that is in general bad policy as
173
197
  non-advanced users won't be able to know what to answer. Advanced users will
174
198
  always have the option to override your autobuild definitions to tweak the
175
199
  builds to their needs.
176
- {.warning}
200
+ {: .warning}
177
201
 
@@ -103,7 +103,7 @@ version_control:
103
103
 
104
104
  Note that the repository *must* be accessible without any password, and the
105
105
  import will fail if a password was needed.
106
- {.warning}
106
+ {: .warning}
107
107
 
108
108
  Tar archives
109
109
  ------------
@@ -21,9 +21,9 @@ The general form of the file is:
21
21
  <url>http://sites.google.com/site/rubyinmotion</url>
22
22
  <logo>http://sites.google.com/site/rubyinmotion</logo>
23
23
 
24
- <depend package="pkgname"/> <!-- add dependency on another autoproj-built package -->
24
+ <depend package="pkgname"/> <!-- add dependency on either another
25
+ autoproj-built package, or an OS-provided one -->
25
26
  <depend package="common"/>
26
- <rosdep name="python" /> <!-- add dependency on a prepackaged operating system package -->
27
27
  </package>
28
28
  {coderay}
29
29
 
@@ -3,21 +3,26 @@ title: Operating System dependencies
3
3
  sort_info: 300
4
4
  ---
5
5
 
6
- Each package set can have one or multiple .osdeps files. These files declare
7
- how to install prepackaged dependencies, based on the underlying operating system.
6
+ Autoproj offers the possibility to use OS-packaged software instead of building
7
+ it, to leverage the underlying platform's software. This page details how it's
8
+ done.
8
9
 
9
10
  Defining dependencies between source packages and OS packages
10
11
  -------------------------------------------------------------
11
12
 
12
- These dependencies can be defined in two ways:
13
+ If a source package depends on an OS package, this dependency should be declared
14
+ in the same way than between source packages:
13
15
 
14
- * by adding a `<osdep name="depname" />` tag in the package's
15
- [manifest.xml](manifest-xml.html)
16
- * by calling `pkg.depends_on_os_package("depname")` [in the autobuild
17
- file](autobuild.html).
16
+ * either by adding the <depend package="os_dep_name" /> tag in the
17
+ manifest.xml, or
18
+ * by calling #depends_on("os_dep_name") in the autobuild file.
18
19
 
19
- In both cases, depname is used as a key to find the OS package definition in the
20
- osdeps files (see below). It does not have to be the actual package name.
20
+ The os_dep_name above being the name of the package as declared in the OS
21
+ dependencies files defined below.
22
+
23
+ During the build, autoproj looks first for OS dependencies. If no dependency is
24
+ available for that particular platform, it will then look for a source package
25
+ definition and build it. If none of the two exist, an error is returned.
21
26
 
22
27
  OS packages
23
28
  -----------
@@ -0,0 +1,110 @@
1
+ ---
2
+ title: Quick start
3
+ sort_info: 25
4
+ ---
5
+
6
+ Bootstrapping
7
+ -------------
8
+ "Bootstrapping" means getting autoproj itself before it can work its magic ...
9
+ The canonical way is the following:
10
+
11
+ * install Ruby by yourself. On Debian or Ubuntu, this is done with
12
+ done with
13
+
14
+ sudo apt-get install wget ruby
15
+ {: .cmdline}
16
+
17
+ * then, [download this script](autoproj_bootstrap) *in the directory where
18
+ you want to create an autoproj installation*, and run it. This can be done with
19
+
20
+ wget http://doudou.github.com/autoproj/autoproj\_bootstrap <br />
21
+ ruby autoproj\_bootstrap
22
+ {: .cmdline}
23
+
24
+ * follow the instructions printed by the script<tt>manifest</tt>.
25
+
26
+ Additionally, if you are given a reference to a source code repository in which
27
+ an autoproj configuration is stored (i.e. a directory in which a manifest is
28
+ present), you can bootstrap this configuration directly:
29
+
30
+ wget http://doudou.github.com/autoproj/autoproj\_bootstrap <br />
31
+ ruby autoproj\_bootstrap VCS
32
+ {: .cmdline}
33
+
34
+ For instance, to build all packages made available by the RubyInMotion project,
35
+ do
36
+
37
+ wget http://doudou.github.com/autoproj/autoproj\_bootstrap <br />
38
+ ruby autoproj\_bootstrap git git://github.com/doudou/rubim.all.git
39
+ {: .cmdline}
40
+
41
+ Additional options can be given for the version control system. For instance,
42
+
43
+ wget http://doudou.github.com/autoproj/autoproj\_bootstrap <br />
44
+ ruby autoproj\_bootstrap git git://github.com/doudou/rubim.all.git branch=stable
45
+ {: .cmdline}
46
+
47
+ Management
48
+ ----------
49
+
50
+ To build the packages, simply do:
51
+
52
+ autoproj build
53
+ {: .commandline}
54
+
55
+ It will ask the value of newly defined configuration options, import code hosted
56
+ remotely that is not yet present, install OS packages (e.g. Ubuntu packages on
57
+ an Ubunut installation) and build everything.
58
+
59
+ autoproj will *not* ask you again about the configuration questions you already
60
+ answered, so if you want to change them, do:
61
+
62
+ autoproj build --reconfigure
63
+ {: .commandline}
64
+
65
+ Alternatively, you can edit the autoproj/config.yml file directly.
66
+
67
+ By default, autoproj does not automatically update the package sources. To do
68
+ that, you have to explicitely call
69
+
70
+ autoproj update
71
+ {: .commandline}
72
+
73
+ Finally, if you want to make sure that your build is fresh, then do
74
+
75
+ autoproj rebuild
76
+ {: .commandline}
77
+
78
+ A less intrusive version of it only forces all tools to reconsider building. It
79
+ is mainly useful for CMake when the build environment changed -- cmake caches a
80
+ lot of values. To trigger this, do
81
+
82
+ autoproj force-build
83
+ {: .commandline}
84
+
85
+ To add a new set, one edits the <tt>autoproj/manifest</tt> file and adds it
86
+ there. Then, simply starting the build will update everything and rebuild what
87
+ is needed.
88
+
89
+ Documentation is generated only when asked explicitely:
90
+
91
+ autoproj doc
92
+ {: .commandline}
93
+
94
+ It generates documentation of packages that have some, and copies that
95
+ documentation into build/doc/, following the same layout than the source
96
+ directory.
97
+
98
+ All these commands (i.e. build, doc, and update) accept a package name as
99
+ argument, thus triggering build only for this package and its dependencies. For
100
+ instance:
101
+
102
+ autoproj build orocos/rtt
103
+ {: .commandline}
104
+
105
+ **Exception**: to avoid long builds, the rebuild and force-build commands apply only
106
+ to the packages given on the command line. E.g., autoproj rebuild orocos/rtt
107
+ will only rebuild the orocos/rtt packages. If you want to rebuild both the
108
+ packages and its dependencies, use the --with-depends options.
109
+ {: .warning}
110
+
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: Managing autoproj installations
2
+ title: The manifest file.
3
3
  sort_info: 50
4
4
  ---
5
5
 
@@ -9,8 +9,8 @@ to manage one. See [the introduction](index.html) for the bootstrapping process.
9
9
  Structure
10
10
  ---------
11
11
 
12
- !overview.png!
13
- <img class="full" src="overview.png" />
12
+ ![Structure overview](overview.png)!
13
+ {: .full}
14
14
 
15
15
  The autoproj configuration and build process goes like this:
16
16
 
@@ -35,11 +35,11 @@ is split like this:
35
35
 
36
36
  * autoproj/manifest: list of available package sets, package selection and
37
37
  installation layout (where to put what).
38
- * .remotes/\*: package sets that are imported from a remote version
39
- control system
40
38
  * autoproj/\*/: local sets, i.e. sets that have not been imported from a remote
41
39
  version control system.
42
- * autoproj\/init.rb, autoproj\/overrides.rb and autoproj\/overrides.yml:
40
+ * autoproj/remotes/\*/: package sets that are imported from a remote version
41
+ control system
42
+ * autoproj/init.rb, autoproj/overrides.rb and autoproj/overrides.yml:
43
43
  installation customization
44
44
 
45
45
  The build is done in two steps:
@@ -91,66 +91,56 @@ autoproj installation. The importers that are available for configuration are
91
91
  the same than the ones available for the packages themselves, so see [this
92
92
  page](package_sets/importers.html#all_importers) for the list of available importers.
93
93
 
94
- Management
95
- ----------
96
-
97
- To update and build a autoproj installation, simply do:
98
-
99
- autoproj build
100
- {.commandline}
101
-
102
- It will ask the value of newly defined configuration options, import (or update)
103
- code hosted remotely, and build it. autoproj will *not* ask you again about the
104
- configuration questions you already answered, so if you want to change them, do:
105
-
106
- autoproj build --reconfigure
107
- {.commandline}
94
+ Listing the available packages.
95
+ -----------------------------
96
+ Once you have updated your manifest file to list all the package sets that you
97
+ want to use, you can list all the packages that are now available with
108
98
 
109
- Alternatively, you can edit the autoproj/config.yml file directly.
99
+ autoproj list-sets
100
+ {: .commandline}
110
101
 
111
- If you are in a disconnected environment (i.e. no access to remote
112
- repositories), use the fast-build mode, to skip the package update and OS
113
- packages installation phases (autoproj will still check out new packages,
114
- though):
102
+ Its output looks like this:
115
103
 
116
- autoproj fast-build
117
- {.commandline}
104
+ <pre>
105
+ rubim.orocos
106
+ local source in /home/doudou/dfki/imoby1.9/autoproj/orocos
107
+ packages:
108
+ | orocos/base | git:/home/doudou/dfki/dfki-share/projects/all/Intelligent_Mobility/development/software/git/tools/orocos/base.git |
109
+ | orocos/logger | git:/home/doudou/dfki/dfki-share/projects/all/Intelligent_Mobility/development/software/git/tools/orocos/logger.git branch=fast_log |
110
+ | orocos/ocl | git:/home/doudou/dfki/dfki-share/projects/all/Intelligent_Mobility/development/software/git/tools/orocos/ocl.git branch=rubim |
111
+ </pre>
118
112
 
119
- The package update can be disabled with --no-update and the OS dependencies
120
- installation with --no-osdeps. In practice, "autoproj fast-build" is equivalent
121
- to autoproj build --no-update --no-osdeps
122
- {.block}
113
+ The first line is the **package set name**. It is defined in the package set's
114
+ source.yml file and *does not have to be identical to the set's directory
115
+ name*. In the example above, the package set is saved in autoproj/orocos but is
116
+ called dfki.orocos.
123
117
 
124
- If, on the other hand, you only want to update the source code, do
118
+ The second line tells you where this set comes from. It is local if it comes
119
+ along with the main autoproj configuration (manifest and so on). It is remote
120
+ if it is imported from a version control system.
125
121
 
126
- autoproj update
127
- {.commandline}
122
+ Finally comes the list of packages that are defined in this set, along with the
123
+ importer setup (URL and options, as for instance branches for orocos/logger
124
+ above).
128
125
 
129
- Finally, if you want to make sure that your build is fresh, then do
126
+ Picking the packages to build
127
+ -----------------------------
128
+ If you do not wish to build all the packages that are available (you rarely
129
+ wish that), you have to list the desired packages in your manifest file.
130
130
 
131
- autoproj rebuild
132
- {.commandline}
131
+ To do so, you will have to create a <tt>layout</tt> section and list the
132
+ desired packages:
133
133
 
134
- A less intrusive version of it only forces all tools to reconsider building. It
135
- is mainly useful for CMake when the build environment changed -- cmake caches a
136
- lot of values. To trigger this, do
137
-
138
- autoproj force-build
139
- {.commandline}
140
-
141
- To add a new set, one edits the <tt>autoproj/manifest</tt> file and adds it
142
- there. Then, simply starting the build will update everything and rebuild what
143
- is needed.
144
-
145
- Documentation is generated only when asked explicitely:
146
-
147
- autoproj doc
148
- {.commandline}
134
+ {coderay:: yaml}
135
+ layout:
136
+ - rubim.base
137
+ - orocos/rtt
138
+ - orocos/logger
139
+ {coderay}
149
140
 
150
- All these commands (i.e. build, doc, and update) accept a package name as
151
- argument, thus triggering build only for this package and its dependencies. For
152
- instance:
141
+ This layout can either list packages one by one, but complete package sets can
142
+ also be selected (the rubim.base above)
153
143
 
154
- autoproj build orocos/rtt
155
- {.commandline}
144
+ More advanced mechanisms are available to customize this list. These mechanisms
145
+ are [detailed here](customization.html)
156
146
 
@@ -4,6 +4,7 @@ module Autoproj
4
4
  end
5
5
 
6
6
  require "enumerator"
7
+ require 'autoproj/version'
7
8
  require 'autoproj/manifest'
8
9
  require 'autoproj/osdeps'
9
10
  require 'autoproj/system'
@@ -3,9 +3,29 @@ require 'fileutils'
3
3
  require 'autobuild'
4
4
  require 'set'
5
5
 
6
- class Autobuild::Package
7
- def autoproj_name # :nodoc:
8
- srcdir.gsub /^#{Regexp.quote(Autoproj.root_dir)}\//, ''
6
+ module Autobuild
7
+ class Package
8
+ def autoproj_name # :nodoc:
9
+ srcdir.gsub /^#{Regexp.quote(Autoproj.root_dir)}\//, ''
10
+ end
11
+
12
+ alias __depends_on__ depends_on
13
+ def depends_on(name)
14
+ if Autoproj.osdeps.has?(name)
15
+ @os_packages ||= Set.new
16
+ @os_packages << name
17
+ else
18
+ __depends_on__(name)
19
+ end
20
+ end
21
+
22
+ def depends_on_os_package(name)
23
+ depends_on(name)
24
+ end
25
+
26
+ def os_packages
27
+ @os_packages ||= Set.new
28
+ end
9
29
  end
10
30
  end
11
31
 
@@ -80,16 +100,6 @@ module Autoproj
80
100
  end
81
101
  end
82
102
 
83
- # Sets up a documentation target on pkg that runs 'rake <target>'
84
- def ruby_doc(pkg, target = 'doc')
85
- pkg.doc_task do
86
- pkg.progress "generating documentation for %s"
87
- pkg.doc_disabled unless File.file?('Rakefile')
88
- Autobuild::Subprocess.run pkg.name, 'doc', 'rake', target
89
- end
90
-
91
- end
92
-
93
103
  # Common setup for packages
94
104
  def package_common(package_type, spec, &block) # :nodoc:
95
105
  package_name = Autoproj.package_name_from_options(spec)
@@ -164,9 +174,10 @@ def autotools_package(options, &block)
164
174
  end
165
175
  end
166
176
 
167
- # Common setup for Ruby packages
168
- def ruby_common(pkg) # :nodoc:
169
- def pkg.prepare_for_forced_build
177
+ # This module is used to extend importer packages to handle ruby packages
178
+ # properly
179
+ module Autoproj::RubyPackage
180
+ def prepare_for_forced_build # :nodoc:
170
181
  super
171
182
  extdir = File.join(srcdir, 'ext')
172
183
  if File.directory?(extdir)
@@ -176,7 +187,8 @@ def ruby_common(pkg) # :nodoc:
176
187
  end
177
188
  end
178
189
  end
179
- def pkg.prepare_for_rebuild
190
+
191
+ def prepare_for_rebuild # :nodoc:
180
192
  super
181
193
  extdir = File.join(srcdir, 'ext')
182
194
  if File.directory?(extdir)
@@ -194,20 +206,22 @@ def ruby_common(pkg) # :nodoc:
194
206
  end
195
207
  end
196
208
 
197
- def pkg.prepare
209
+ def import
198
210
  super
199
- Autobuild.update_environment srcdir
200
- end
201
211
 
202
- pkg.post_install do
203
- Autobuild.progress "setting up Ruby package #{pkg.name}"
204
- Autobuild.update_environment pkg.srcdir
205
- if File.file?('Rakefile')
206
- if File.directory?('ext')
207
- Autobuild::Subprocess.run pkg.name, 'post-install', 'rake', 'setup'
208
- end
212
+ Autobuild.update_environment srcdir
213
+ libdir = File.join(srcdir, 'lib')
214
+ if File.directory?(libdir)
215
+ Autobuild.env_add_path 'RUBYLIB', libdir
209
216
  end
210
217
  end
218
+
219
+ # The Rake task that is used to set up the package. Defaults to "default".
220
+ # Set to nil to disable documentation generation
221
+ attr_accessor :rake_setup_task
222
+ # The Rake task that is used to generate documentation. Defaults to "doc".
223
+ # Set to nil to disable documentation generation
224
+ attr_accessor :rake_doc_task
211
225
  end
212
226
 
213
227
  def env_set(name, value)
@@ -230,14 +244,42 @@ end
230
244
  # information.
231
245
  def ruby_package(options)
232
246
  package_common(:import, options) do |pkg|
233
- class << pkg
234
- attr_accessor :doc_target
247
+ pkg.exclude << /\.so$/
248
+ pkg.exclude << /Makefile$/
249
+ pkg.exclude << /mkmf.log$/
250
+ pkg.exclude << /\.o$/
251
+
252
+ pkg.extend Autoproj::RubyPackage
253
+ pkg.rake_setup_task = "default"
254
+ pkg.rake_doc_task = "redocs"
255
+
256
+ # Set up code
257
+ pkg.post_install do
258
+ Autobuild.progress "setting up Ruby package #{pkg.name}"
259
+ Autobuild.update_environment pkg.srcdir
260
+ # Add lib/ unconditionally, as we know that it is a ruby package.
261
+ # Autobuild will add it only if there is a .rb file in the directory
262
+ libdir = File.join(pkg.srcdir, 'lib')
263
+ if File.directory?(libdir)
264
+ Autobuild.env_add_path 'RUBYLIB', libdir
265
+ end
266
+
267
+ if pkg.rake_setup_task && File.file?(File.join(pkg.srcdir, 'Rakefile'))
268
+ Autobuild::Subprocess.run pkg, 'post-install',
269
+ 'rake', pkg.rake_setup_task
270
+ end
235
271
  end
236
272
 
237
- ruby_common(pkg)
238
273
  yield(pkg) if block_given?
239
- unless pkg.has_doc?
240
- ruby_doc(pkg, pkg.doc_target || 'redocs')
274
+
275
+ # Documentation code. Ignore if the user provided its own documentation
276
+ # task, or disabled the documentation generation altogether by setting
277
+ # rake_doc_task to nil
278
+ if !pkg.has_doc? && pkg.rake_doc_task
279
+ pkg.doc_task do
280
+ pkg.progress "generating documentation for %s"
281
+ Autobuild::Subprocess.run pkg, 'doc', 'rake', pkg.rake_doc_task
282
+ end
241
283
  end
242
284
  end
243
285
  end