vanagon 0.18.1 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/build +3 -1
  4. data/bin/build_host_info +3 -1
  5. data/bin/build_requirements +3 -1
  6. data/bin/inspect +3 -1
  7. data/bin/render +3 -1
  8. data/bin/repo +3 -1
  9. data/bin/ship +3 -1
  10. data/bin/sign +3 -1
  11. data/lib/vanagon/cli.rb +4 -2
  12. data/lib/vanagon/cli/build.rb +2 -1
  13. data/lib/vanagon/cli/build_host_info.rb +3 -2
  14. data/lib/vanagon/cli/build_requirements.rb +4 -4
  15. data/lib/vanagon/cli/completion.rb +4 -3
  16. data/lib/vanagon/cli/inspect.rb +3 -2
  17. data/lib/vanagon/cli/list.rb +16 -6
  18. data/lib/vanagon/cli/render.rb +2 -1
  19. data/lib/vanagon/cli/ship.rb +4 -19
  20. data/lib/vanagon/cli/sign.rb +3 -2
  21. data/lib/vanagon/component.rb +13 -10
  22. data/lib/vanagon/component/dsl.rb +27 -20
  23. data/lib/vanagon/component/source.rb +2 -1
  24. data/lib/vanagon/component/source/git.rb +35 -10
  25. data/lib/vanagon/component/source/http.rb +3 -2
  26. data/lib/vanagon/component/source/local.rb +2 -1
  27. data/lib/vanagon/component/source/rewrite.rb +3 -2
  28. data/lib/vanagon/driver.rb +20 -23
  29. data/lib/vanagon/engine/always_be_scheduling.rb +12 -11
  30. data/lib/vanagon/engine/docker.rb +2 -1
  31. data/lib/vanagon/engine/ec2.rb +5 -4
  32. data/lib/vanagon/engine/hardware.rb +4 -3
  33. data/lib/vanagon/engine/pooler.rb +6 -5
  34. data/lib/vanagon/environment.rb +3 -2
  35. data/lib/vanagon/logger.rb +31 -0
  36. data/lib/vanagon/platform.rb +38 -5
  37. data/lib/vanagon/platform/defaults/debian-10-amd64.rb +11 -0
  38. data/lib/vanagon/platform/defaults/debian-8-amd64.rb +12 -0
  39. data/lib/vanagon/platform/defaults/debian-8-i386.rb +12 -0
  40. data/lib/vanagon/platform/defaults/debian-9-amd64.rb +12 -0
  41. data/lib/vanagon/platform/defaults/debian-9-i386.rb +12 -0
  42. data/lib/vanagon/platform/defaults/el-6-i386.rb +11 -0
  43. data/lib/vanagon/platform/defaults/el-6-x86_64.rb +11 -0
  44. data/lib/vanagon/platform/defaults/el-7-aarch64.rb +13 -0
  45. data/lib/vanagon/platform/defaults/el-7-x86_64.rb +11 -0
  46. data/lib/vanagon/platform/defaults/el-8-aarch64.rb +10 -0
  47. data/lib/vanagon/platform/defaults/el-8-x86_64.rb +10 -0
  48. data/lib/vanagon/platform/defaults/fedora-30-x86_64.rb +11 -0
  49. data/lib/vanagon/platform/defaults/fedora-31-x86_64.rb +11 -0
  50. data/lib/vanagon/platform/defaults/fedora-32-x86_64.rb +11 -0
  51. data/lib/vanagon/platform/defaults/osx-10.14-x86_64.rb +22 -0
  52. data/lib/vanagon/platform/defaults/osx-10.15-x86_64.rb +21 -0
  53. data/lib/vanagon/platform/defaults/redhatfips-7-x86_64.rb +11 -0
  54. data/lib/vanagon/platform/defaults/sles-12-x86_64.rb +11 -0
  55. data/lib/vanagon/platform/defaults/sles-15-x86_64.rb +10 -0
  56. data/lib/vanagon/platform/defaults/solaris-11-i386.rb +9 -0
  57. data/lib/vanagon/platform/defaults/solaris-11-sparc.rb +10 -0
  58. data/lib/vanagon/platform/defaults/ubuntu-16.04-amd64.rb +12 -0
  59. data/lib/vanagon/platform/defaults/ubuntu-16.04-i386.rb +12 -0
  60. data/lib/vanagon/platform/defaults/ubuntu-18.04-amd64.rb +12 -0
  61. data/lib/vanagon/platform/defaults/ubuntu-20.04-aarch64.rb +11 -0
  62. data/lib/vanagon/platform/defaults/ubuntu-20.04-amd64.rb +11 -0
  63. data/lib/vanagon/platform/dsl.rb +30 -6
  64. data/lib/vanagon/platform/windows.rb +3 -1
  65. data/lib/vanagon/project.rb +25 -15
  66. data/lib/vanagon/project/dsl.rb +6 -5
  67. data/lib/vanagon/utilities.rb +5 -4
  68. data/resources/deb/control.erb +1 -1
  69. data/resources/deb/postinst.erb +24 -13
  70. data/resources/deb/postrm.erb +9 -6
  71. data/resources/deb/prerm.erb +18 -8
  72. data/resources/osx/postinstall.erb +6 -2
  73. data/resources/rpm/project.spec.erb +12 -12
  74. data/resources/solaris/10/depend.erb +2 -2
  75. data/resources/solaris/10/postinstall.erb +11 -3
  76. data/resources/solaris/11/p5m.erb +2 -2
  77. data/spec/lib/vanagon/cli_spec.rb +57 -9
  78. data/spec/lib/vanagon/component/dsl_spec.rb +54 -10
  79. data/spec/lib/vanagon/component/source/git_spec.rb +4 -4
  80. data/spec/lib/vanagon/component_spec.rb +15 -2
  81. data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +4 -4
  82. data/spec/lib/vanagon/platform_spec.rb +80 -0
  83. data/spec/lib/vanagon/utilities_spec.rb +4 -1
  84. metadata +58 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f2bcc876c2ab62d16237b4af431f8c25d93db9c4cd204f8f07667f48451b9be
4
- data.tar.gz: 231ba1237f8f5c7b1656271e6d627955ebed719c00ee6c59f1070266f698c276
3
+ metadata.gz: 1e832c071ba2d54e8c938fbeace5fe1c0287bc25b2ff405b6b2d1ca5dbc9f44f
4
+ data.tar.gz: 1af5c0c38870de680a4cc1f037a94fa6595d22d0e9b70147371650beb11d7130
5
5
  SHA512:
6
- metadata.gz: 871d364f36c00ba3f8ecfa6a2e0bb593c12577c14cfe961f9a285b4beb105153de4f3e34adf457fdca1ac066570209c3882691531aa7e9db99158c3f61c5dddd
7
- data.tar.gz: 4cd3a458968855eafb4f2643215ae59a9f0b508985b002aa7ef1a42cba0c3f484579b585dc0817f690f6f81ea8fb13b1984c1c89c82141311bebb7d047f6f868
6
+ metadata.gz: 53756b8e737fbe884d6e5ce934442778d07407b638d34186c1b19f658981b5e36a79d0c7c272b0efe82a7f86ded6479ab0a5e1fc7962b0112dfd85732168095c
7
+ data.tar.gz: 21b9ebef8bb1d8a54650c4a35551abdf8142d9e28689d843f96278ad81d5081877ec9eb6d4d9432799feb464a2f682754d78d3af6cf4b8c20d17bc0ea3c94145
data/README.md CHANGED
@@ -197,8 +197,8 @@ Port of the system where redis is running. Defaults to *6379*.
197
197
  ##### `VANAGON_USE_MIRRORS`
198
198
  Controls whether component sources are downloaded directly from upstream URLs
199
199
  or from configured mirrors. Most Puppet projects using Vanagon default to
200
- fetching components from internal mirrors. Set this variable to `n` when
201
- building outside of the Puppet private network to download directly from
200
+ fetching components from internal mirrors. Set this variable to `n` or `false`
201
+ when building outside of the Puppet private network to download directly from
202
202
  upstream sources.
203
203
 
204
204
  ##### `VANAGON_RETRY_COUNT`
data/bin/build CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/bin/build_host_info CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/bin/inspect CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/bin/render CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/bin/repo CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  ENV["PROJECT_ROOT"] = Dir.pwd
4
6
 
5
7
  # Begin warning: This ship script is an internal tool.
@@ -21,7 +23,7 @@ when 'rpm'
21
23
  when 'deb'
22
24
  Pkg::Util::RakeUtils.invoke_task('pl:jenkins:deb_repos')
23
25
  when 'none'
24
- $stdout.puts "Skipping repo generation since repo target is set to 'none'"
26
+ VanagonLogger.warn "Skipping repo generation since repo target is set to 'none'"
25
27
  else
26
28
  Pkg::Util::RakeUtils.invoke_task('pl:jenkins:rpm_repos')
27
29
  Pkg::Util::RakeUtils.invoke_task('pl:jenkins:deb_repos')
data/bin/ship CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/bin/sign CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'vanagon/logger'
4
+
3
5
  script = File.basename($0)
4
6
 
5
- warn "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
7
+ VanagonLogger.info "#{script}: Warning: use of stand alone '#{script}' command is deprecated and may be removed.
6
8
  Use: 'vanagon #{script}' instead."
7
9
 
8
10
  exec "vanagon", script, *ARGV
data/lib/vanagon/cli.rb CHANGED
@@ -15,6 +15,8 @@ require 'vanagon/cli/render'
15
15
  require 'vanagon/cli/ship'
16
16
  require 'vanagon/cli/sign'
17
17
 
18
+ require 'vanagon/logger'
19
+
18
20
 
19
21
  class Vanagon
20
22
  class InvalidArgument < StandardError
@@ -66,7 +68,7 @@ class Vanagon
66
68
  puts DOCUMENTATION
67
69
  exit 0
68
70
  else
69
- warn "vanagon: Error: unknown command: \"#{sub_command}\"\n\n#{DOCUMENTATION}"
71
+ VanagonLogger.error "vanagon: Error: unknown command: \"#{sub_command}\"\n\n#{DOCUMENTATION}"
70
72
  exit 1
71
73
  end
72
74
 
@@ -95,7 +97,7 @@ class Vanagon
95
97
  def parse_options(argv)
96
98
  Docopt.docopt(DOCUMENTATION, { argv: argv, options_first: true })
97
99
  rescue Docopt::Exit => e
98
- puts e.message
100
+ VanagonLogger.error e.message
99
101
  exit 1
100
102
  end
101
103
  end
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -32,7 +33,7 @@ class Vanagon
32
33
  def parse(argv)
33
34
  Docopt.docopt(DOCUMENTATION, { argv: argv })
34
35
  rescue Docopt::Exit => e
35
- puts e.message
36
+ VanagonLogger.error e.message
36
37
  exit 1
37
38
  end
38
39
 
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -26,7 +27,7 @@ class Vanagon
26
27
  def parse(argv)
27
28
  Docopt.docopt(DOCUMENTATION, { argv: argv })
28
29
  rescue Docopt::Exit => e
29
- puts e.message
30
+ VanagonLogger.error e.message
30
31
  exit 1
31
32
  end
32
33
 
@@ -36,7 +37,7 @@ class Vanagon
36
37
 
37
38
  platforms.each do |platform|
38
39
  driver = Vanagon::Driver.new(platform, project, options)
39
- $stdout.puts JSON.generate(driver.build_host_info)
40
+ VanagonLogger.warn JSON.generate(driver.build_host_info)
40
41
  end
41
42
  end
42
43
 
@@ -1,5 +1,6 @@
1
1
  require 'docopt'
2
2
  require 'json'
3
+ require 'vanagon/logger'
3
4
 
4
5
  class Vanagon
5
6
  class CLI
@@ -27,7 +28,7 @@ class Vanagon
27
28
  def parse(argv)
28
29
  Docopt.docopt(DOCUMENTATION, { argv: argv })
29
30
  rescue Docopt::Exit => e
30
- puts e.message
31
+ VanagonLogger.error e.message
31
32
  exit 1
32
33
  end
33
34
 
@@ -47,9 +48,8 @@ class Vanagon
47
48
  end
48
49
  end
49
50
 
50
- $stdout.puts
51
- $stdout.puts "**** External packages required to build #{project} on #{platform}: ***"
52
- $stdout.puts JSON.pretty_generate(build_requirements.flatten.uniq.sort)
51
+ VanagonLogger.warn "**** External packages required to build #{project} on #{platform}: ***"
52
+ VanagonLogger.warn JSON.pretty_generate(build_requirements.flatten.uniq.sort)
53
53
  end
54
54
 
55
55
  def options_translate(docopt_options)
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -15,7 +16,7 @@ class Vanagon
15
16
  def parse(argv)
16
17
  Docopt.docopt(DOCUMENTATION, { argv: argv })
17
18
  rescue Docopt::Exit => e
18
- puts e.message
19
+ VanagonLogger.error e.message
19
20
  exit 1
20
21
  end
21
22
 
@@ -24,10 +25,10 @@ class Vanagon
24
25
  completion_file = File.expand_path(File.join('..', '..', '..', '..', 'extras', 'completions', "vanagon.#{shell}"), __FILE__)
25
26
 
26
27
  if File.exist?(completion_file)
27
- puts completion_file
28
+ VanagonLogger.warn completion_file
28
29
  exit 0
29
30
  else
30
- puts "Could not find completion file for '#{shell}': No such file #{completion_file}"
31
+ VanagonLogger.error "Could not find completion file for '#{shell}': No such file #{completion_file}"
31
32
  exit 1
32
33
  end
33
34
  end
@@ -1,5 +1,6 @@
1
1
  require 'docopt'
2
2
  require 'json'
3
+ require 'vanagon/logger'
3
4
 
4
5
  class Vanagon
5
6
  class CLI
@@ -30,7 +31,7 @@ class Vanagon
30
31
  def parse(argv)
31
32
  Docopt.docopt(DOCUMENTATION, { argv: argv })
32
33
  rescue Docopt::Exit => e
33
- puts e.message
34
+ VanagonLogger.error e.message
34
35
  exit 1
35
36
  end
36
37
 
@@ -41,7 +42,7 @@ class Vanagon
41
42
  platforms.each do |platform|
42
43
  driver = Vanagon::Driver.new(platform, project, options)
43
44
  components = driver.project.components.map(&:to_hash)
44
- $stdout.puts JSON.pretty_generate(components)
45
+ VanagonLogger.warn JSON.pretty_generate(components)
45
46
  end
46
47
  end
47
48
 
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -10,6 +11,7 @@ class Vanagon
10
11
  Options:
11
12
  -h, --help Display help
12
13
  -c, --configdir DIRECTORY Configuration directory [default: #{Dir.pwd}/configs]
14
+ -d, --defaults Display the list of default platforms
13
15
  -l, --platforms Display a list of platforms
14
16
  -r, --projects Display a list of projects
15
17
  -s, --use-spaces Displays the list as space separated
@@ -18,7 +20,7 @@ class Vanagon
18
20
  def parse(argv)
19
21
  Docopt.docopt(DOCUMENTATION, { argv: argv })
20
22
  rescue Docopt::Exit => e
21
- puts e.message
23
+ VanagonLogger.error e.message
22
24
  exit 1
23
25
  end
24
26
 
@@ -31,10 +33,14 @@ class Vanagon
31
33
  if Dir.exist?(File.join(options[:configdir], 'platforms')) == false ||
32
34
  Dir.exist?(File.join(options[:configdir], 'projects')) == false
33
35
 
34
- warn "Path to #{File.join(options[:configdir], 'platforms')} or #{File.join(options[:configdir], 'projects')} not found."
36
+ VanagonLogger.error "Path to #{File.join(options[:configdir], 'platforms')} or #{File.join(options[:configdir], 'projects')} not found."
35
37
  exit 1
36
38
  end
37
39
 
40
+ default_list = Dir.children(File.join(File.dirname(__FILE__), '..', 'platform', 'defaults')).map do |platform|
41
+ File.basename(platform, File.extname(platform))
42
+ end
43
+
38
44
  platform_list = Dir.children(File.join(options[:configdir], 'platforms')).map do |platform|
39
45
  File.basename(platform, File.extname(platform))
40
46
  end
@@ -43,20 +49,23 @@ class Vanagon
43
49
  File.basename(project, File.extname(project))
44
50
  end
45
51
 
52
+ if options[:defaults]
53
+ puts "- Defaults", output(default_list, options[:use_spaces])
54
+ return
55
+ end
56
+
46
57
  if options[:projects] == options[:platforms]
47
58
  puts "- Projects", output(project_list, options[:use_spaces]), "\n", "- Platforms", output(platform_list, options[:use_spaces])
48
59
  return
49
60
  end
50
61
 
51
62
  if options[:projects]
52
- puts "- Projects"
53
- puts output(project_list, options[:use_spaces])
63
+ puts "- Projects", output(project_list, options[:use_spaces])
54
64
  return
55
65
  end
56
66
 
57
67
  if options[:platforms]
58
- puts "- Platforms"
59
- puts output(platform_list, options[:use_spaces])
68
+ puts "- Platforms", output(platform_list, options[:use_spaces])
60
69
  return
61
70
  end
62
71
  end
@@ -64,6 +73,7 @@ class Vanagon
64
73
  def options_translate(docopt_options)
65
74
  translations = {
66
75
  '--configdir' => :configdir,
76
+ '--defaults' => :defaults,
67
77
  '--platforms' => :platforms,
68
78
  '--projects' => :projects,
69
79
  '--use-spaces' => :use_spaces,
@@ -1,5 +1,6 @@
1
1
  require 'docopt'
2
2
  require 'json'
3
+ require 'vanagon/logger'
3
4
 
4
5
  class Vanagon
5
6
  class CLI
@@ -27,7 +28,7 @@ class Vanagon
27
28
  def parse(argv)
28
29
  Docopt.docopt(DOCUMENTATION, { argv: argv })
29
30
  rescue Docopt::Exit => e
30
- puts e.message
31
+ VanagonLogger.error e.message
31
32
  exit 1
32
33
  end
33
34
 
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -14,38 +15,22 @@ class Vanagon
14
15
  def parse(argv)
15
16
  Docopt.docopt(DOCUMENTATION, { argv: argv })
16
17
  rescue Docopt::Exit => e
17
- puts e.message
18
+ VanagonLogger.error e.message
18
19
  exit 1
19
20
  end
20
21
 
21
22
  def run(_)
22
23
  ENV['PROJECT_ROOT'] = Dir.pwd
23
24
 
24
- artifactory_warning = <<-DOC
25
- Unable to ship packages to artifactory. Please make sure you are pointing to a
26
- recent version of packaging in your Gemfile. Please also make sure you include
27
- the artifactory gem in your Gemfile.
28
-
29
- Examples:
30
- gem 'packaging', :github => 'puppetlabs/packaging', branch: '1.0.x'
31
- gem 'artifactory'
32
- DOC
33
-
34
25
  if Dir['output/**/*'].select { |entry| File.file?(entry) }.empty?
35
- warn 'vanagon: Error: No packages to ship in the "output" directory. Maybe build some first?'
26
+ VanagonLogger.error 'vanagon: Error: No packages to ship in the "output" directory. Maybe build some first?'
36
27
  exit 1
37
28
  end
38
29
 
39
30
  require 'packaging'
40
31
  Pkg::Util::RakeUtils.load_packaging_tasks
41
32
  Pkg::Util::RakeUtils.invoke_task('pl:jenkins:ship', 'artifacts', 'output')
42
- begin
43
- Pkg::Util::RakeUtils.invoke_task('pl:jenkins:ship_to_artifactory', 'output')
44
- rescue LoadError
45
- warn artifactory_warning
46
- rescue StandardError
47
- warn artifactory_warning
48
- end
33
+ Pkg::Util::RakeUtils.invoke_task('pl:jenkins:ship_to_artifactory', 'output')
49
34
  end
50
35
  end
51
36
  end
@@ -1,4 +1,5 @@
1
1
  require 'docopt'
2
+ require 'vanagon/logger'
2
3
 
3
4
  class Vanagon
4
5
  class CLI
@@ -14,14 +15,14 @@ class Vanagon
14
15
  def parse(argv)
15
16
  Docopt.docopt(DOCUMENTATION, { argv: argv })
16
17
  rescue Docopt::Exit => e
17
- puts e.message
18
+ VanagonLogger.error e.message
18
19
  exit 1
19
20
  end
20
21
 
21
22
  def run(_)
22
23
  ENV['PROJECT_ROOT'] = Dir.pwd
23
24
  if Dir['output/**/*'].select { |entry| File.file?(entry) }.empty?
24
- warn 'sign: Error: No packages to sign in the "output" directory. Maybe build some first?'
25
+ VanagonLogger.error 'sign: Error: No packages to sign in the "output" directory. Maybe build some first?'
25
26
  exit 1
26
27
  end
27
28
 
@@ -3,6 +3,8 @@ require 'vanagon/component/rules'
3
3
  require 'vanagon/component/source'
4
4
  require 'vanagon/component/source/rewrite'
5
5
 
6
+ require 'vanagon/logger'
7
+
6
8
  class Vanagon
7
9
  class Component
8
10
  include Vanagon::Utilities
@@ -138,9 +140,9 @@ class Vanagon
138
140
  dsl.instance_eval(File.read(compfile), compfile, 1)
139
141
  dsl._component
140
142
  rescue StandardError => e
141
- warn "Error loading project '#{name}' using '#{compfile}':"
142
- warn e
143
- warn e.backtrace.join("\n")
143
+ VanagonLogger.error "Error loading project '#{name}' using '#{compfile}':"
144
+ VanagonLogger.error e
145
+ VanagonLogger.error e.backtrace.join("\n")
144
146
  raise e
145
147
  end
146
148
 
@@ -178,6 +180,7 @@ class Vanagon
178
180
  @preremove_actions = []
179
181
  @postremove_actions = []
180
182
  @install_only = false
183
+ @service = []
181
184
  end
182
185
 
183
186
  # Adds the given file to the list of files and returns @files.
@@ -254,18 +257,18 @@ class Vanagon
254
257
  def fetch_mirrors(options)
255
258
  mirrors.to_a.shuffle.each do |mirror|
256
259
  begin
257
- warn %(Attempting to fetch from mirror URL "#{mirror}")
260
+ VanagonLogger.info %(Attempting to fetch from mirror URL "#{mirror}")
258
261
  @source = Vanagon::Component::Source.source(mirror, options)
259
262
  return true if source.fetch
260
263
  rescue SocketError
261
264
  # SocketError means that there was no DNS/name resolution
262
265
  # for whatever remote protocol the mirror tried to use.
263
- warn %(Unable to resolve mirror URL "#{mirror}")
266
+ VanagonLogger.error %(Unable to resolve mirror URL "#{mirror}")
264
267
  rescue RuntimeError
265
268
  # Source retrieval does not consistently return a meaningful
266
269
  # namespaced error message, which means we're brute-force rescuing
267
270
  # RuntimeError. Not a good look, and we should fix this.
268
- warn %(Unable to retrieve mirror URL "#{mirror}")
271
+ VanagonLogger.error %(Unable to retrieve mirror URL "#{mirror}")
269
272
  end
270
273
  end
271
274
  false
@@ -277,7 +280,7 @@ class Vanagon
277
280
  # @return [Boolean] return True if the source can be retrieved,
278
281
  # or False otherwise
279
282
  def fetch_url(options)
280
- warn %(Attempting to fetch from canonical URL "#{url}")
283
+ VanagonLogger.info %(Attempting to fetch from canonical URL "#{url}")
281
284
  @source = Vanagon::Component::Source.source(url, options)
282
285
  # Explicitly coerce the return value of #source.fetch,
283
286
  # because each subclass of Vanagon::Component::Source returns
@@ -303,7 +306,7 @@ class Vanagon
303
306
  def get_source(workdir) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
304
307
  opts = options.merge({ workdir: workdir })
305
308
  if url || !mirrors.empty?
306
- if ENV['VANAGON_USE_MIRRORS'] == 'n'
309
+ if ENV['VANAGON_USE_MIRRORS'] == 'n' or ENV['VANAGON_USE_MIRRORS'] == 'false'
307
310
  fetch_url(opts)
308
311
  else
309
312
  fetch_mirrors(opts) || fetch_url(opts)
@@ -319,7 +322,7 @@ class Vanagon
319
322
  @version ||= source.version
320
323
  end
321
324
  else
322
- warn "No source given for component '#{@name}'"
325
+ VanagonLogger.info "No source given for component '#{@name}'"
323
326
 
324
327
  # If there is no source, we don't want to try to change directories, so we just change to the current directory.
325
328
  @dirname = './'
@@ -407,7 +410,7 @@ class Vanagon
407
410
  # @return [String] environment suitable for inclusion in a Makefile
408
411
  # @deprecated
409
412
  def get_environment
410
- warn <<-WARNING.undent
413
+ VanagonLogger.info <<-WARNING.undent
411
414
  #get_environment is deprecated; environment variables have been moved
412
415
  into the Makefile, and should not be used within a Makefile's recipe.
413
416
  The #get_environment method will be removed by Vanagon 1.0.0.