autoproj 1.3.4 → 1.4.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,14 @@
1
+ = Version 1.4.0
2
+ * ruby 1.9 compatible
3
+ * fixes w.r.t. running autoproj under a Ruby interpreter that is not called
4
+ 'ruby' (as ruby1.9.1 on Debian)
5
+ * packages that os-depend on 'ruby' will now depend on either ruby18 or ruby19,
6
+ depending on the ruby version used.
7
+ * add Arch-Linux support
8
+ * fixes w.r.t. the 'doc' mode. In particular, the documentation installation
9
+ now follows the layout.
10
+ * some cosmetic fixes
11
+
1
12
  = Version 1.3.4
2
13
  * Improve the RubyGems support
3
14
  - a given osdeps name can refer to a mixture of RubyGems and OS packages
data/Manifest.txt CHANGED
@@ -7,7 +7,6 @@ doc/guide/config.yaml
7
7
  doc/guide/ext/init.rb
8
8
  doc/guide/ext/previous_next.rb
9
9
  doc/guide/ext/rdoc_links.rb
10
- doc/guide/src/autobuild.page
11
10
  doc/guide/src/autoproj_bootstrap
12
11
  doc/guide/src/customization.page
13
12
  doc/guide/src/default.css
@@ -21,7 +20,12 @@ doc/guide/src/images/footerbg.png
21
20
  doc/guide/src/images/gradient1.png
22
21
  doc/guide/src/images/gradient2.png
23
22
  doc/guide/src/index.page
24
- doc/guide/src/source_yml.page
23
+ doc/guide/src/manifest.xml
24
+ doc/guide/src/package_sets/autobuild.page
25
+ doc/guide/src/package_sets/importers.page
26
+ doc/guide/src/package_sets/index.page
27
+ doc/guide/src/package_sets/manifest-xml.page
28
+ doc/guide/src/package_sets/osdeps.page
25
29
  doc/guide/src/structure.page
26
30
  lib/autoproj.rb
27
31
  lib/autoproj/autobuild.rb
data/README.txt CHANGED
@@ -28,20 +28,22 @@ specification. More specifically, the package manifest files are common between
28
28
  ROS package management and autoproj (more details in the following of this
29
29
  document).
30
30
 
31
- Components of an Autoproj installation
31
+ Overview of an autoproj installation
32
32
  -------------------------------------
33
- A autoproj installation is seeded by _package sets_. A package set is a local or remote
34
- directory in which there is:
35
33
 
36
- * a list of available packages, and information on how to build these packages.
37
- This list, and the build information, are Ruby scripts that use the autobuild
38
- API. [More ...](autobuild.html)
39
- * version control information: where to get the source code for each of the
40
- packages defined in the set.
34
+ The idea in an autoproj installation is that people share _definitions_ for a
35
+ set of packages that can depend on each other. Then, anyone can cherry-pick in
36
+ these definitions to build its own installation (in practice, one builds a
37
+ complete configuration per-project).
41
38
 
42
- Then, an autoproj configuration is simply a list of package sets (i.e. a list of
43
- packages that are available to build), and a file that selects which packages
44
- should be built. This file is the <tt>manifest</tt>.
39
+ Each package definition includes:
40
+
41
+ * how to get the package's source code
42
+ * how to build the package
43
+ * on what the package depends. This can be either another package built by
44
+ autoproj, or an operating system package.
45
+
46
+ See [this page](structure.html) for more information.
45
47
 
46
48
  Bootstrapping
47
49
  -------------
@@ -97,6 +99,6 @@ As a guideline, we recommend that inter-package dependencies are managed by
97
99
  using pkg-config.
98
100
 
99
101
  To describe the package, and more importantly to setup cross-package
100
- dependencies, an optional manifest file can be added. This manifest file is
101
- named manifest.xml. Its format is described later in this user's guide.
102
+ dependencies, [an optional manifest file can be
103
+ added](package_sets/manifest-xml.html).
102
104
 
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ begin
30
30
  if !system('doc/update_github')
31
31
  raise "cannot update the gh-pages branch for GitHub"
32
32
  end
33
- if !system('git', 'push', 'origin', 'gh-pages')
33
+ if !system('git', 'push', 'origin', '+gh-pages')
34
34
  raise "cannot push the documentation"
35
35
  end
36
36
  end
data/bin/autoproj CHANGED
@@ -81,6 +81,7 @@ Additional options:
81
81
  Autobuild.verbose = true
82
82
  Rake.application.options.trace = true
83
83
  debug = true
84
+ Autobuild.debug = true
84
85
  end
85
86
  opts.on('--nice NICE', Integer, 'nice the subprocesses to the given value') do |value|
86
87
  Autobuild.nice = value
@@ -126,12 +127,8 @@ def display_status(packages)
126
127
  lines = []
127
128
 
128
129
  if !pkg.importer.respond_to?(:status)
129
- # This importer does not support status display
130
- STDERR.puts color(" the importer of #{pkg.autoproj_name} does not support status display (#{pkg.importer.class.name})", :bold, :red)
131
- next
132
- end
133
-
134
- if !File.directory?(pkg.srcdir)
130
+ lines << color(" the #{pkg.importer.class.name.gsub(/.*::/, '')} importer does not support status display", :bold, :red)
131
+ elsif !File.directory?(pkg.srcdir)
135
132
  lines << color(" is not imported yet", :magenta)
136
133
  else
137
134
  status = pkg.importer.status(pkg)
@@ -305,7 +302,10 @@ def do_bootstrap(*args)
305
302
  STDERR.puts "autoproj: reusing bootstrap from #{File.dirname(ENV['GEM_HOME'])}"
306
303
  FileUtils.cp_r ENV['GEM_HOME'], ".gems"
307
304
  ENV['GEM_HOME'] = File.join(Dir.pwd, ".gems")
308
- exec $0, *ARGV
305
+
306
+ require 'rbconfig'
307
+ ruby = RbConfig::CONFIG['RUBY_INSTALL_NAME']
308
+ exec ruby, $0, *ARGV
309
309
  end
310
310
 
311
311
  # If we are not getting the installation setup from a VCS, copy the template
@@ -377,6 +377,8 @@ end
377
377
  Autobuild.doc_errors = false
378
378
  Autobuild.do_doc = false
379
379
 
380
+ Autoproj::OSDependencies.autodetect_ruby
381
+
380
382
  # Find the autoproj root dir
381
383
  report(debug) do
382
384
  case mode
@@ -421,6 +423,7 @@ report(debug) do
421
423
  end
422
424
  when "doc"
423
425
  Autobuild.do_update = false
426
+ no_os_deps = true
424
427
  Autobuild.do_doc = true
425
428
  Autobuild.only_doc = true
426
429
  else
@@ -464,7 +467,13 @@ report(debug) do
464
467
  osdeps = Autoproj::OSDependencies.load_default
465
468
  if osdeps.install(%w{autobuild autoproj})
466
469
  # We updated autobuild or autoproj themselves ... Restart !
467
- exec($0, *ARGV)
470
+ require 'rbconfig'
471
+ ruby = RbConfig::CONFIG['RUBY_INSTALL_NAME']
472
+ if mode == "bootstrap"
473
+ exec(ruby, $0, 'list-sets')
474
+ else
475
+ exec(ruby, $0, *ARGV)
476
+ end
468
477
  end
469
478
 
470
479
  manifest_path = File.join(Autoproj.config_dir, 'manifest')
@@ -623,6 +632,7 @@ report(debug) do
623
632
  pkg = Autobuild::Package[pkg_name]
624
633
  pkg.srcdir = File.join(srcdir, pkg_name)
625
634
  pkg.prefix = prefix
635
+ pkg.doc_target_dir = File.join(Autoproj.build_dir, 'doc', name, pkg_name)
626
636
  pkg.logdir = logdir
627
637
  end
628
638
  seen |= packages
@@ -11,6 +11,7 @@ config = Webgen::WebsiteAccess.website.config
11
11
 
12
12
  config = Webgen::WebsiteAccess.website.config
13
13
  config['sourcehandler.patterns']['Webgen::SourceHandler::Copy'] << '**/autoproj_bootstrap'
14
+ config['sourcehandler.patterns']['Webgen::SourceHandler::Copy'] << '**/manifest.xml'
14
15
 
15
16
  $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
16
17
  require 'ext/rdoc_links'
@@ -5,18 +5,23 @@ if RUBY_VERSION < "1.8.7"
5
5
  exit 1
6
6
  end
7
7
 
8
- ENV['GEM_HOME'] = "#{Dir.pwd}/.gems"
9
- ENV['PATH'] = "#{ENV['GEM_HOME']}/bin:#{ENV['PATH']}"
8
+ needed_gem_home = "#{Dir.pwd}/.gems"
10
9
  if $LOADED_FEATURES.find { |str| str =~ /bygems/ }
11
- ENV['RUBYOPT'] = ""
12
- exec "ruby", __FILE__, *ARGV
10
+ if ENV['GEM_HOME'] != needed_gem_home
11
+ require 'rbconfig'
12
+ RUBY = RbConfig::CONFIG['RUBY_INSTALL_NAME']
13
+
14
+ ENV['GEM_HOME'] = needed_gem_home
15
+ exec RUBY, __FILE__, *ARGV
16
+ end
13
17
  end
14
18
 
15
- ENV['RUBYOPT'] = "-rubygems"
19
+
20
+ ENV['GEM_HOME'] = needed_gem_home
21
+ ENV['PATH'] = "#{ENV['GEM_HOME']}/bin:#{ENV['PATH']}"
16
22
 
17
23
  require 'yaml'
18
24
  require 'set'
19
- require 'rubygems'
20
25
 
21
26
  module Autoproj
22
27
  class ConfigError < RuntimeError; end
@@ -32,6 +37,22 @@ module Autobuild
32
37
  def self.progress(str)
33
38
  STDERR.puts " #{str}"
34
39
  end
40
+
41
+ class << self
42
+ attr_reader :programs
43
+ end
44
+ @programs = Hash.new
45
+ def self.tool(name)
46
+ # Let the ability to set programs[name] to nil to make sure we don't use
47
+ # that program. This is used later on in this file to make sure we
48
+ # aren't using the wrong rubygems binary
49
+ if programs.has_key?(name)
50
+ programs[name]
51
+ else
52
+ name
53
+ end
54
+ end
55
+
35
56
  module Subprocess
36
57
  def self.run(name, phase, *cmd)
37
58
  output = `#{cmd.join(" ")}`
@@ -57,16 +78,36 @@ module Autoproj
57
78
 
58
79
  OSDependencies.new(data)
59
80
  end
81
+
82
+ class << self
83
+ attr_reader :aliases
84
+ end
85
+ @aliases = Hash.new
86
+
87
+ def self.alias(old_name, new_name)
88
+ @aliases[new_name] = old_name
89
+ end
90
+
91
+ def self.autodetect_ruby
92
+ ruby_package =
93
+ if RUBY_VERSION < "1.9.0" then "ruby18"
94
+ else "ruby19"
95
+ end
96
+ self.alias(ruby_package, "ruby")
97
+ end
98
+
60
99
  AUTOPROJ_OSDEPS = File.join(File.expand_path(File.dirname(__FILE__)), 'default.osdeps')
61
100
  def self.load_default
62
101
  @default_osdeps ||= OSDependencies.load(AUTOPROJ_OSDEPS)
63
102
  end
64
103
 
65
104
  attr_reader :definitions
66
- attr_reader :gem_fetcher
105
+ def gem_fetcher
106
+ @gem_fetcher ||= Gem::SpecFetcher.fetcher
107
+ end
108
+
67
109
  def initialize(defs = Hash.new)
68
110
  @definitions = defs.to_hash
69
- @gem_fetcher = Gem::SpecFetcher.fetcher
70
111
  end
71
112
 
72
113
  def merge(info)
@@ -95,6 +136,10 @@ module Autoproj
95
136
  release_string =~ /^.*([^\s]+)$/
96
137
  version = $1
97
138
  ['gentoo', [version]]
139
+ elsif File.exists?('/etc/arch-release')
140
+ codename = "Unknown"
141
+ puts "Found Arch"
142
+ ['arch', [codename]]
98
143
  else
99
144
  raise ConfigError, "Unknown operating system"
100
145
  end
@@ -129,7 +174,8 @@ module Autoproj
129
174
  OS_PACKAGE_INSTALL = {
130
175
  'debian' => 'apt-get install -y %s',
131
176
  'ubuntu' => 'apt-get install -y %s',
132
- 'gentoo' => 'emerge --noreplace %s'
177
+ 'gentoo' => 'emerge --noreplace %s',
178
+ 'arch' => 'pacman -Sy --noconfirm %s'
133
179
  }
134
180
 
135
181
  def generate_os_script(dependencies)
@@ -192,7 +238,7 @@ module Autoproj
192
238
  # call-seq:
193
239
  # partition_packages(package_names) => os_packages, gem_packages
194
240
  def partition_packages(package_set, package_osdeps = Hash.new)
195
- package_set = package_set.to_set
241
+ package_set = package_set.map { |name| OSDependencies.aliases[name] || name }.to_set
196
242
  osdeps, gems = [], []
197
243
  package_set.to_set.each do |name|
198
244
  pkg_def = definitions[name]
@@ -230,6 +276,19 @@ module Autoproj
230
276
  return osdeps, gems
231
277
  end
232
278
 
279
+ def guess_gem_program
280
+ if Autobuild.programs['gem']
281
+ return Autobuild.programs['gem']
282
+ end
283
+
284
+ ruby_bin = Config::CONFIG['RUBY_INSTALL_NAME']
285
+ if ruby_bin =~ /^ruby(.+)$/
286
+ Autobuild.programs['gem'] = "gem#{$1}"
287
+ else
288
+ Autobuild.programs['gem'] = "gem"
289
+ end
290
+ end
291
+
233
292
  # Requests the installation of the given set of packages
234
293
  def install(packages, package_osdeps = Hash.new)
235
294
  osdeps, gems = partition_packages(packages, package_osdeps)
@@ -269,7 +328,7 @@ module Autoproj
269
328
  if !installed.empty? && Autobuild.do_update
270
329
  # Look if we can update the package ...
271
330
  dep = Gem::Dependency.new(name, version_requirements)
272
- available = @gem_fetcher.find_matching(dep)
331
+ available = gem_fetcher.find_matching(dep)
273
332
  installed_version = installed.map(&:version).max
274
333
  available_version = available.map { |(name, v), source| v }.max
275
334
  needs_update = (available_version > installed_version)
@@ -282,12 +341,14 @@ module Autoproj
282
341
 
283
342
  # Now install what is left
284
343
  if !gems.empty?
344
+ guess_gem_program
345
+
285
346
  if Autoproj.verbose
286
347
  STDERR.puts "Installing rubygems dependencies with"
287
348
  STDERR.puts "gem install #{gems.join(" ")}"
288
349
  end
289
350
  Autobuild.progress "installing/updating RubyGems dependencies: #{gems.join(", ")}"
290
- Autobuild::Subprocess.run 'autoproj', 'osdeps', 'gem', 'install', *gems
351
+ Autobuild::Subprocess.run 'autoproj', 'osdeps', Autobuild.tool('gem'), 'install', *gems
291
352
  did_something ||= true
292
353
  end
293
354
 
@@ -302,24 +363,44 @@ DEFS = <<EODEFS
302
363
  # The following definitions are needed to bootstrap autoproj
303
364
  none: ignore
304
365
 
305
- ruby:
366
+ ruby18:
306
367
  debian,ubuntu:
307
368
  - ruby1.8-dev
308
369
  - ruby1.8
370
+ - rubygems1.8
371
+ - ri1.8
309
372
  - libopenssl-ruby1.8
310
373
  gentoo:
311
374
  - dev-lang/ruby:1.8
312
375
 
376
+ ruby19:
377
+ debian,ubuntu:
378
+ - ruby1.9.1
379
+ - ruby1.9.1-dev
380
+ - rubygems1.9.1
381
+ - ri1.9.1
382
+ - libopenssl-ruby1.9.1
383
+ gentoo:
384
+ - dev-lang/ruby:1.9
385
+ arch:
386
+ - ruby
387
+
388
+ rdoc: gem
389
+
313
390
  build-essential:
314
391
  debian,ubuntu: build-essential
315
392
  gentoo:
393
+ arch:
316
394
 
317
395
  libxml2:
318
396
  debian,ubuntu: libxml2-dev
319
397
  gentoo: dev-libs/libxml2
398
+ arch: libxml2
399
+
320
400
  libxslt:
321
401
  debian,ubuntu: libxslt1-dev
322
402
  gentoo: dev-libs/libxslt
403
+ arch: libxslt
323
404
 
324
405
  autobuild: gem
325
406
  autoproj: gem
@@ -328,35 +409,58 @@ autoproj: gem
328
409
  git:
329
410
  debian,ubuntu: git-core
330
411
  gentoo: dev-util/git
331
-
412
+ arch: git
332
413
  svn:
333
414
  debian,ubuntu: subversion
334
415
  gentoo: dev-util/subversion
335
-
416
+ arch: subversion
336
417
  cmake:
337
418
  debian,ubuntu: cmake
338
419
  gentoo: dev-util/cmake
420
+ arch: cmake
339
421
 
340
422
  autotools:
341
423
  debian,ubuntu: [automake1.9, autoconf]
342
424
  gentoo: [sys-devel/automake:1.9, sys-devel/autoconf]
425
+ arch: automake autoconf
343
426
 
344
427
  lsb_release:
345
428
  debian,ubuntu: lsb-release
346
429
  gentoo: sys-apps/lsb-release
430
+ arch:
347
431
 
348
432
  archive:
349
433
  debian,ubuntu: [tar, unzip]
350
434
  gentoo: [app-arch/tar, app-arch/unzip]
435
+ arch: [tar, unzip]
351
436
 
352
437
  # vim: expandtab
353
438
 
354
439
 
355
440
  EODEFS
356
441
 
357
- PACKAGES = %w{ruby libxml2 libxslt build-essential lsb_release}
442
+ # First thing we do is install a proper ruby environment. We make sure that we
443
+ # aren't installing any gems for now (as we need to choose the right gem
444
+ # binary) by setting Autobuild.programs['gem'] to nil
445
+ Autobuild.programs['gem'] = nil
446
+ Autoproj::OSDependencies.autodetect_ruby
447
+
448
+ begin
449
+ osdeps_management = Autoproj::OSDependencies.new(YAML.load(DEFS))
450
+ STDERR.puts "autoproj: installing a proper Ruby environment (this can take a long time)"
451
+ osdeps_management.install(['ruby'])
452
+ rescue Autoproj::ConfigError => e
453
+ STDERR.puts "failed: #{e.message}"
454
+ exit(1)
455
+ end
456
+
457
+ # Now try to find out the name of the gem binary
458
+ PACKAGES = %w{rdoc libxml2 libxslt build-essential lsb_release}
358
459
  USER_PACKAGES = %w{autoproj}
359
460
 
461
+ ENV['RUBYOPT'] = "-rubygems"
462
+ require 'rubygems'
463
+
360
464
  packages = PACKAGES.dup
361
465
  if ARGV.first != "dev"
362
466
  packages += USER_PACKAGES
@@ -105,7 +105,7 @@ Local overrides of version control information
105
105
 
106
106
  The <tt>autoproj/overrides.yml</tt> allows you to override version control information
107
107
  for specific packages. It has the same format than the source.yml file of
108
- package sets, so [check that page out](source_yml.html) for more information.
108
+ package sets, so [check that page out](package_sets/importers.html) for more information.
109
109
 
110
110
  This file can in particular be used to avoid further updates to a given software
111
111
  package. Simply do: