puppet 2.7.25 → 2.7.26

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (77) hide show
  1. data/bin/puppet +4 -0
  2. data/ext/build_defaults.yaml +4 -4
  3. data/ext/debian/control +1 -1
  4. data/ext/packaging/Gemfile +8 -0
  5. data/ext/packaging/Gemfile.lock +28 -0
  6. data/ext/packaging/README.md +31 -4
  7. data/ext/packaging/lib/packaging.rb +21 -0
  8. data/ext/packaging/lib/packaging/config.rb +277 -0
  9. data/ext/packaging/lib/packaging/config/params.rb +175 -0
  10. data/ext/packaging/lib/packaging/tar.rb +186 -0
  11. data/ext/packaging/lib/packaging/util.rb +44 -0
  12. data/ext/packaging/lib/packaging/util/date.rb +15 -0
  13. data/ext/packaging/lib/packaging/util/file.rb +60 -0
  14. data/ext/packaging/lib/packaging/util/jira.rb +83 -0
  15. data/ext/packaging/lib/packaging/util/net.rb +16 -0
  16. data/ext/packaging/lib/packaging/util/rake_utils.rb +57 -0
  17. data/ext/packaging/lib/packaging/util/serialization.rb +19 -0
  18. data/ext/packaging/lib/packaging/util/tool.rb +30 -0
  19. data/ext/packaging/lib/packaging/util/version.rb +300 -0
  20. data/ext/packaging/packaging.rake +10 -5
  21. data/ext/packaging/spec/fixtures/config/ext/build_defaults.yaml +2 -0
  22. data/ext/packaging/spec/fixtures/config/ext/project_data.yaml +2 -0
  23. data/ext/packaging/spec/fixtures/config/params.yaml +2 -0
  24. data/ext/packaging/spec/fixtures/util/pre_tasks.yaml +4 -0
  25. data/ext/packaging/spec/lib/packaging/config_spec.rb +330 -0
  26. data/ext/packaging/spec/lib/packaging/tar_spec.rb +122 -0
  27. data/ext/packaging/spec/lib/packaging/util/file_spec.rb +48 -0
  28. data/ext/packaging/spec/lib/packaging/util/jira_spec.rb +50 -0
  29. data/ext/packaging/spec/lib/packaging/util/net_spec.rb +23 -0
  30. data/ext/packaging/spec/lib/packaging/util/rake_utils_spec.rb +70 -0
  31. data/ext/packaging/spec/lib/packaging/util/version_spec.rb +67 -0
  32. data/ext/packaging/spec/lib/packaging_spec.rb +19 -0
  33. data/ext/packaging/spec/spec_helper.rb +10 -0
  34. data/ext/packaging/spec/tasks/00_utils_spec.rb +218 -88
  35. data/ext/packaging/tasks/00_utils.rake +63 -320
  36. data/ext/packaging/tasks/30_metrics.rake +4 -4
  37. data/ext/packaging/tasks/apple.rake +28 -13
  38. data/ext/packaging/tasks/build.rake +2 -176
  39. data/ext/packaging/tasks/deb.rake +61 -20
  40. data/ext/packaging/tasks/deb_repos.rake +12 -12
  41. data/ext/packaging/tasks/doc.rake +5 -5
  42. data/ext/packaging/tasks/fetch.rake +9 -9
  43. data/ext/packaging/tasks/gem.rake +59 -33
  44. data/ext/packaging/tasks/ips.rake +22 -23
  45. data/ext/packaging/tasks/jenkins.rake +34 -34
  46. data/ext/packaging/tasks/jenkins_dynamic.rake +22 -19
  47. data/ext/packaging/tasks/load_extras.rake +21 -0
  48. data/ext/packaging/tasks/mock.rake +16 -16
  49. data/ext/packaging/tasks/pe_deb.rake +2 -2
  50. data/ext/packaging/tasks/pe_remote.rake +9 -9
  51. data/ext/packaging/tasks/pe_rpm.rake +1 -1
  52. data/ext/packaging/tasks/pe_ship.rake +48 -37
  53. data/ext/packaging/tasks/pe_sign.rake +5 -5
  54. data/ext/packaging/tasks/release.rake +5 -5
  55. data/ext/packaging/tasks/remote_build.rake +27 -27
  56. data/ext/packaging/tasks/retrieve.rake +5 -5
  57. data/ext/packaging/tasks/rpm.rake +27 -10
  58. data/ext/packaging/tasks/rpm_repos.rake +13 -12
  59. data/ext/packaging/tasks/ship.rake +67 -45
  60. data/ext/packaging/tasks/sign.rake +37 -30
  61. data/ext/packaging/tasks/tar.rake +14 -69
  62. data/ext/packaging/tasks/tickets.rake +449 -0
  63. data/ext/packaging/tasks/update.rake +2 -2
  64. data/ext/packaging/tasks/vendor_gems.rake +2 -2
  65. data/ext/packaging/tasks/version.rake +8 -38
  66. data/ext/packaging/tasks/z_data_dump.rake +35 -3
  67. data/ext/packaging/templates/downstream.xml.erb +2 -2
  68. data/ext/packaging/templates/packaging.xml.erb +13 -13
  69. data/ext/packaging/templates/repo.xml.erb +9 -7
  70. data/lib/puppet/indirector/facts/facter.rb +1 -1
  71. data/lib/puppet/version.rb +1 -1
  72. data/spec/unit/indirector/facts/facter_spec.rb +2 -2
  73. metadata +38 -13
  74. data/ext/packaging/spec/tasks/build_object_spec.rb +0 -178
  75. data/ext/packaging/tasks/10_setupvars.rake +0 -135
  76. data/ext/packaging/tasks/20_setupextravars.rake +0 -53
  77. data/ext/packaging/tasks/template.rake +0 -27
@@ -1,7 +1,7 @@
1
1
  # Most projects set rdoc options in the context of gem building. However, mcollective
2
- # generates its own rdoc package. We can reuse the @build.gem_rdoc_options here
2
+ # generates its own rdoc package. We can reuse the Pkg::Config.gem_rdoc_options here
3
3
 
4
- if @build.build_doc
4
+ if Pkg::Config.build_doc
5
5
  begin
6
6
  require 'rdoc/task'
7
7
  rescue LoadError
@@ -11,10 +11,10 @@ if @build.build_doc
11
11
  namespace :package do
12
12
  RDoc::Task.new(:doc) do |rdoc|
13
13
  rdoc.rdoc_dir = 'doc'
14
- rdoc.title = "#{@build.project} version #{@build.version}"
15
- @build.gem_rdoc_options.each do |option|
14
+ rdoc.title = "#{Pkg::Config.project} version #{Pkg::Config.version}"
15
+ Pkg::Config.gem_rdoc_options.each do |option|
16
16
  rdoc.options << option
17
- end unless @build.gem_rdoc_options.nil?
17
+ end unless Pkg::Config.gem_rdoc_options.nil?
18
18
  end
19
19
  end
20
20
  end
@@ -4,11 +4,11 @@
4
4
  # also has a data file for information specific to it. If the project builds
5
5
  # both PE and not PE, it has two files, one for PE, and the other for FOSS
6
6
  #
7
- data_repo = 'https://raw.github.com/puppetlabs/build-data'
8
- project_data_branch = @build.project
9
- team_data_branch = @build.team
7
+ data_repo = 'https://raw.githubusercontent.com/puppetlabs/build-data'
8
+ project_data_branch = Pkg::Config.project
9
+ team_data_branch = Pkg::Config.team
10
10
 
11
- if @build.build_pe
11
+ if Pkg::Config.build_pe
12
12
  project_data_branch = 'pe-' + project_data_branch unless project_data_branch =~ /^pe-/
13
13
  team_data_branch = 'pe-' + team_data_branch unless team_data_branch =~ /^pe-/
14
14
  end
@@ -22,22 +22,22 @@ team_data_url = data_repo + '/' + team_data_branch
22
22
  # defaults specified in the source project repo, e.g. in ext/build_defaults.yaml
23
23
  #
24
24
  # It uses curl to download the files, and places them in a temporary
25
- # directory, e.g. /tmp/somedirectory/{project,team}/@build.builder_data_file
25
+ # directory, e.g. /tmp/somedirectory/{project,team}/Pkg::Config.builder_data_file
26
26
  namespace :pl do
27
27
  task :fetch do
28
28
  # Remove .packaging directory from old-style extras loading
29
29
  rm_rf "#{ENV['HOME']}/.packaging" if File.directory?("#{ENV['HOME']}/.packaging")
30
30
  # Touch the .packaging file which is allows packaging to present remote tasks
31
31
  touch "#{ENV['HOME']}/.packaging"
32
- if dist = el_version
32
+ if dist = Pkg::Util::Version.el_version
33
33
  if dist.to_i < 6
34
34
  flag = "-k"
35
35
  end
36
36
  end
37
37
  [project_data_url, team_data_url].each do |url|
38
38
  begin
39
- tempdir = get_temp
40
- %x{curl --fail --silent #{flag} #{url}/#{@build.builder_data_file} > #{tempdir}/#{@build.builder_data_file}}
39
+ tempdir = Pkg::Util::File.mktemp
40
+ %x{curl --fail --silent #{flag} #{url}/#{Pkg::Config.builder_data_file} > #{tempdir}/#{Pkg::Config.builder_data_file}}
41
41
  case $?.exitstatus
42
42
  when 0
43
43
  invoke_task("pl:load_extras", tempdir)
@@ -45,7 +45,7 @@ namespace :pl do
45
45
  if url == team_data_url
46
46
  fail "Could not load team extras data from #{url}. This should not normally happen"
47
47
  else
48
- puts "No build data file for #{@build.project}, skipping load of extra build data."
48
+ puts "No build data file for #{Pkg::Config.project}, skipping load of extra build data."
49
49
  end
50
50
  else
51
51
  fail "There was an error fetching the builder extras data from #{url}."
@@ -1,10 +1,10 @@
1
- if @build.build_gem
1
+ if Pkg::Config.build_gem
2
2
  require 'rubygems/package_task'
3
3
 
4
4
  def glob_gem_files
5
5
  gem_files = []
6
6
  gem_excludes_file_list = []
7
- gem_excludes_raw = @build.gem_excludes.nil? ? [] : @build.gem_excludes.split(' ')
7
+ gem_excludes_raw = Pkg::Config.gem_excludes.nil? ? [] : Pkg::Config.gem_excludes.split(' ')
8
8
  gem_excludes_raw << 'ext/packaging'
9
9
  gem_excludes_raw.each do |exclude|
10
10
  if File.directory?(exclude)
@@ -13,7 +13,7 @@ if @build.build_gem
13
13
  gem_excludes_file_list << exclude
14
14
  end
15
15
  end
16
- files = FileList[@build.gem_files.split(' ')]
16
+ files = FileList[Pkg::Config.gem_files.split(' ')]
17
17
  files.each do |file|
18
18
  if File.directory?(file)
19
19
  gem_files += FileList["#{file}/**/*"]
@@ -39,50 +39,75 @@ if @build.build_gem
39
39
 
40
40
  def create_default_gem_spec
41
41
  spec = Gem::Specification.new do |s|
42
- s.name = @build.project unless @build.project.nil?
43
- s.name = @build.gem_name unless @build.gem_name.nil?
44
- s.version = @build.gemversion unless @build.gemversion.nil?
45
- s.author = @build.author unless @build.author.nil?
46
- s.email = @build.email unless @build.email.nil?
47
- s.homepage = @build.homepage unless @build.homepage.nil?
48
- s.summary = @build.summary unless @build.summary.nil?
49
- s.summary = @build.gem_summary unless @build.gem_summary.nil?
50
- s.description = @build.description unless @build.description.nil?
51
- s.description = @build.gem_description unless @build.gem_description.nil?
52
- s.files = glob_gem_files unless glob_gem_files.nil?
53
- s.executables = @build.gem_executables unless @build.gem_executables.nil?
54
- s.require_path = @build.gem_require_path unless @build.gem_require_path.nil?
55
- s.test_files = FileList[@build.gem_test_files.split(' ')] unless @build.gem_test_files.nil?
56
- s.rubyforge_project = @build.gem_forge_project unless @build.gem_forge_project.nil?
57
- @build.gem_rdoc_options.each do |option|
42
+ s.name = Pkg::Config.project unless Pkg::Config.project.nil?
43
+ s.name = Pkg::Config.gem_name unless Pkg::Config.gem_name.nil?
44
+ s.version = Pkg::Config.gemversion unless Pkg::Config.gemversion.nil?
45
+ s.author = Pkg::Config.author unless Pkg::Config.author.nil?
46
+ s.email = Pkg::Config.email unless Pkg::Config.email.nil?
47
+ s.homepage = Pkg::Config.homepage unless Pkg::Config.homepage.nil?
48
+ s.summary = Pkg::Config.summary unless Pkg::Config.summary.nil?
49
+ s.summary = Pkg::Config.gem_summary unless Pkg::Config.gem_summary.nil?
50
+ s.description = Pkg::Config.description unless Pkg::Config.description.nil?
51
+ s.description = Pkg::Config.gem_description unless Pkg::Config.gem_description.nil?
52
+ s.files = glob_gem_files unless glob_gem_files.nil?
53
+ s.executables = Pkg::Config.gem_executables unless Pkg::Config.gem_executables.nil?
54
+ s.require_path = Pkg::Config.gem_require_path unless Pkg::Config.gem_require_path.nil?
55
+ s.test_files = FileList[Pkg::Config.gem_test_files.split(' ')] unless Pkg::Config.gem_test_files.nil?
56
+ s.rubyforge_project = Pkg::Config.gem_forge_project unless Pkg::Config.gem_forge_project.nil?
57
+ Pkg::Config.gem_rdoc_options.each do |option|
58
58
  s.rdoc_options << option
59
- end unless @build.gem_rdoc_options.nil?
59
+ end unless Pkg::Config.gem_rdoc_options.nil?
60
60
  end
61
61
 
62
- @build.gem_runtime_dependencies.each do |gem, version|
62
+ Pkg::Config.gem_runtime_dependencies.each do |gem, version|
63
63
  spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :runtime)
64
- end unless @build.gem_runtime_dependencies.nil?
64
+ end unless Pkg::Config.gem_runtime_dependencies.nil?
65
65
 
66
- @build.gem_development_dependencies.each do |gem, version|
66
+ Pkg::Config.gem_development_dependencies.each do |gem, version|
67
67
  spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :development)
68
- end unless @build.gem_development_dependencies.nil?
68
+ end unless Pkg::Config.gem_development_dependencies.nil?
69
69
  spec
70
70
  end
71
71
 
72
+ def copy_gem_files_into(workdir)
73
+ # Take all of the gem files (both test and lib), and copy them into the workdir
74
+ (glob_gem_files + FileList[(Pkg::Config.gem_test_files || '').split(' ')]).each do |file|
75
+ if File.directory?(file)
76
+ mkpath(File.join(workdir, file))
77
+ else
78
+ mkpath(File.dirname( File.join(workdir, file) ), :verbose => false)
79
+ cp(file, File.join(workdir, file), :verbose => true, :preserve => false)
80
+ end
81
+ end
82
+ end
83
+
72
84
  def create_gem(spec, gembuilddir)
73
- gem_task = Gem::PackageTask.new(spec)
85
+ workdir = File.join(Pkg::Util::File.mktemp)
86
+ mkpath workdir
87
+
74
88
  bench = Benchmark.realtime do
75
- gem_task.define
76
- Rake::Task[:gem].reenable
77
- Rake::Task[:gem].invoke
78
- rm_r File.join("pkg", gembuilddir)
89
+ copy_gem_files_into(workdir)
90
+
91
+ # Burn in the version for the project if needed
92
+ Pkg::Util::Version.versionbump(workdir) if Pkg::Config.update_version_file
93
+
94
+ cd workdir do
95
+ gem_task = Gem::PackageTask.new(spec)
96
+ gem_task.define
97
+ Rake::Task[:gem].reenable
98
+ Rake::Task[:gem].invoke
99
+ rm_rf File.join("pkg", gembuilddir)
100
+ mv Dir.glob("pkg/#{Pkg::Config.gem_name}-#{Pkg::Config.gemversion}*.gem"), File.join(Pkg::Config.project_root, "pkg")
101
+ end
79
102
  end
103
+
104
+ rm_rf workdir
80
105
  puts "Finished building in: #{bench}"
81
106
  end
82
107
 
83
108
  def create_default_gem
84
109
  spec = create_default_gem_spec
85
- create_gem(spec, "#{@build.project}-#{@build.gemversion}")
110
+ create_gem(spec, "#{Pkg::Config.gem_name}-#{Pkg::Config.gemversion}")
86
111
  end
87
112
 
88
113
  def unknown_gems_platform?(platform)
@@ -91,7 +116,7 @@ if @build.build_gem
91
116
  end
92
117
 
93
118
  def create_platform_specific_gems
94
- @build.gem_platform_dependencies.each do |platform, dependency_hash|
119
+ Pkg::Config.gem_platform_dependencies.each do |platform, dependency_hash|
95
120
  spec = create_default_gem_spec
96
121
  pf = Gem::Platform.new(platform)
97
122
  fail "
@@ -111,15 +136,16 @@ if @build.build_gem
111
136
  spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => t)
112
137
  end
113
138
  end
114
- create_gem(spec, "#{@build.project}-#{@build.gemversion}-#{platform}")
139
+ create_gem(spec, "#{Pkg::Config.gem_name}-#{Pkg::Config.gemversion}-#{platform}")
115
140
  end
116
141
  end
117
142
 
118
143
  namespace :package do
119
144
  desc "Build a gem - All gems if platform specific"
120
145
  task :gem => [ "clean" ] do
146
+ mkdir_p File.join(Pkg::Config.project_root, "pkg")
121
147
  create_default_gem
122
- if @build.gem_platform_dependencies
148
+ if Pkg::Config.gem_platform_dependencies
123
149
  create_platform_specific_gems
124
150
  end
125
151
  end
@@ -1,5 +1,4 @@
1
1
  if @build_ips
2
- require 'erb'
3
2
  namespace :package do
4
3
  namespace :ips do
5
4
  workdir = "pkg/ips/workdir"
@@ -7,7 +6,7 @@ if @build_ips
7
6
  repo = workdir + '/repo'
8
7
  pkgs = 'pkg/ips/pkgs'
9
8
  repouri = 'file://' + Dir.pwd + '/' + repo
10
- artifact = pkgs + "/#{@build.project}@#{@build.ipsversion}.p5p"
9
+ artifact = pkgs + "/#{Pkg::Config.project}@#{Pkg::Config.ipsversion}.p5p"
11
10
 
12
11
  # Create a source repo
13
12
  # We dont clean the base pkg directory only ips work dir.
@@ -21,40 +20,40 @@ if @build_ips
21
20
 
22
21
  # Create an installation image at ips/proto
23
22
  task :prepare do
24
- mkdir_pr workdir, pkgs
23
+ FileUtils.mkdir_p([workdir, pkgs])
25
24
  sh "gmake -f ext/ips/rules DESTDIR=#{proto} 2>#{workdir}/build.out"
26
25
  end
27
26
 
28
27
  # Process templates and write the initial manifest
29
28
  task :prototmpl do
30
- erb("ext/ips/#{@build.project}.p5m.erb", workdir + '/' + @build.project + '.p5m.x')
29
+ Pkg::Util::File.erb_file("ext/ips/#{Pkg::Config.project}.p5m.erb", workdir + '/' + Pkg::Config.project + '.p5m.x', nil, :binding => Pkg::Config.get_binding)
31
30
  end
32
31
 
33
32
  # Update manifest to include the installation image information.
34
33
  task :protogen => :prototmpl do
35
- sh "pkgsend generate #{proto} >> #{workdir}/#{@build.project}.p5m.x"
34
+ sh "pkgsend generate #{proto} >> #{workdir}/#{Pkg::Config.project}.p5m.x"
36
35
  end
37
36
 
38
37
  # Generate and resolve dependency list
39
38
  task :protodeps => :protogen do
40
- sh "pkgdepend generate -d #{proto} #{workdir}/#{@build.project}.p5m.x > #{workdir}/#{@build.project}.depends"
41
- sh "pkgdepend resolve -m #{workdir}/#{@build.project}.depends"
42
- sh "cat #{workdir}/#{@build.project}.depends.res >> #{workdir}/#{@build.project}.p5m.x"
39
+ sh "pkgdepend generate -d #{proto} #{workdir}/#{Pkg::Config.project}.p5m.x > #{workdir}/#{Pkg::Config.project}.depends"
40
+ sh "pkgdepend resolve -m #{workdir}/#{Pkg::Config.project}.depends"
41
+ sh "cat #{workdir}/#{Pkg::Config.project}.depends.res >> #{workdir}/#{Pkg::Config.project}.p5m.x"
43
42
  end
44
43
 
45
44
  # Mogrify manifest to remove unncecessary info, and other kinds of transforms.
46
45
  task :protomogrify => :protodeps do
47
- sh "pkgmogrify ./ext/ips/transforms ./#{workdir}/#{@build.project}.p5m.x| pkgfmt >> #{workdir}/#{@build.project}.p5m"
46
+ sh "pkgmogrify ./ext/ips/transforms ./#{workdir}/#{Pkg::Config.project}.p5m.x| pkgfmt >> #{workdir}/#{Pkg::Config.project}.p5m"
48
47
  end
49
48
 
50
49
  # Generate and resolve dependency list
51
50
  task :license => :protomogrify do
52
- cp 'LICENSE', "#{proto}/#{@build.project}.license"
51
+ cp 'LICENSE', "#{proto}/#{Pkg::Config.project}.license"
53
52
  end
54
53
 
55
54
  # Ensure that our manifest is sane.
56
55
  task :lint => :license do
57
- print %x{pkglint #{workdir}/#{@build.project}.p5m}
56
+ print %x{pkglint #{workdir}/#{Pkg::Config.project}.p5m}
58
57
  end
59
58
 
60
59
  task :package => [:clean_pkgs, :clean, :prepare, :lint] do
@@ -63,35 +62,35 @@ if @build_ips
63
62
 
64
63
  # Create a local file-based IPS repository
65
64
  task :createrepo do
66
- check_tool('pkgrepo')
65
+ Pkg::Util::Tool.check_tool('pkgrepo')
67
66
  sh "pkgrepo create #{repo}"
68
67
  sh "pkgrepo set -s #{repo} publisher/prefix=puppetlabs.com"
69
68
  end
70
69
 
71
70
  # Send a created package to the local IPS repository
72
71
  task :send do
73
- check_tool('pkgsend')
74
- sh "pkgsend -s #{repouri} publish -d #{proto} --fmri-in-manifest #{workdir}/#{@build.project}.p5m"
72
+ Pkg::Util::Tool.check_tool('pkgsend')
73
+ sh "pkgsend -s #{repouri} publish -d #{proto} --fmri-in-manifest #{workdir}/#{Pkg::Config.project}.p5m"
75
74
  end
76
75
 
77
76
  # Retrieve the package from the remote repository in .p5p archive format
78
77
  task :receive do
79
- check_tool('pkgrecv')
80
- sh "pkgrecv -s #{repouri} -a -d #{artifact} #{@build.project}@#{@build.ipsversion}"
78
+ Pkg::Util::Tool.check_tool('pkgrecv')
79
+ sh "pkgrecv -s #{repouri} -a -d #{artifact} #{Pkg::Config.project}@#{Pkg::Config.ipsversion}"
81
80
  end
82
81
 
83
82
 
84
83
  task :dry_install do
85
- sh "pkg install -nv -g #{artifact} #{@build.project}@#{@build.ipsversion}"
84
+ sh "pkg install -nv -g #{artifact} #{Pkg::Config.project}@#{Pkg::Config.ipsversion}"
86
85
  end
87
86
 
88
87
  task :p5p, :sign_ips do |t, args|
89
88
  # make sure our system dependencies are met
90
- check_tool('pkg')
91
- check_tool('pkgdepend')
92
- check_tool('pkgsend')
93
- check_tool('pkglint')
94
- check_tool('pkgmogrify')
89
+ Pkg::Util::Tool.check_tool('pkg')
90
+ Pkg::Util::Tool.check_tool('pkgdepend')
91
+ Pkg::Util::Tool.check_tool('pkgsend')
92
+ Pkg::Util::Tool.check_tool('pkglint')
93
+ Pkg::Util::Tool.check_tool('pkgmogrify')
95
94
  sign_ips = args.sign_ips
96
95
  # create the package manifest & files (the "package")
97
96
  Rake::Task['package:ips:package'].invoke
@@ -100,7 +99,7 @@ if @build_ips
100
99
  # publish the package to the repository
101
100
  Rake::Task['package:ips:send'].invoke
102
101
  # signing the package occurs remotely in the repository
103
- Rake::Task['pl:sign_ips'].invoke(repouri,"#{@build.project}@#{@build.ipsversion}") if sign_ips
102
+ Rake::Task['pl:sign_ips'].invoke(repouri,"#{Pkg::Config.project}@#{Pkg::Config.ipsversion}") if sign_ips
104
103
  # retrieve the signed package in a .p5p archive file format
105
104
  Rake::Task['package:ips:receive'].invoke
106
105
  # clean up the workdir area
@@ -91,25 +91,25 @@ namespace :pl do
91
91
  #
92
92
  task :post_build, :build_task do |t, args|
93
93
  # Check for a dirty tree before allowing a remote build that is doomed to unexpected results
94
- fail_on_dirty_source
94
+ Pkg::Util::Version.fail_on_dirty_source
95
95
 
96
96
  # We use JSON for parsing the json part of the submission to JSON
97
- require_library_or_fail 'json'
97
+ Pkg::Util.require_library_or_fail 'json'
98
98
 
99
99
  build_task = args.build_task
100
100
  ##
101
- # We set @:task of @build manually with our task data so the remote
101
+ # We set @:task of Pkg::Config manually with our task data so the remote
102
102
  # build knows what to do. Puppetdb needs early knowledge of if this is
103
103
  # a PE build, so we always this along as an environment variable task
104
104
  # argument if its the case.
105
105
  #
106
- @build.task = { :task => "#{build_task}", :args => nil }
107
- @build.task[:args] = ["PE_BUILD=true"] if @build_pe
106
+ Pkg::Config.task = { :task => "#{build_task}", :args => nil }
107
+ Pkg::Config.task[:args] = ["PE_BUILD=true"] if @build_pe
108
108
  #
109
109
  # Determine the type of build we're doing to inform jenkins
110
110
  build_type = case build_task
111
111
  when /deb/
112
- if @build.default_cow.split('-')[1] =~ /cumulus/
112
+ if Pkg::Config.default_cow.split('-')[1] =~ /cumulus/
113
113
  "cumulus"
114
114
  else
115
115
  "deb"
@@ -123,12 +123,12 @@ namespace :pl do
123
123
 
124
124
  # Create a string of metrics to send to Jenkins for data analysis
125
125
  dist = case build_type
126
- when /deb/ then @build.default_cow.split('-')[1]
126
+ when /deb/ then Pkg::Config.default_cow.split('-')[1]
127
127
  when /rpm/
128
- if @build.pe_version
129
- @build.final_mocks.split(' ')[0].split('-')[2]
128
+ if Pkg::Config.pe_version
129
+ Pkg::Config.final_mocks.split(' ')[0].split('-')[2]
130
130
  else
131
- @build.final_mocks.split(' ')[0].split('-')[1..2].join("")
131
+ Pkg::Config.final_mocks.split(' ')[0].split('-')[1..2].join("")
132
132
  end
133
133
  when /dmg/ then "apple"
134
134
  when /gem/ then "gem"
@@ -137,20 +137,20 @@ namespace :pl do
137
137
  else raise "Could not determine build type for #{build_task}"
138
138
  end
139
139
 
140
- if @build.pe_version
141
- metrics = "#{ENV['USER']}~#{@build.version}~#{@build.pe_version}~#{dist}~#{@build.team}"
140
+ if Pkg::Config.pe_version
141
+ metrics = "#{ENV['USER']}~#{Pkg::Config.version}~#{Pkg::Config.pe_version}~#{dist}~#{Pkg::Config.team}"
142
142
  else
143
- metrics = "#{ENV['USER']}~#{@build.version}~N/A~#{dist}~#{@build.team}"
143
+ metrics = "#{ENV['USER']}~#{Pkg::Config.version}~N/A~#{dist}~#{Pkg::Config.team}"
144
144
  end
145
145
  #
146
146
  # Create the data files to send to jenkins
147
- properties = @build.params_to_yaml
147
+ properties = Pkg::Config.config_to_yaml
148
148
  bundle = git_bundle('HEAD')
149
149
 
150
150
  # Construct the parameters, which is an array of hashes we turn into JSON
151
151
  parameters = [{ "name" => "BUILD_PROPERTIES", "file" => "file0" },
152
152
  { "name" => "PROJECT_BUNDLE", "file" => "file1" },
153
- { "name" => "PROJECT", "value" => "#{@build.project}" },
153
+ { "name" => "PROJECT", "value" => "#{Pkg::Config.project}" },
154
154
  { "name" => "BUILD_TYPE", "label" => "#{build_type}" },
155
155
  { "name" => "METRICS", "value" => "#{metrics}"}]
156
156
 
@@ -175,7 +175,7 @@ namespace :pl do
175
175
  args << [
176
176
  "-Fname=BUILD_PROPERTIES", "-Ffile0=@#{properties}",
177
177
  "-Fname=PROJECT_BUNDLE" , "-Ffile1=@#{bundle}",
178
- "-Fname=PROJECT" , "-Fvalue=#{@build.project}",
178
+ "-Fname=PROJECT" , "-Fvalue=#{Pkg::Config.project}",
179
179
  "-Fname=BUILD_TYPE" , "-Fvalue=#{build_type}",
180
180
  "-Fname=METRICS" , "-Fvalue=#{metrics}",
181
181
  "-FSubmit=Build",
@@ -187,7 +187,7 @@ namespace :pl do
187
187
 
188
188
  # Construct the job url
189
189
  #
190
- job_url = "#{@build.jenkins_build_host}/job/#{@build.jenkins_packaging_job}"
190
+ job_url = "#{Pkg::Config.jenkins_build_host}/job/#{Pkg::Config.jenkins_packaging_job}"
191
191
  trigger_url = "#{job_url}/build"
192
192
 
193
193
  # Call out to the curl_form_data utility method in 00_utils.rake
@@ -195,7 +195,7 @@ namespace :pl do
195
195
  begin
196
196
  if curl_form_data(trigger_url, args)
197
197
  puts "Build submitted. To view your build results, go to #{job_url}"
198
- puts "Your packages will be available at #{@build.distribution_server}:#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}"
198
+ puts "Your packages will be available at #{Pkg::Config.distribution_server}:#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}"
199
199
  else
200
200
  fail "An error occurred submitting the job to jenkins. Take a look at the preceding http response for more info."
201
201
  end
@@ -213,8 +213,8 @@ end
213
213
  # tasks. We can assume deb, mock, but not gem/dmg.
214
214
  #
215
215
  tasks = ["deb", "mock", "tar"]
216
- tasks << "gem" if @build.build_gem and ! @build.build_pe
217
- tasks << "dmg" if @build.build_dmg and ! @build.build_pe
216
+ tasks << "gem" if Pkg::Config.build_gem and ! Pkg::Config.build_pe
217
+ tasks << "dmg" if Pkg::Config.build_dmg and ! Pkg::Config.build_pe
218
218
 
219
219
  namespace :pl do
220
220
  namespace :jenkins do
@@ -231,8 +231,8 @@ namespace :pl do
231
231
  # DOSing it with our packaging.
232
232
  desc "Queue pl:deb_all on jenkins builder"
233
233
  task :deb_all => "pl:fetch" do
234
- @build.cows.split(' ').each do |cow|
235
- @build.default_cow = cow
234
+ Pkg::Config.cows.split(' ').each do |cow|
235
+ Pkg::Config.default_cow = cow
236
236
  invoke_task("pl:jenkins:post_build", "pl:deb")
237
237
  sleep 5
238
238
  end
@@ -241,8 +241,8 @@ namespace :pl do
241
241
  # This does the mocks in parallel
242
242
  desc "Queue pl:mock_all on jenkins builder"
243
243
  task :mock_all => "pl:fetch" do
244
- @build.final_mocks.split(' ').each do |mock|
245
- @build.default_mock = mock
244
+ Pkg::Config.final_mocks.split(' ').each do |mock|
245
+ Pkg::Config.default_mock = mock
246
246
  invoke_task("pl:jenkins:post_build", "pl:mock")
247
247
  sleep 5
248
248
  end
@@ -260,13 +260,13 @@ end
260
260
  ##
261
261
  # If this is a PE project, we want PE tasks as well.
262
262
  #
263
- if @build.build_pe
263
+ if Pkg::Config.build_pe
264
264
  namespace :pe do
265
265
  namespace :jenkins do
266
266
  tasks.each do |build_task|
267
267
  desc "Queue pe:#{build_task} build on jenkins builder"
268
268
  task build_task => "pl:fetch" do
269
- check_var("PE_VER", @build.pe_version)
269
+ check_var("PE_VER", Pkg::Config.pe_version)
270
270
  invoke_task("pl:jenkins:post_build", "pe:#{build_task}")
271
271
  end
272
272
  end
@@ -277,9 +277,9 @@ if @build.build_pe
277
277
  # DOSing it with our packaging.
278
278
  desc "Queue pe:deb_all on jenkins builder"
279
279
  task :deb_all => "pl:fetch" do
280
- check_var("PE_VER", @build.pe_version)
281
- @build.cows.split(' ').each do |cow|
282
- @build.default_cow = cow
280
+ check_var("PE_VER", Pkg::Config.pe_version)
281
+ Pkg::Config.cows.split(' ').each do |cow|
282
+ Pkg::Config.default_cow = cow
283
283
  invoke_task("pl:jenkins:post_build", "pe:deb")
284
284
  sleep 5
285
285
  end
@@ -288,8 +288,8 @@ if @build.build_pe
288
288
  # This does the mocks in parallel
289
289
  desc "Queue pe:mock_all on jenkins builder"
290
290
  task :mock_all => "pl:fetch" do
291
- @build.final_mocks.split(' ').each do |mock|
292
- @build.default_mock = mock
291
+ Pkg::Config.final_mocks.split(' ').each do |mock|
292
+ Pkg::Config.default_mock = mock
293
293
  invoke_task("pl:jenkins:post_build", "pe:mock")
294
294
  sleep 5
295
295
  end
@@ -297,7 +297,7 @@ if @build.build_pe
297
297
 
298
298
  desc "Retrieve PE packages built by jenkins, sign, and ship all!"
299
299
  task :uber_ship => "pl:fetch" do
300
- check_var("PE_VER", @build.pe_version)
300
+ check_var("PE_VER", Pkg::Config.pe_version)
301
301
  ["pl:jenkins:retrieve", "pl:jenkins:sign_all", "pe:ship_rpms", "pe:ship_debs"].each do |task|
302
302
  Rake::Task[task].invoke
303
303
  end
@@ -340,11 +340,11 @@ namespace :pl do
340
340
  end
341
341
 
342
342
  # Assemble the JSON string for the JSON parameter
343
- json = JSON.generate("parameter" => [{ "name" => "SHA", "value" => "#{@build.ref}" }])
343
+ json = JSON.generate("parameter" => [{ "name" => "SHA", "value" => "#{Pkg::Config.ref}" }])
344
344
 
345
345
  # Assemble our arguments to the post
346
346
  args = [
347
- "-Fname=SHA", "-Fvalue=#{@build.ref}",
347
+ "-Fname=SHA", "-Fvalue=#{Pkg::Config.ref}",
348
348
  "-Fjson=#{json.to_json}",
349
349
  "-FSubmit=Build"
350
350
  ]