autoproj 2.15.1 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79dfca26614ef3c2b0491b7c91979986dd94e3c74ae0a15bc4a3b6729c0d0bd4
4
- data.tar.gz: 425261fdab1ec54880133f874a357a1b4adb0a247d08c421da02dde615e4c1b4
3
+ metadata.gz: bb77cb6d5c3c156ae3d665933ec7380f5b0ae491767b87c6e6f25c9c96966885
4
+ data.tar.gz: 1474ca4f6e00f46dc70631f25c70e0cf0340d85f62101053117faf79ed65bd21
5
5
  SHA512:
6
- metadata.gz: 2e46b35e75abf68b4cf1643ffe96b915179b3a2e59862c95248ed64ae8eb1d54ae892ea7dd006db87f7722a065f24512e26435e0f848458d23e67f12a41f7165
7
- data.tar.gz: 371003014229e5023749734b108bf4484059ad3fd0e73f9b7dfcf6cabe426d709b8d2aca75415b10687354eae17eebf9c6b6835006c505f40a1093983217084d
6
+ metadata.gz: e1fb865f1ecdfa9d290c9dbb6048e601ca99f8e691643a36ada2528137c47819a30172e7abf9bd3d5cd91c44148fa0b8a8793b4a6783fb9bee52661cad960777
7
+ data.tar.gz: 6c9b821c1158e70bdb9a98536998dafe6270f4bb778646171d4691cc82fe0ce9828e263fda268ebaeced020cc7dcdfd30a33b9e5ea5593774f1ffe39eb0326c7
@@ -606,5 +606,39 @@ module Autoproj
606
606
  end
607
607
  result
608
608
  end
609
+
610
+ # Allows to load a seed-config.yml file (also from a buildconf repository)
611
+ # rather than providing it before checkout using the --seed-config paramater
612
+ # of the autoproj_bootstrap script
613
+ # this allows to bootstrap with --no-interactive and still apply a custom config e.g. in CI/CD
614
+ # The call to this function has to be in the init.rb of the buildconf BEFORE any other
615
+ # config option, e.g. the git server configuration settings
616
+ # The filename parameter is the name of the config seed yml file in the repository
617
+ def load_config_once(filename, config_dir: Autoproj.workspace.config_dir)
618
+ seed_config = File.expand_path(filename, config_dir)
619
+
620
+ return if get("default_config_applied_#{seed_config}", false)
621
+
622
+ Autoproj.message "loading seed config #{seed_config}"
623
+ load path: seed_config
624
+ set "default_config_applied_#{seed_config}", true, true
625
+ end
626
+
627
+ # Similar to load_config_once but asks the user if the default config should be applied
628
+ def load_config_once_with_permission(filename, default: "yes", config_dir: Autoproj.workspace.config_dir)
629
+ seed_config = File.expand_path(filename, config_dir)
630
+ # only run this code if config has not beed applied already (don't run when reconfiguring)
631
+ return if has_value_for?("use_default_config_#{seed_config}")
632
+
633
+ declare "use_default_config_#{seed_config}",
634
+ "boolean",
635
+ default: default,
636
+ doc: ["Should the default workspace config be used?",
637
+ "This buildconf denines a default configuration in the buildconf (#{seed_config})",
638
+ "Should it be applied?"]
639
+ if get("use_default_config_#{seed_config}")
640
+ load_config_once(filename, config_dir: config_dir)
641
+ end
642
+ end
609
643
  end
610
644
  end
@@ -32,10 +32,24 @@ module Autoproj
32
32
  @dag.add_edge p, root_pkg_set
33
33
  end
34
34
  end
35
+ end
35
36
 
36
- unless @dag.acyclic?
37
- raise "The package set hierarchy contains cycles: #{@dag.cycles}"
37
+ def verify_acyclic
38
+ return if @dag.acyclic?
39
+
40
+ Autoproj.fatal "The package sets form (a) cycle(s)"
41
+ @dag.cycles.each_with_index do |cycle, index|
42
+ Autoproj.fatal "== Cycle #{index}"
43
+ (cycle + cycle[0, 1]).each_cons(2) do |a, b|
44
+ if b.imports.include?(a)
45
+ Autoproj.fatal " #{b.name} depends on #{a.name} in its source.yml"
46
+ else
47
+ Autoproj.fatal " #{b.name} is after #{a.name} in the package_sets section of the manifest"
48
+ end
49
+ end
38
50
  end
51
+
52
+ raise ConfigError.new "cycles in package set dependencies"
39
53
  end
40
54
 
41
55
  # Flatten the hierarchy, a establish a sorting
@@ -363,6 +377,7 @@ module Autoproj
363
377
  # the local package set (by main configuration) last
364
378
  def sort_package_sets_by_import_order(package_sets, root_pkg_set)
365
379
  c = PackageSetHierarchy.new(package_sets, root_pkg_set)
380
+ c.verify_acyclic
366
381
  sorted_pkg_sets = c.flatten
367
382
 
368
383
  if sorted_pkg_sets.last != root_pkg_set
@@ -626,12 +641,18 @@ module Autoproj
626
641
  root_pkg_set.imports.each do |pkg_set|
627
642
  pkg_set.explicit = true
628
643
  end
644
+
645
+ # sort packages, main package is the last
629
646
  package_sets = sort_package_sets_by_import_order(package_sets, root_pkg_set)
630
647
  ws.manifest.reset_package_sets
631
648
  package_sets.each do |pkg_set|
632
- ws.load_if_present(pkg_set, pkg_set.local_dir, "init.rb")
633
649
  ws.manifest.register_package_set(pkg_set)
634
650
  end
651
+
652
+ ws.manifest.each_package_set do |pkg_set|
653
+ ws.load_if_present(pkg_set, pkg_set.local_dir, "init.rb")
654
+ end
655
+
635
656
  failures
636
657
  end
637
658
  end
@@ -793,23 +793,6 @@ module Autoproj
793
793
  vcs
794
794
  end
795
795
 
796
- # Recursively resolve imports for a given package set
797
- def self.resolve_imports(pkg_set, parents = Set.new)
798
- return Set.new if pkg_set.imports.empty?
799
-
800
- updated_parents = parents | [pkg_set]
801
-
802
- imports = pkg_set.imports.dup
803
- pkg_set.imports.each do |p|
804
- if parents.include?(p)
805
- raise "Cycling dependency between package sets encountered:" \
806
- "#{p.name} <--> #{pkg_set.name}"
807
- end
808
- imports.merge(resolve_imports(p, updated_parents))
809
- end
810
- imports
811
- end
812
-
813
796
  # Enumerates the Autobuild::Package instances that are defined in this
814
797
  # source
815
798
  def each_package
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.15.1"
2
+ VERSION = "2.16.0"
3
3
  end
data/lib/autoproj.rb CHANGED
@@ -63,7 +63,7 @@ require "utilrb/logger"
63
63
 
64
64
  module Autoproj
65
65
  class << self
66
- attr_reader :logger
66
+ attr_accessor :logger
67
67
  end
68
68
  @logger = Logger.new(STDOUT)
69
69
  logger.level = Logger::WARN
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.1
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autobuild