autoproj 1.5.1 → 1.5.2

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.
@@ -1,3 +1,6 @@
1
+ = Version 1.5.2
2
+ * fix ignored_packages and exclude_packages
3
+
1
4
  = Version 1.5.1
2
5
  * --no-osdeps disables updating autobuild and autoproj, as it should
3
6
  * fixed checking out modules that are not yet checked out
@@ -110,6 +110,10 @@ report(Autobuild.debug) do
110
110
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
111
111
  Autoproj::CmdLine.manifest_update(all_enabled_packages)
112
112
  exit(0)
113
+ elsif Autoproj::CmdLine.snapshot?
114
+ all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
115
+ Autoproj::CmdLine.snapshot(Autoproj::CmdLine.snapshot_dir, all_enabled_packages)
116
+ exit(0)
113
117
  end
114
118
 
115
119
  STDERR.puts
@@ -44,6 +44,24 @@ Additional options can be given for the version control system. For instance,
44
44
  ruby autoproj\_bootstrap git git://github.com/doudou/rubim.all.git branch=stable
45
45
  {: .cmdline}
46
46
 
47
+ Switching configuration after bootstrapping
48
+ -------------------------------------------
49
+ Let's assume that you want to switch what configuration autoproj is tracking,
50
+ but without having to redo a complete bootstrap -- i.e. avoiding to rebuild
51
+ stuff that is common between the configurations.
52
+
53
+ autoproj provides the switch-config command for that. This command takes the
54
+ same arguments than the bootstrap script, that is:
55
+
56
+ autoproj switch-config \[vcs_type] \[vcs_url] \[vcs_options]
57
+ {: .cmdline}
58
+
59
+ As a shortcut, one can omit vcs_type and vcs_url if they don't change.
60
+ This is especially useful when switching between branches:
61
+
62
+ autoproj switch-config branch=experimental
63
+ {: .cmdline}
64
+
47
65
  Management
48
66
  ----------
49
67
 
@@ -324,3 +324,36 @@ def user_config(key)
324
324
  Autoproj.user_config(key)
325
325
  end
326
326
 
327
+ class Autobuild::Git
328
+ def snapshot(package, target_dir)
329
+ Dir.chdir(package.srcdir) do
330
+ head_commit = `git rev-parse #{branch}`.chomp
331
+ {
332
+ 'type' => 'git',
333
+ 'url' => repository,
334
+ 'commit' => head_commit,
335
+ 'patches' => patches
336
+ }
337
+ end
338
+ end
339
+ end
340
+
341
+ class Autobuild::ArchiveImporter
342
+ def snapshot(package, target_dir)
343
+ archive_dir = File.join(target_dir, 'archives')
344
+ FileUtils.mkdir_p archive_dir
345
+ FileUtils.cp @cachefile, archive_dir
346
+
347
+ {
348
+ 'type' => 'archive',
349
+ 'url' => File.join('$AUTOPROJ_SOURCE_DIR', File.basename(@cachefile)),
350
+ 'mode' => @mode,
351
+ 'update_cached_file' => false,
352
+ 'patches' => patches,
353
+ 'no_subdirectory' => @options[:no_subdirectory],
354
+ 'archive_dir' => archive_dir
355
+
356
+ }
357
+ end
358
+ end
359
+
@@ -358,6 +358,7 @@ module Autoproj
358
358
  def self.update_os_dependencies?; !!@update_os_dependencies end
359
359
  class << self
360
360
  attr_accessor :update_os_dependencies
361
+ attr_accessor :snapshot_dir
361
362
  end
362
363
  def self.display_configuration?; !!@display_configuration end
363
364
  def self.force_re_build_with_depends?; !!@force_re_build_with_depends end
@@ -366,6 +367,7 @@ module Autoproj
366
367
  def self.update_packages?; @mode == "update" || @mode == "envsh" || build? end
367
368
  def self.build?; @mode =~ /build/ end
368
369
  def self.doc?; @mode == "doc" end
370
+ def self.snapshot?; @mode == "snapshot" end
369
371
  def self.parse_arguments(args)
370
372
  @only_status = false
371
373
  @check = false
@@ -530,6 +532,11 @@ where 'mode' is one of:
530
532
  when "fast-build"
531
533
  Autobuild.do_update = false
532
534
  @update_os_dependencies = false
535
+ when "snapshot"
536
+ @snapshot_dir = remaining_args.shift
537
+ Autobuild.do_update = false
538
+ Autobuild.do_build = false
539
+ @update_os_dependencies = false
533
540
  when "full-build"
534
541
  Autobuild.do_update = true
535
542
  @update_os_dependencies = true
@@ -910,6 +917,49 @@ EOTEXT
910
917
  end
911
918
  end
912
919
 
920
+ def self.snapshot(target_dir, packages)
921
+ # First, copy the configuration directory to create target_dir
922
+ if File.exists?(target_dir)
923
+ raise ArgumentError, "#{target_dir} already exists"
924
+ end
925
+ FileUtils.cp_r Autoproj.config_dir, target_dir
926
+
927
+ # Now, create snapshot information for each of the packages
928
+ version_control = []
929
+ packages.each do |package_name|
930
+ package = Autobuild::Package[package_name]
931
+ importer = package.importer
932
+ if !importer
933
+ STDERR.puts "cannot snapshot #{package_name} as it has no importer"
934
+ next
935
+ elsif !importer.respond_to?(:snapshot)
936
+ STDERR.puts "cannot snapshot #{package_name} as the #{importer.class} importer does not support it"
937
+ next
938
+ end
939
+
940
+ vcs_info = importer.snapshot(package, target_dir)
941
+ if vcs_info
942
+ version_control << Hash[package_name, vcs_info]
943
+ end
944
+ end
945
+
946
+ overrides_path = File.join(target_dir, 'overrides.yml')
947
+ overrides =
948
+ if File.exists?(overrides_path)
949
+ YAML.load(File.read(overrides_path))
950
+ else Hash.new
951
+ end
952
+
953
+ if overrides['version_control']
954
+ overrides['version_control'].concat(version_control)
955
+ else
956
+ overrides['version_control'] = version_control
957
+ end
958
+
959
+ File.open(overrides_path, 'w') do |io|
960
+ io.write YAML.dump(overrides)
961
+ end
962
+ end
913
963
  end
914
964
  end
915
965
 
@@ -555,8 +555,8 @@ module Autoproj
555
555
  #
556
556
  # This is useful if the packages are already installed on this system.
557
557
  def ignored?(package_name)
558
- if data['ignored_packages']
559
- data['ignored_packages'].any? { |l| Regexp.new(l) =~ package_name }
558
+ if data['ignore_packages']
559
+ data['ignore_packages'].any? { |l| Regexp.new(l) =~ package_name }
560
560
  else
561
561
  false
562
562
  end
@@ -567,8 +567,8 @@ module Autoproj
567
567
  # This is useful to avoid building packages that are of no use for the
568
568
  # user.
569
569
  def excluded?(package_name)
570
- if data['excluded_packages']
571
- data['excluded_packages'].any? { |l| Regexp.new(l) =~ package_name }
570
+ if data['exclude_packages']
571
+ data['exclude_packages'].any? { |l| Regexp.new(l) =~ package_name }
572
572
  else
573
573
  false
574
574
  end
@@ -944,7 +944,7 @@ module Autoproj
944
944
  packages.values.
945
945
  map { |pkg| pkg.autobuild.name }
946
946
  end
947
- names = names.delete_if { |pkg_name| excluded?(pkg_name) }
947
+ names.delete_if { |pkg_name| excluded?(pkg_name) || ignored?(pkg_name) }
948
948
  names.to_set
949
949
  end
950
950
 
@@ -1067,6 +1067,10 @@ module Autoproj
1067
1067
  end
1068
1068
  end
1069
1069
  end
1070
+
1071
+ # Finally, remove packages that are explicitely excluded and/or
1072
+ # ignored
1073
+ expanded_packages.delete_if { |pkg_name| excluded?(pkg_name) || ignored?(pkg_name) }
1070
1074
  expanded_packages.to_set
1071
1075
  end
1072
1076
  end
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 1
9
- version: 1.5.1
8
+ - 2
9
+ version: 1.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sylvain Joyeux
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-27 00:00:00 +02:00
17
+ date: 2010-05-28 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency