autoproj 1.7.0.rc1 → 1.7.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -18,10 +18,12 @@
18
18
  well. This is meant to test the definition and handling of dependencies
19
19
  between the different packages.
20
20
  * added the autolocate tool, which returns the full path to a certain package.
21
- The shell function "acd", akin to rosbuild's roscd, it provided in shell/
21
+ The shell function "acd", akin to rosbuild's roscd, is also provided for
22
+ recognized shells (bash and zsh at the moment). The relevant files are
23
+ sourced in env.sh
22
24
  * added an easier way to add a local checked-out package to a build without
23
25
  going through editing 20 files. Packages are automatically detected and added
24
- as soon as they are explicitely added to autoproj/manifest.
26
+ as soon as they are explicitely listed in autoproj/manifest.
25
27
  * added the --stats option that displays timing statistics about the build
26
28
 
27
29
  = Version 1.6.2
data/Manifest.txt CHANGED
@@ -2,6 +2,7 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
+ bin/autolocate
5
6
  bin/autoproj
6
7
  doc/guide/config.yaml
7
8
  doc/guide/ext/init.rb
@@ -49,6 +50,8 @@ samples/autoproj/overrides.rb
49
50
  samples/autoproj/overrides.yml
50
51
  samples/manifest.xml
51
52
  samples/osdeps.yml
53
+ shell/autoproj_bash
54
+ shell/autoproj_zsh
52
55
  test/data/test_manifest/autoproj/local/local.autobuild
53
56
  test/data/test_manifest/autoproj/manifest
54
57
  test/test_debian.rb
data/bin/autolocate ADDED
@@ -0,0 +1,91 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require "enumerator"
4
+ require 'autobuild'
5
+ require 'autobuild/reporting'
6
+ require 'autoproj/autobuild'
7
+ require 'autoproj/base'
8
+ require 'autoproj/version'
9
+ require 'autoproj/manifest'
10
+ require 'autoproj/osdeps'
11
+ require 'autoproj/system'
12
+ require 'autoproj/options'
13
+ require 'autoproj/cmdline'
14
+ require 'logger'
15
+ require 'utilrb/logger'
16
+
17
+ include Autoproj
18
+
19
+ root_dir =
20
+ begin Autoproj.root_dir
21
+ rescue UserError => error
22
+ if ENV['GEM_HOME']
23
+ Dir.chdir(File.join(ENV['GEM_HOME'], '..'))
24
+ begin Autoproj.root_dir
25
+ rescue UserError
26
+ raise error
27
+ end
28
+ else
29
+ raise
30
+ end
31
+ end
32
+
33
+ Autoproj.silent = true
34
+ selection = Autoproj::CmdLine.parse_arguments(ARGV, false).first
35
+ if !selection
36
+ STDERR.puts Autoproj.console.color("no package name given on the command line", :bold, :red)
37
+ exit 1
38
+ end
39
+
40
+ Autoproj::CmdLine.update_os_dependencies = false
41
+ Dir.chdir(Autoproj.root_dir)
42
+ Autoproj::CmdLine.initialize
43
+ Autoproj::CmdLine.load_configuration
44
+ Autoproj::CmdLine.initial_package_setup
45
+
46
+ selection_rx = Regexp.new(Regexp.quote(selection))
47
+ candidates = []
48
+ Autoproj.manifest.each_package do |pkg|
49
+ name = pkg.name
50
+ next if !Autoproj.manifest.package_enabled?(name)
51
+
52
+ srcdir = Autobuild::Package[name].srcdir
53
+ if name == selection
54
+ puts srcdir
55
+ exit(0)
56
+ elsif name =~ selection_rx
57
+ candidates << srcdir
58
+ end
59
+ end
60
+
61
+ if candidates.empty?
62
+ # Try harder. Match directory prefixes
63
+ directories = selection.split('/')
64
+ rx = directories.
65
+ map { |d| "#{Regexp.quote(d)}\\w*" }.
66
+ join("/")
67
+ rx = Regexp.new(rx)
68
+
69
+ Autoproj.manifest.each_package do |pkg|
70
+ name = pkg.name
71
+ next if !Autoproj.manifest.package_enabled?(name)
72
+
73
+ srcdir = Autobuild::Package[name].srcdir
74
+ if name =~ rx
75
+ candidates << srcdir
76
+ end
77
+ end
78
+
79
+ end
80
+
81
+ if candidates.empty?
82
+ STDERR.puts Autoproj.console.color("cannot find #{selection} in the current autoproj installation", :bold, :red)
83
+ exit 1
84
+ elsif candidates.size > 1
85
+ STDERR.puts Autoproj.console.color("multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}", :bold, :red)
86
+ exit 1
87
+ else
88
+ puts candidates.first
89
+ exit(0)
90
+ end
91
+
data/bin/autoproj CHANGED
@@ -142,7 +142,7 @@ The resulting software is installed in
142
142
  EOTEXT
143
143
  end
144
144
 
145
- if Autoproj::CmdLine.only_config?
145
+ if Autoproj::CmdLine.only_config? || Autoproj::CmdLine.reconfigure?
146
146
  exit(0)
147
147
  end
148
148
 
@@ -155,7 +155,9 @@ module Autoproj
155
155
  if !silent
156
156
  Autoproj.progress("autoproj: loading ...", :bold)
157
157
  if !Autoproj.reconfigure?
158
- Autoproj.progress("run 'autoproj --reconfigure' to change configuration values", :bold)
158
+ Autoproj.progress("run 'autoproj reconfigure' to change configuration options", :bold)
159
+ Autoproj.progress("and use 'autoproj switch-config' to change the remote source for", :bold)
160
+ Autoproj.progress("autoproj's main build configuration", :bold)
159
161
  end
160
162
  end
161
163
  manifest.each_autobuild_file do |source, name|
@@ -262,7 +264,7 @@ module Autoproj
262
264
  pkg = Autobuild::Package[pkg_name]
263
265
  pkg.srcdir = File.join(Autoproj.root_dir, place)
264
266
  pkg.prefix = File.join(Autoproj.build_dir, layout)
265
- pkg.doc_target_dir = File.join(Autoproj.build_dir, 'doc', name, pkg_name)
267
+ pkg.doc_target_dir = File.join(Autoproj.build_dir, 'doc', pkg_name)
266
268
  pkg.logdir = File.join(pkg.prefix, "log")
267
269
  end
268
270
 
@@ -584,6 +586,7 @@ module Autoproj
584
586
 
585
587
  def self.build_packages(selected_packages, all_enabled_packages)
586
588
  if Autoproj::CmdLine.doc?
589
+ Autobuild.only_doc = true
587
590
  Autoproj.progress("autoproj: building and installing documentation", :bold)
588
591
  else
589
592
  Autoproj.progress("autoproj: building and installing packages", :bold)
@@ -641,6 +644,7 @@ module Autoproj
641
644
  def self.build?; @mode =~ /build/ end
642
645
  def self.doc?; @mode == "doc" end
643
646
  def self.snapshot?; @mode == "snapshot" end
647
+ def self.reconfigure?; @mode == "reconfigure" end
644
648
 
645
649
  def self.show_statistics?; !!@show_statistics end
646
650
 
@@ -708,6 +712,9 @@ where 'mode' is one of:
708
712
  list-config: list all available packages
709
713
  update: only import/update packages, do not build them
710
714
  update-config: only update the configuration
715
+ reconfigure: change the configuration options. Additionally, the
716
+ --reconfigure option can be used in other modes like
717
+ update or build
711
718
 
712
719
  -- Experimental Features (USE AT YOUR OWN RISK)
713
720
  check: compares dependencies in manifest.xml with autodetected ones
@@ -770,15 +777,15 @@ where 'mode' is one of:
770
777
  opts.on("--list-newest", "for each source directory, list what is the newest file used by autoproj for dependency tracking") do
771
778
  Autoproj::CmdLine.list_newest = true
772
779
  end
773
- opts.on("--rshow", "in the osdeps mode, shows information for each OS package") do
780
+ opts.on("--no-osdeps", "in build and update modes, disable osdeps handling") do |value|
781
+ @osdeps_forced_mode = 'none'
782
+ end
783
+ opts.on("--rshow", "in osdeps mode, shows information for each OS package") do
774
784
  @revshow_osdeps = true
775
785
  end
776
- opts.on("--show", "in the osdeps mode, show a per-package listing of the OS dependencies instead of installing them") do
786
+ opts.on("--show", "in osdeps mode, show a per-package listing of the OS dependencies instead of installing them") do
777
787
  @show_osdeps = true
778
788
  end
779
- opts.on("--no-osdeps", "disable osdeps handling in build and update modes") do |value|
780
- @osdeps_forced_mode = 'none'
781
- end
782
789
  opts.on("--all", "in osdeps mode, install both OS packages and RubyGem packages, regardless of the otherwise selected mode") do
783
790
  @osdeps_forced_mode = 'all'
784
791
  end
@@ -870,6 +877,9 @@ where 'mode' is one of:
870
877
  @force_re_build_with_depends = force_re_build_with_depends if !force_re_build_with_depends.nil?
871
878
  Autobuild.do_update = do_update if !do_update.nil?
872
879
  selection
880
+
881
+ rescue OptionParser::InvalidOption => e
882
+ raise ConfigError, e.message, e.backtrace
873
883
  end
874
884
 
875
885
  def self.handle_mode(mode, remaining_args)
@@ -902,6 +912,12 @@ where 'mode' is one of:
902
912
  switch_config(*remaining_args)
903
913
  exit 0
904
914
 
915
+ when "reconfigure"
916
+ Autoproj.reconfigure = true
917
+ Autobuild.do_update = false
918
+ Autobuild.do_build = false
919
+ @update_os_dependencies = false
920
+
905
921
  when "build"
906
922
  when "force-build"
907
923
  Autobuild.do_forced_build = true
@@ -1097,22 +1113,6 @@ where 'mode' is one of:
1097
1113
  do_switch_config(true, type, url, *options)
1098
1114
  end
1099
1115
  end
1100
-
1101
- # And now save the options: note that we keep the current option set even
1102
- # though we switched configuration. This is not a problem as undefined
1103
- # options will not be reused
1104
- #
1105
- # TODO: cleanup the options to only keep the relevant ones
1106
- vcs_def = Hash['type' => type, 'url' => url]
1107
- options.each do |opt|
1108
- opt_name, opt_val = opt.split '='
1109
- vcs_def[opt_name] = opt_val
1110
- end
1111
- # Validate the option hash, just in case
1112
- Autoproj.normalize_vcs_definition(vcs_def)
1113
- # Save the new options
1114
- Autoproj.change_option('manifest_source', vcs_def, true)
1115
- Autoproj.save_config
1116
1116
  end
1117
1117
 
1118
1118
  def self.do_switch_config(delete_current, type, url, *options)
@@ -1147,17 +1147,25 @@ where 'mode' is one of:
1147
1147
  end
1148
1148
  Autoproj::Manifest.update_package_set(vcs, "autoproj main configuration", config_dir)
1149
1149
 
1150
- Autoproj.change_option "manifest_source", vcs_def.dup, true
1150
+ # If the new tree has a configuration file, load it and set
1151
+ # manifest_source
1152
+ Autoproj.load_config
1151
1153
 
1152
- # Now write it in the config file
1153
- File.open(File.join(Autoproj.config_dir, "config.yml"), "a") do |io|
1154
- io.puts <<-EOTEXT
1155
- manifest_source:
1156
- type: #{vcs_def.delete(:type)}
1157
- url: #{vcs_def.delete(:url)}
1158
- #{vcs_def.map { |k, v| "#{k}: #{v}" }.join("\n ")}
1159
- EOTEXT
1154
+ # And now save the options: note that we keep the current option set even
1155
+ # though we switched configuration. This is not a problem as undefined
1156
+ # options will not be reused
1157
+ #
1158
+ # TODO: cleanup the options to only keep the relevant ones
1159
+ vcs_def = Hash['type' => type, 'url' => url]
1160
+ options.each do |opt|
1161
+ opt_name, opt_val = opt.split '='
1162
+ vcs_def[opt_name] = opt_val
1160
1163
  end
1164
+ # Validate the option hash, just in case
1165
+ Autoproj.normalize_vcs_definition(vcs_def)
1166
+ # Save the new options
1167
+ Autoproj.change_option "manifest_source", vcs_def.dup, true
1168
+ Autoproj.save_config
1161
1169
 
1162
1170
  rescue Exception
1163
1171
  if backup_name
@@ -1234,6 +1242,8 @@ manifest_source:
1234
1242
  manifest_data =
1235
1243
  begin open(manifest_url) { |file| file.read }
1236
1244
  rescue
1245
+ # Delete the autoproj directory
1246
+ FileUtils.rm_rf 'autoproj'
1237
1247
  raise ConfigError.new, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
1238
1248
  end
1239
1249
 
@@ -251,6 +251,14 @@ module Autoproj
251
251
  # local? returns true.
252
252
  attr_accessor :vcs
253
253
 
254
+ # The set of OSDependencies object that represent the osdeps files
255
+ # available in this package set
256
+ attr_reader :all_osdeps
257
+
258
+ # The OSDependencies which is a merged version of all OSdeps in
259
+ # #all_osdeps
260
+ attr_reader :osdeps
261
+
254
262
  # If this package set has been imported from another package set, this
255
263
  # is the other package set object
256
264
  attr_accessor :imported_from
@@ -272,12 +280,27 @@ module Autoproj
272
280
  def initialize(manifest, vcs)
273
281
  @manifest = manifest
274
282
  @vcs = vcs
283
+ @osdeps = OSDependencies.new
284
+ @all_osdeps = []
275
285
 
276
286
  @provides = Set.new
277
287
  @imports = Array.new
278
288
  @auto_imports = true
279
289
  end
280
290
 
291
+ # Load a new osdeps file for this package set
292
+ def load_osdeps(file)
293
+ new_osdeps = OSDependencies.load(file)
294
+ @all_osdeps << new_osdeps
295
+ @osdeps.merge(@all_osdeps.last)
296
+ new_osdeps
297
+ end
298
+
299
+ # Enumerate all osdeps package names from this package set
300
+ def each_osdep(&block)
301
+ @osdeps.definitions.each_key(&block)
302
+ end
303
+
281
304
  # True if this source has already been checked out on the local autoproj
282
305
  # installation
283
306
  def present?; File.directory?(raw_local_dir) end
@@ -722,7 +745,7 @@ module Autoproj
722
745
  # Load the manifest data contained in +file+
723
746
  def load(file)
724
747
  if !File.exists?(file)
725
- raise ConfigError.new(dirname), "expected an autoproj configuration in #{dirname}, but #{file} does not exist"
748
+ raise ConfigError.new(File.dirname(file)), "expected an autoproj configuration in #{File.dirname(file)}, but #{file} does not exist"
726
749
  end
727
750
 
728
751
  data = Autoproj.in_file(file, ArgumentError) do
@@ -1546,7 +1569,7 @@ module Autoproj
1546
1569
 
1547
1570
  def self.load_osdeps_from_package_sets
1548
1571
  manifest.each_osdeps_file do |source, file|
1549
- osdeps.merge(OSDependencies.load(file))
1572
+ osdeps.merge(source.load_osdeps(file))
1550
1573
  end
1551
1574
  osdeps
1552
1575
  end
@@ -1564,9 +1587,28 @@ module Autoproj
1564
1587
  # The raw XML data as a Nokogiri document
1565
1588
  attr_reader :xml
1566
1589
 
1590
+ def documentation
1591
+ xml.xpath('//description').each do |node|
1592
+ doc = node.content.strip
1593
+ if doc.empty?
1594
+ if doc = short_documentation
1595
+ return doc
1596
+ end
1597
+ return "no documentation available for #{package.name} in its manifest.xml file"
1598
+ else
1599
+ return doc
1600
+ end
1601
+ end
1602
+ nil
1603
+ end
1604
+
1567
1605
  def short_documentation
1568
1606
  xml.xpath('//description').each do |node|
1569
- if doc = node['brief']
1607
+ doc = node['brief']
1608
+ if doc
1609
+ doc = doc.to_s.strip
1610
+ end
1611
+ if doc && !doc.empty?
1570
1612
  return doc.to_s
1571
1613
  end
1572
1614
  end
@@ -47,6 +47,9 @@ module Autoproj
47
47
 
48
48
  # The information contained in the OSdeps files, as a hash
49
49
  attr_reader :definitions
50
+ # All the information contained in all the OSdeps files, as a mapping
51
+ # from the OSdeps package name to [osdeps_file, definition] pairs
52
+ attr_reader :all_definitions
50
53
  # The information as to from which osdeps file the current package
51
54
  # information in +definitions+ originates. It is a mapping from the
52
55
  # package name to the osdeps file' full path
@@ -64,11 +67,14 @@ module Autoproj
64
67
 
65
68
  def initialize(defs = Hash.new, file = nil)
66
69
  @definitions = defs.to_hash
70
+ @all_definitions = Hash.new { |h, k| h[k] = Array.new }
71
+
67
72
  @sources = Hash.new
68
73
  @installed_packages = Array.new
69
74
  if file
70
75
  defs.each_key do |package_name|
71
76
  sources[package_name] = file
77
+ all_definitions[package_name] << [[file], defs[package_name]]
72
78
  end
73
79
  end
74
80
  @silent = true
@@ -96,6 +102,16 @@ module Autoproj
96
102
  v2
97
103
  end
98
104
  @sources = sources.merge(info.sources)
105
+ @all_definitions = all_definitions.merge(info.all_definitions) do |package_name, all_defs, new_all_defs|
106
+ all_defs = all_defs.dup
107
+ new_all_defs = new_all_defs.dup
108
+ new_all_defs.delete_if do |files, data|
109
+ if entry = all_defs.find { |_, d| d == data }
110
+ entry[0] |= files
111
+ end
112
+ end
113
+ all_defs.concat(new_all_defs)
114
+ end
99
115
  end
100
116
 
101
117
  # Perform some sanity checks on the given osdeps definitions
@@ -112,6 +112,12 @@ module Autoproj
112
112
  Autoproj.env_set 'LD_LIBRARY_PATH'
113
113
  end
114
114
 
115
+ class << self
116
+ attr_writer :shell_helpers
117
+ def shell_helpers?; !!@shell_helpers end
118
+ end
119
+ @shell_helpers = true
120
+
115
121
  # Create the env.sh script in +subdir+. In general, +subdir+ should be nil.
116
122
  def self.export_env_sh(subdir = nil)
117
123
  filename = if subdir
@@ -137,6 +143,20 @@ module Autoproj
137
143
  variables.each do |var|
138
144
  io.puts "export #{var}"
139
145
  end
146
+
147
+ shell_dir = File.expand_path(File.join("..", "..", "shell"), File.dirname(__FILE__))
148
+ if Autoproj.shell_helpers? && shell = ENV['SHELL']
149
+ shell_kind = File.basename(shell)
150
+ if shell_kind =~ /^\w+$/
151
+ shell_file = File.join(shell_dir, "autoproj_#{shell_kind}")
152
+ if File.exists?(shell_file)
153
+ Autoproj.progress
154
+ Autoproj.progress "autodetected the shell to be #{shell_kind}, sourcing autoproj shell helpers"
155
+ Autoproj.progress "add \"Autoproj.shell_helpers = false\" in autoproj/init.rb to disable"
156
+ io.puts "source \"#{shell_file}\""
157
+ end
158
+ end
159
+ end
140
160
  end
141
161
  end
142
162
 
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.7.0.rc1"
2
+ VERSION = "1.7.0.rc2"
3
3
  end
@@ -1,13 +1,9 @@
1
1
  # List of VCS information or subdirectories of autoproj/ in which to find
2
2
  # package set definitions.
3
3
  package_sets:
4
- # Examples from the RubyInMotion package sets
4
+ # Examples from the Rock package set
5
5
  # - type: git
6
- # url: git://github.com/doudou/rubim.base.git
7
- # - type: git
8
- # url: git://github.com/doudou/rubim.orocos.git
9
- # - type: git
10
- # url: git://github.com/doudou/rubim.drivers.git
6
+ # url: git://gitorious.com/rock/package_set.git
11
7
 
12
8
  # The layout section specifies what to build, and where to build it (as a
13
9
  # subdirectory of the root installation directory). In the example below, all
@@ -16,8 +12,8 @@ package_sets:
16
12
  # files in build/tools/typelib, build/tools/orocos/rtt, ...
17
13
  #
18
14
  # layout:
19
- # - tools:
20
- # - rubim.orocos
15
+ # - rock:
16
+ # - rock.toolchain
21
17
  #
22
18
  # Single packages can also be selected instead of whole package sets. The
23
19
  # package names are interpreted as a regular expression, so it is possible to
@@ -1,4 +1,4 @@
1
1
  # Write in this file customization code that will get executed after all the
2
- # soures have beenloaded.
2
+ # soures have been loaded.
3
3
 
4
4
 
@@ -1,8 +1,18 @@
1
1
  # This file has the same format than the source.yml files. It can be used to
2
2
  # locally override version control information.
3
+
4
+
5
+ # You can add sources for new packages
3
6
  #
4
7
  # version_control:
5
8
  # - orocos/rtt:
6
9
  # type: git
7
10
  # url: git://my.own.git.server
11
+
12
+
13
+ # You can override source information for packages coming from the package
14
+ # sets
8
15
  #
16
+ # overrides:
17
+ # - orogen:
18
+ # branch: test
@@ -0,0 +1,12 @@
1
+ function acd {
2
+ local pkg_path
3
+ pkg_path=$(autolocate $1)
4
+
5
+ if [ $? != 0 ]; then
6
+ return 1
7
+ else
8
+ cd $pkg_path
9
+ return 0
10
+ fi
11
+ }
12
+
@@ -0,0 +1,12 @@
1
+ function acd {
2
+ local pkg_path
3
+ pkg_path=$(autolocate $1)
4
+
5
+ if [ $? != 0 ]; then
6
+ return 1
7
+ else
8
+ cd $pkg_path
9
+ return 0
10
+ fi
11
+ }
12
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940582
4
+ hash: 977940583
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 0
10
- - rc1
11
- version: 1.7.0.rc1
10
+ - rc2
11
+ version: 1.7.0.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sylvain Joyeux
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-26 00:00:00 +01:00
19
+ date: 2010-12-01 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -191,6 +191,7 @@ description: |-
191
191
  email:
192
192
  - sylvain.joyeux@dfki.de
193
193
  executables:
194
+ - autolocate
194
195
  - autoproj
195
196
  extensions: []
196
197
 
@@ -204,6 +205,7 @@ files:
204
205
  - Manifest.txt
205
206
  - README.txt
206
207
  - Rakefile
208
+ - bin/autolocate
207
209
  - bin/autoproj
208
210
  - doc/guide/config.yaml
209
211
  - doc/guide/ext/init.rb
@@ -251,6 +253,8 @@ files:
251
253
  - samples/autoproj/overrides.yml
252
254
  - samples/manifest.xml
253
255
  - samples/osdeps.yml
256
+ - shell/autoproj_bash
257
+ - shell/autoproj_zsh
254
258
  - test/data/test_manifest/autoproj/local/local.autobuild
255
259
  - test/data/test_manifest/autoproj/manifest
256
260
  - test/test_debian.rb