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
  # The sign_legacy_rpm and sign_rpm methods are defined in sign.rake
2
2
  # This is just adapted for the 'PE' layout
3
3
 
4
- if @build.build_pe
4
+ if Pkg::Config.build_pe
5
5
  namespace :pe do
6
6
  desc "Sign all staged in rpms in pkg"
7
7
  task :sign_rpms do
@@ -10,14 +10,14 @@ if @build.build_pe
10
10
  # Find x86_64 noarch rpms that have been created as hard links and remove them
11
11
  rm_r Dir["pkg/pe/rpm/*-*-x86_64/*.noarch.rpm"]
12
12
  # We'll sign the remaining noarch
13
- sign_dists = 'el5', 'el6', 'sles11'
13
+ sign_dists = 'el4', 'el5', 'el6', 'el7', 'sles11'
14
14
  ['i386', 'x86_64'].each do |arch|
15
15
  sign_dists.each do |dist|
16
16
  family=dist[/[a-z]+/]
17
17
  version=dist[/[0-9]+/]
18
18
  rpm_stagedir = "pkg/pe/rpm/#{family}-#{version}-#{arch}/*.rpm"
19
19
  srpm_stagedir = "pkg/pe/rpm/#{family}-#{version}-srpms/*.rpm"
20
- if family == 'el' and version == '6'
20
+ if family == 'el' and version >= '6'
21
21
  modern_rpms += FileList[rpm_stagedir] + FileList[srpm_stagedir]
22
22
  else
23
23
  old_rpms += FileList[rpm_stagedir] + FileList[srpm_stagedir]
@@ -31,7 +31,7 @@ if @build.build_pe
31
31
  dir = rpm.split('/')[-2]
32
32
  family, version, _arch = dir.split('-')
33
33
  cd File.dirname(rpm) do
34
- ln File.basename(rpm), File.join('..', "#{family}-#{version}-x86_64")
34
+ FileUtils.ln(File.basename(rpm), File.join('..', "#{family}-#{version}-x86_64"), :force => true, :verbose => true)
35
35
  end
36
36
  end
37
37
  end
@@ -40,7 +40,7 @@ if @build.build_pe
40
40
  # this is a separate task we can pull out later.
41
41
  desc "Sign all debian changes files staged in pkg/pe"
42
42
  task :sign_deb_changes do
43
- load_keychain if has_tool('keychain')
43
+ load_keychain if Pkg::Util::Tool.find_tool('keychain')
44
44
  sign_deb_changes("pkg/pe/deb/*/*.changes") unless Dir["pkg/pe/deb/*/*.changes"].empty?
45
45
  end
46
46
  end
@@ -6,11 +6,11 @@ namespace :pl do
6
6
  if confirm_ship(FileList["pkg/*.gem"])
7
7
  invoke_task("pl:ship_gem")
8
8
  end
9
- end if @build.build_gem
9
+ end if Pkg::Config.build_gem
10
10
 
11
11
  task :release_deb_rc do
12
12
  deprecate("pl:release_deb_rc", "pl:release_deb")
13
- load_keychain if has_tool('keychain')
13
+ load_keychain if Pkg::Util::Tool.find_tool('keychain')
14
14
  invoke_task("pl:deb_all_rc")
15
15
  invoke_task("pl:sign_deb_changes")
16
16
  if confirm_ship(FileList["pkg/deb/**/*"])
@@ -20,7 +20,7 @@ namespace :pl do
20
20
 
21
21
  task :release_deb_final do
22
22
  deprecate("pl:release_deb_final", "pl:release_deb")
23
- load_keychain if has_tool('keychain')
23
+ load_keychain if Pkg::Util::Tool.find_tool('keychain')
24
24
  invoke_task("pl:deb_all")
25
25
  invoke_task("pl:sign_deb_changes")
26
26
  if confirm_ship(FileList["pkg/deb/**/*"])
@@ -29,7 +29,7 @@ namespace :pl do
29
29
  end
30
30
 
31
31
  task :release_deb do
32
- load_keychain if has_tool('keychain')
32
+ load_keychain if Pkg::Util::Tool.find_tool('keychain')
33
33
  invoke_task("pl:deb_all")
34
34
  invoke_task("pl:sign_deb_changes")
35
35
  if confirm_ship(FileList["pkg/deb/**/*"])
@@ -80,7 +80,7 @@ namespace :pl do
80
80
  if confirm_ship(FileList["pkg/apple/*.dmg"])
81
81
  Rake::Task["pl:ship_dmg"].execute
82
82
  end
83
- end if @build.build_dmg
83
+ end if Pkg::Config.build_dmg
84
84
 
85
85
  task :release_ips => 'pl:fetch' do
86
86
  Rake::Task['pl:ips'].invoke
@@ -4,13 +4,13 @@ if File.exist?("#{ENV['HOME']}/.packaging")
4
4
  namespace 'pl' do
5
5
  namespace :remote do
6
6
  task :build, :host, :treeish, :task, :tar do |t, args|
7
- fail_on_dirty_source
7
+ Pkg::Util::Version.fail_on_dirty_source
8
8
  host = args.host
9
9
  treeish = args.treeish
10
10
  task = args.task
11
11
  tar = args.tar
12
12
  remote_repo = remote_bootstrap(host, treeish, tar)
13
- build_params = remote_buildparams(host, @build)
13
+ build_params = remote_buildparams(host, Pkg::Config)
14
14
  STDOUT.puts "Beginning package build on #{host}"
15
15
  remote_ssh_cmd(host, "cd #{remote_repo} ; rake #{task} PARAMS_FILE=#{build_params} ANSWER_OVERRIDE=no PGUSER=#{ENV['PGUSER']} PGDATABASE=#{ENV['PGDATABASE']} PGHOST=#{ENV['PGHOST']}")
16
16
  rsync_from("#{remote_repo}/pkg/", host, 'pkg/')
@@ -22,107 +22,107 @@ if File.exist?("#{ENV['HOME']}/.packaging")
22
22
  task :remote_deb_rc => 'pl:fetch' do
23
23
  deprecate("pl:remote_deb_rc", "pl:remote:release_deb")
24
24
  Rake::Task["pl:remote:build"].reenable
25
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:release_deb_rc")
25
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:release_deb_rc")
26
26
  end
27
27
 
28
28
  task :remote_deb_rc_build => 'pl:fetch' do
29
29
  deprecate("pl:remote_deb_rc_build", "pl:remote:deb_all")
30
30
  Rake::Task["pl:remote:build"].reenable
31
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb_all_rc")
31
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:deb_all_rc")
32
32
  end
33
33
 
34
34
  task :remote_deb_final => 'pl:fetch' do
35
35
  deprecate("pl:remote_deb_final", "pl:remote:release_deb")
36
36
  Rake::Task["pl:remote:build"].reenable
37
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:release_deb_final")
37
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:release_deb_final")
38
38
  end
39
39
 
40
40
  task :remote_deb_final_build => 'pl:fetch' do
41
41
  deprecate("pl:remote_deb_final_build", "pl:remote:deb_all")
42
42
  Rake::Task["pl:remote:build"].reenable
43
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb_all")
43
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:deb_all")
44
44
  end
45
45
 
46
46
  task :deb => 'pl:fetch' do
47
47
  Rake::Task["pl:remote:build"].reenable
48
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb")
48
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:deb")
49
49
  end
50
50
 
51
51
  task :deb_all => 'pl:fetch' do
52
52
  Rake::Task["pl:remote:build"].reenable
53
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb_all")
53
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:deb_all")
54
54
  end
55
55
 
56
56
  task :release_deb => 'pl:fetch' do
57
57
  Rake::Task["pl:remote:build"].reenable
58
- Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:release_deb")
58
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.deb_build_host, 'HEAD', "pl:release_deb")
59
59
  end
60
60
 
61
61
  task :remote_rpm_rc => 'pl:fetch' do
62
62
  deprecate("pl:remote_rpm_rc", "pl:remote:release_rpm")
63
63
  Rake::Task["pl:remote:build"].reenable
64
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:release_rpm_rc")
64
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:release_rpm_rc")
65
65
  end
66
66
 
67
67
  task :remote_rpm_rc_build => 'pl:fetch' do
68
68
  deprecate("pl:remote_rpm_rc_build", "pl:remote:mock_all")
69
69
  Rake::Task["pl:remote:build"].reenable
70
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock_rc")
70
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:mock_rc")
71
71
  end
72
72
 
73
73
  task :remote_rpm_final => 'pl:fetch' do
74
74
  deprecate("pl:remote_rpm_final", "pl:remote:release_rpm")
75
75
  Rake::Task["pl:remote:build"].reenable
76
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:release_rpm_final")
76
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:release_rpm_final")
77
77
  end
78
78
 
79
79
  task :release_rpm => 'pl:fetch' do
80
80
  Rake::Task["pl:remote:build"].reenable
81
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:release_rpm")
81
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:release_rpm")
82
82
  end
83
83
 
84
84
  task :remote_mock_final => 'pl:fetch' do
85
85
  deprecate("pl:remote_mock_final", "pl:remote:mock_all")
86
86
  Rake::Task["pl:remote:build"].reenable
87
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock_final")
87
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:mock_final")
88
88
  end
89
89
 
90
90
  task :mock => 'pl:fetch' do
91
91
  Rake::Task["pl:remote:build"].reenable
92
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock")
92
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:mock")
93
93
  end
94
94
 
95
95
  task :mock_all => 'pl:fetch' do
96
96
  Rake::Task["pl:remote:build"].reenable
97
- Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock_all")
97
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.rpm_build_host, 'HEAD', "pl:mock_all")
98
98
  end
99
99
 
100
100
  task :ips => 'pl:fetch' do
101
101
  Rake::Task["pl:remote:build"].reenable
102
- Rake::Task["pl:remote:build"].invoke(@build.ips_build_host, 'HEAD', 'pl:ips', 'gtar')
103
- end if @build.build_ips
102
+ Rake::Task["pl:remote:build"].invoke(Pkg::Config.ips_build_host, 'HEAD', 'pl:ips', 'gtar')
103
+ end if Pkg::Config.build_ips
104
104
 
105
105
  task :dmg => 'pl:fetch' do
106
106
  # Because we use rvmsudo for apple, we end up replicating the :remote_build task
107
- host = @build.osx_build_host
107
+ host = Pkg::Config.osx_build_host
108
108
  treeish = 'HEAD'
109
109
  task = "package:apple"
110
110
  remote_repo = remote_bootstrap(host, treeish)
111
- build_params = remote_buildparams(host, @build)
111
+ build_params = remote_buildparams(host, Pkg::Config)
112
112
  puts "Beginning package build on #{host}"
113
113
  remote_ssh_cmd(host, "cd #{remote_repo} ; rvmsudo rake #{task} PARAMS_FILE=#{build_params} PGUSER=#{ENV['PGUSER']} PGDATABASE=#{ENV['PGDATABASE']} PGHOST=#{ENV['PGHOST']}")
114
114
  rsync_from("#{remote_repo}/pkg/apple", host, 'pkg/')
115
115
  remote_ssh_cmd(host, "sudo rm -rf #{remote_repo}")
116
116
  STDOUT.puts "packages from #{host} staged in pkg/ directory"
117
- end if @build.build_dmg
117
+ end if Pkg::Config.build_dmg
118
118
  end # remote namespace
119
119
 
120
120
  task :uber_rc do
121
121
  deprecate("pl:uber_rc", "pl:uber_release")
122
- Rake::Task["package:gem"].invoke if @build.build_gem
122
+ Rake::Task["package:gem"].invoke if Pkg::Config.build_gem
123
123
  Rake::Task["pl:remote_deb_rc"].invoke
124
124
  Rake::Task["pl:remote_rpm_rc"].execute
125
- Rake::Task["pl:remote:dmg"].execute if @build.build_dmg
125
+ Rake::Task["pl:remote:dmg"].execute if Pkg::Config.build_dmg
126
126
  Rake::Task["package:tar"].execute
127
127
  Rake::Task["pl:sign_tar"].invoke
128
128
  Rake::Task["pl:uber_ship"].execute
@@ -132,10 +132,10 @@ if File.exist?("#{ENV['HOME']}/.packaging")
132
132
 
133
133
  task :uber_final do
134
134
  deprecate("pl:uber_final", "pl:uber_release")
135
- Rake::Task["package:gem"].invoke if @build.build_gem
135
+ Rake::Task["package:gem"].invoke if Pkg::Config.build_gem
136
136
  Rake::Task["pl:remote_deb_final"].invoke
137
137
  Rake::Task["pl:remote_rpm_final"].execute
138
- Rake::Task["pl:remote:dmg"].execute if @build.build_dmg
138
+ Rake::Task["pl:remote:dmg"].execute if Pkg::Config.build_dmg
139
139
  Rake::Task["package:tar"].execute
140
140
  Rake::Task["pl:sign_tar"].invoke
141
141
  Rake::Task["pl:uber_ship"].execute
@@ -144,10 +144,10 @@ if File.exist?("#{ENV['HOME']}/.packaging")
144
144
  end
145
145
 
146
146
  task :uber_release do
147
- Rake::Task["package:gem"].invoke if @build.build_gem
147
+ Rake::Task["package:gem"].invoke if Pkg::Config.build_gem
148
148
  Rake::Task["pl:remote:release_deb"].invoke
149
149
  Rake::Task["pl:remote:release_rpm"].execute
150
- Rake::Task["pl:remote:dmg"].execute if @build.build_dmg
150
+ Rake::Task["pl:remote:dmg"].execute if Pkg::Config.build_dmg
151
151
  Rake::Task["package:tar"].execute
152
152
  Rake::Task["pl:sign_tar"].invoke
153
153
  Rake::Task["pl:uber_ship"].execute
@@ -16,13 +16,13 @@ namespace :pl do
16
16
  target = args.target || "artifacts"
17
17
  invoke_task("pl:fetch")
18
18
  mkdir_p 'pkg'
19
- package_url = "http://#{@build.builds_server}/#{@build.project}/#{@build.ref}/#{target}"
20
- if wget=find_tool("wget")
19
+ package_url = "http://#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}/#{target}"
20
+ if wget=Pkg::Util::Tool.find_tool("wget")
21
21
  sh "#{wget} -r -np -nH --cut-dirs 3 -P pkg --reject 'index*' #{package_url}/"
22
22
  else
23
- warn "Could not find `wget` tool. Falling back to rsyncing from #{@build.distribution_server}"
23
+ warn "Could not find `wget` tool. Falling back to rsyncing from #{Pkg::Config.distribution_server}"
24
24
  begin
25
- rsync_from("#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}/", @build.distribution_server, "pkg/")
25
+ rsync_from("#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/#{target}/", Pkg::Config.distribution_server, "pkg/")
26
26
  rescue
27
27
  fail "Couldn't download packages from distribution server. Try installing wget!"
28
28
  end
@@ -32,7 +32,7 @@ namespace :pl do
32
32
  end
33
33
  end
34
34
 
35
- if @build.build_pe
35
+ if Pkg::Config.build_pe
36
36
  namespace :pe do
37
37
  namespace :jenkins do
38
38
  desc "Retrieve packages from the distribution server\. Check out commit to retrieve"
@@ -1,15 +1,32 @@
1
1
  def prep_rpm_build_dir
2
- temp = get_temp
3
- mkdir_pr temp, "#{temp}/SOURCES", "#{temp}/SPECS"
4
- cp_pr FileList["pkg/#{@build.project}-#{@build.version}.tar.gz*"], "#{temp}/SOURCES"
5
- erb "ext/redhat/#{@build.project}.spec.erb", "#{temp}/SPECS/#{@build.project}.spec"
2
+ temp = Pkg::Util::File.mktemp
3
+ tarball = "#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz"
4
+ FileUtils.mkdir_p([temp, "#{temp}/SOURCES", "#{temp}/SPECS"])
5
+ cp_pr FileList["pkg/#{tarball}*"], "#{temp}/SOURCES"
6
+ # If the file ext/redhat/<project>.spec exists in the tarball, we use it. If
7
+ # it doesn't we try to 'erb' the file from a predicted template in source,
8
+ # ext/redhat/<project>.spec.erb. If that doesn't exist, we fail. To do this,
9
+ # we have to open the tarball.
10
+ cp_p("pkg/#{tarball}", temp)
11
+
12
+ # Test for specfile in tarball
13
+ %x{tar -tzf #{File.join(temp, tarball)}}.split.grep(/ext\/redhat\/#{Pkg::Config.project}.spec$/)
14
+
15
+ if $?.success?
16
+ sh "tar -C #{temp} -xzf #{File.join(temp, tarball)} #{Pkg::Config.project}-#{Pkg::Config.version}/ext/redhat/#{Pkg::Config.project}.spec"
17
+ cp("#{temp}/#{Pkg::Config.project}-#{Pkg::Config.version}/ext/redhat/#{Pkg::Config.project}.spec", "#{temp}/SPECS/")
18
+ elsif File.exists?("ext/redhat/#{Pkg::Config.project}.spec.erb")
19
+ Pkg::Util::File.erb_file("ext/redhat/#{Pkg::Config.project}.spec.erb", "#{temp}/SPECS/#{Pkg::Config.project}.spec", nil, :binding => Pkg::Config.get_binding)
20
+ else
21
+ fail "Could not locate redhat spec ext/redhat/#{Pkg::Config.project}.spec or ext/redhat/#{Pkg::Config.project}.spec.erb"
22
+ end
6
23
  temp
7
24
  end
8
25
 
9
26
  def build_rpm(buildarg = "-bs")
10
- check_tool('rpmbuild')
27
+ Pkg::Util::Tool.check_tool('rpmbuild')
11
28
  workdir = prep_rpm_build_dir
12
- if dist = el_version
29
+ if dist = Pkg::Util::Version.el_version
13
30
  if dist.to_i < 6
14
31
  dist_string = "--define \"%dist .el#{dist}"
15
32
  end
@@ -19,14 +36,14 @@ def build_rpm(buildarg = "-bs")
19
36
  --define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
20
37
  --define "_default_patch_fuzz 2"'
21
38
  args = rpm_define + ' ' + rpm_old_version
22
- mkdir_pr 'pkg/srpm'
39
+ FileUtils.mkdir_p('pkg/srpm')
23
40
  if buildarg == '-ba'
24
- mkdir_p 'pkg/rpm'
41
+ FileUtils.mkdir_p('pkg/rpm')
25
42
  end
26
- if @build.sign_tar
43
+ if Pkg::Config.sign_tar
27
44
  Rake::Task["pl:sign_tar"].invoke
28
45
  end
29
- sh "rpmbuild #{args} #{buildarg} --nodeps #{workdir}/SPECS/#{@build.project}.spec"
46
+ sh "rpmbuild #{args} #{buildarg} --nodeps #{workdir}/SPECS/#{Pkg::Config.project}.spec"
30
47
  mv FileList["#{workdir}/SRPMS/*.rpm"], "pkg/srpm"
31
48
  if buildarg == '-ba'
32
49
  mv FileList["#{workdir}/RPMS/*/*.rpm"], "pkg/rpm"
@@ -17,7 +17,7 @@ namespace :pl do
17
17
  # Formulate our command string, which will just find directories with rpms
18
18
  # and create and update repositories.
19
19
  #
20
- artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
20
+ artifact_directory = File.join(Pkg::Config.jenkins_repo_path, Pkg::Config.project, Pkg::Config.ref)
21
21
 
22
22
  ##
23
23
  # Test that the artifacts directory exists on the distribution server.
@@ -37,10 +37,11 @@ namespace :pl do
37
37
  cmd << "rsync -avxl artifacts/ repos/ ; pushd repos ; "
38
38
  cmd << "createrepo=$(which createrepo) ; "
39
39
  cmd << 'for repodir in $(find ./ -name "*.rpm" | xargs -I {} dirname {}) ; do '
40
- cmd << "pushd $repodir && $createrepo -d --update . && popd ; "
40
+ cmd << "[ -d ${repodir} ] || continue; "
41
+ cmd << "pushd ${repodir} && ${createrepo} --checksum=sha --database --update . ; popd ; "
41
42
  cmd << "done ; popd "
42
43
 
43
- remote_ssh_cmd(@build.distribution_server, cmd)
44
+ remote_ssh_cmd(Pkg::Config.distribution_server, cmd)
44
45
  # Now that we've created our repositories, we can create the configs for
45
46
  # them
46
47
  Rake::Task["pl:jenkins:generate_rpm_repo_configs"].execute
@@ -49,7 +50,7 @@ namespace :pl do
49
50
  Rake::Task["pl:jenkins:ship_repo_configs"].execute
50
51
  ensure
51
52
  # Always remove the lock file, even if we've failed
52
- remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
53
+ remote_ssh_cmd(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/.lock")
53
54
  end
54
55
  end
55
56
 
@@ -66,12 +67,12 @@ namespace :pl do
66
67
  # We have a hard requirement on wget because of all the download magicks
67
68
  # we have to do
68
69
  #
69
- wget = find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the yum repo configurations. Install `wget` and try again."
70
+ wget = Pkg::Util::Tool.find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the yum repo configurations. Install `wget` and try again."
70
71
 
71
72
  # This is the standard path to all build artifacts on the distribution
72
73
  # server for this commit
73
74
  #
74
- base_url = "http://#{@build.builds_server}/#{@build.project}/#{@build.ref}/repos/"
75
+ base_url = "http://#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repos/"
75
76
 
76
77
  # First check if the artifacts directory exists
77
78
  #
@@ -109,25 +110,25 @@ namespace :pl do
109
110
 
110
111
  # Create an array of lines that will become our yum config
111
112
  #
112
- config = ["[pl-#{@build.project}-#{@build.ref}]"]
113
- config << ["name=PL Repo for #{@build.project} at commit #{@build.ref}"]
113
+ config = ["[pl-#{Pkg::Config.project}-#{Pkg::Config.ref}]"]
114
+ config << ["name=PL Repo for #{Pkg::Config.project} at commit #{Pkg::Config.ref}"]
114
115
  config << ["baseurl=#{url}"]
115
116
  config << ["enabled=1"]
116
117
  config << ["gpgcheck=0"]
117
118
 
118
119
  # Write the new config to a file under our repo configs dir
119
120
  #
120
- config_file = File.join("pkg", "repo_configs", "rpm", "pl-#{@build.project}-#{@build.ref}-#{dist}-#{version}-#{arch}.repo")
121
+ config_file = File.join("pkg", "repo_configs", "rpm", "pl-#{Pkg::Config.project}-#{Pkg::Config.ref}-#{dist}-#{version}-#{arch}.repo")
121
122
  File.open(config_file, 'w') { |f| f.puts config }
122
123
  end
123
- puts "Wrote yum configuration files for #{@build.project} at #{@build.ref} to pkg/repo_configs/rpm"
124
+ puts "Wrote yum configuration files for #{Pkg::Config.project} at #{Pkg::Config.ref} to pkg/repo_configs/rpm"
124
125
  end
125
126
 
126
127
  desc "Retrieve rpm yum repository configs from distribution server"
127
128
  task :rpm_repo_configs => "pl:fetch" do
128
- wget = find_tool("wget") or fail "Could not find `wget` tool! wget is required to download the repository configs."
129
+ wget = Pkg::Util::Tool.find_tool("wget") or fail "Could not find `wget` tool! wget is required to download the repository configs."
129
130
  mkdir_p "pkg/repo_configs"
130
- config_url = "#{@build.builds_server}/#{@build.project}/#{@build.ref}/repo_configs/rpm/"
131
+ config_url = "#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/rpm/"
131
132
  begin
132
133
  sh "#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{config_url}"
133
134
  rescue
@@ -1,46 +1,46 @@
1
1
  namespace :pl do
2
- desc "Ship mocked rpms to #{@build.yum_host}"
2
+ desc "Ship mocked rpms to #{Pkg::Config.yum_host}"
3
3
  task :ship_rpms do
4
4
  ["el", "fedora"].each do |dist|
5
5
  retry_on_fail(:times => 3) do
6
- pkgs = Dir["pkg/#{dist}/**/*.rpm"].map { |f| "'#{f.gsub("pkg/#{dist}/", "#{@build.yum_repo_path}/#{dist}/")}'"}
6
+ pkgs = Dir["pkg/#{dist}/**/*.rpm"].map { |f| "'#{f.gsub("pkg/#{dist}/", "#{Pkg::Config.yum_repo_path}/#{dist}/")}'"}
7
7
  unless pkgs.empty?
8
- rsync_to("pkg/#{dist}", @build.yum_host, @build.yum_repo_path)
9
- remote_set_immutable(@build.yum_host, pkgs)
8
+ rsync_to("pkg/#{dist}", Pkg::Config.yum_host, Pkg::Config.yum_repo_path)
9
+ remote_set_immutable(Pkg::Config.yum_host, pkgs)
10
10
  end
11
11
  end if File.directory?("pkg/#{dist}")
12
12
  end
13
13
  end
14
14
 
15
15
  namespace :remote do
16
- # These hacky bits execute a pre-existing rake task on the @build.apt_host
16
+ # These hacky bits execute a pre-existing rake task on the Pkg::Config.apt_host
17
17
  # The rake task takes packages in a specific directory and freights them
18
18
  # to various target yum and apt repositories based on their specific type
19
19
  # e.g., final vs devel vs PE vs FOSS packages
20
20
 
21
- desc "Update remote rpm repodata on #{@build.yum_host}"
21
+ desc "Update remote rpm repodata on #{Pkg::Config.yum_host}"
22
22
  task :update_yum_repo do
23
- STDOUT.puts "Really run remote repo update on #{@build.yum_host}? [y,n]"
23
+ STDOUT.puts "Really run remote repo update on #{Pkg::Config.yum_host}? [y,n]"
24
24
  if ask_yes_or_no
25
- remote_ssh_cmd(@build.yum_host, 'rake -f /opt/repository/Rakefile mk_repo')
25
+ remote_ssh_cmd(Pkg::Config.yum_host, 'rake -f /opt/repository/Rakefile mk_repo')
26
26
  end
27
27
  end
28
28
 
29
- desc "remote freight packages to repos on #{@build.apt_host}"
29
+ desc "remote freight packages to repos on #{Pkg::Config.apt_host}"
30
30
  task :freight do
31
- STDOUT.puts "Really run remote freight command on #{@build.apt_host}? [y,n]"
31
+ STDOUT.puts "Really run remote freight command on #{Pkg::Config.apt_host}? [y,n]"
32
32
  if ask_yes_or_no
33
33
  override = "OVERRIDE=1" if ENV['OVERRIDE']
34
- remote_ssh_cmd(@build.apt_host, "rake -f /opt/repository/Rakefile freight #{override}")
34
+ remote_ssh_cmd(Pkg::Config.apt_host, "rake -f /opt/repository/Rakefile freight #{override}")
35
35
  end
36
36
  end
37
37
  end
38
38
 
39
- desc "Ship cow-built debs to #{@build.apt_host}"
39
+ desc "Ship cow-built debs to #{Pkg::Config.apt_host}"
40
40
  task :ship_debs do
41
41
  retry_on_fail(:times => 3) do
42
42
  if File.directory?("pkg/deb")
43
- rsync_to('pkg/deb/', @build.apt_host, @build.apt_repo_path)
43
+ rsync_to('pkg/deb/', Pkg::Config.apt_host, Pkg::Config.apt_repo_path)
44
44
  end
45
45
  end
46
46
  end
@@ -48,32 +48,32 @@ namespace :pl do
48
48
  namespace :remote do
49
49
  end
50
50
 
51
- desc "Update remote ips repository on #{@build.ips_host}"
51
+ desc "Update remote ips repository on #{Pkg::Config.ips_host}"
52
52
  task :update_ips_repo do
53
- rsync_to('pkg/ips/pkgs/', @build.ips_host, @build.ips_store)
54
- remote_ssh_cmd(@build.ips_host, "pkgrecv -s #{@build.ips_store}/pkgs/#{@build.project}@build.#{@build.ipsversion}.p5p -d #{@build.ips_repo} \\*")
55
- remote_ssh_cmd(@build.ips_host, "pkgrepo refresh -s #{@build.ips_repo}")
56
- remote_ssh_cmd(@build.ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
57
- end if @build.build_ips
53
+ rsync_to('pkg/ips/pkgs/', Pkg::Config.ips_host, Pkg::Config.ips_store)
54
+ remote_ssh_cmd(Pkg::Config.ips_host, "pkgrecv -s #{Pkg::Config.ips_store}/pkgs/#{Pkg::Config.project}Pkg::Config.#{Pkg::Config.ipsversion}.p5p -d #{Pkg::Config.ips_repo} \\*")
55
+ remote_ssh_cmd(Pkg::Config.ips_host, "pkgrepo refresh -s #{Pkg::Config.ips_repo}")
56
+ remote_ssh_cmd(Pkg::Config.ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
57
+ end if Pkg::Config.build_ips
58
58
 
59
59
  desc "Upload ips p5p packages to downloads"
60
60
  task :ship_ips => 'pl:fetch' do
61
61
  if Dir['pkg/ips/pkgs/**/*'].empty?
62
62
  STDOUT.puts "There aren't any p5p packages in pkg/ips/pkgs. Maybe something went wrong?"
63
63
  else
64
- rsync_to('pkg/ips/pkgs/', @build.ips_package_host, @build.ips_path)
64
+ rsync_to('pkg/ips/pkgs/', Pkg::Config.ips_package_host, Pkg::Config.ips_path)
65
65
  end
66
- end if @build.build_ips
66
+ end if Pkg::Config.build_ips
67
67
 
68
68
  # We want to ship a gem only for projects that build gems
69
- if @build.build_gem
69
+ if Pkg::Config.build_gem
70
70
  desc "Ship built gem to rubygems"
71
71
  task :ship_gem do
72
- # Even if a project builds a gem, if it uses the odd_even strategy, we only
73
- # want to ship final gems because otherwise a development gem would be
74
- # preferred over the last final gem
75
- if @build.version_strategy != "odd_even" || is_final?
76
- FileList["pkg/#{@build.project}-#{@build.gemversion}*.gem"].each do |f|
72
+ # Even if a project builds a gem, if it uses the odd_even or zero-based
73
+ # strategies, we only want to ship final gems because otherwise a
74
+ # development gem would be preferred over the last final gem
75
+ if Pkg::Config.version_strategy !~ /odd_even|zero_based/ || Pkg::Util::Version.is_final?
76
+ FileList["pkg/#{Pkg::Config.gem_name}-#{Pkg::Config.gemversion}*.gem"].each do |f|
77
77
  puts "Shipping gem #{f} to rubygems"
78
78
  ship_gem(f)
79
79
  end
@@ -83,17 +83,17 @@ namespace :pl do
83
83
  end
84
84
  end
85
85
 
86
- desc "ship apple dmg to #{@build.yum_host}"
86
+ desc "ship apple dmg to #{Pkg::Config.yum_host}"
87
87
  task :ship_dmg => 'pl:fetch' do
88
88
  retry_on_fail(:times => 3) do
89
- rsync_to('pkg/apple/*.dmg', @build.yum_host, @build.dmg_path)
89
+ rsync_to('pkg/apple/*.dmg', Pkg::Config.yum_host, Pkg::Config.dmg_path)
90
90
  end
91
- end if @build.build_dmg
91
+ end if Pkg::Config.build_dmg
92
92
 
93
- desc "ship tarball and signature to #{@build.tar_host}"
93
+ desc "ship tarball and signature to #{Pkg::Config.tar_host}"
94
94
  task :ship_tar => 'pl:fetch' do
95
95
  retry_on_fail(:times => 3) do
96
- rsync_to("pkg/#{@build.project}-#{@build.version}.tar.gz*", @build.tar_host, @build.tarball_path)
96
+ rsync_to("pkg/#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz*", Pkg::Config.tar_host, Pkg::Config.tarball_path)
97
97
  end
98
98
  end
99
99
 
@@ -101,14 +101,14 @@ namespace :pl do
101
101
  task :uber_ship => 'pl:fetch' do
102
102
  if confirm_ship(FileList["pkg/**/*"])
103
103
  ENV['ANSWER_OVERRIDE'] = 'yes'
104
- Rake::Task["pl:ship_gem"].invoke if @build.build_gem
104
+ Rake::Task["pl:ship_gem"].invoke if Pkg::Config.build_gem
105
105
  Rake::Task["pl:ship_rpms"].invoke
106
106
  Rake::Task["pl:ship_debs"].invoke
107
- Rake::Task["pl:ship_dmg"].execute if @build.build_dmg
107
+ Rake::Task["pl:ship_dmg"].execute if Pkg::Config.build_dmg
108
108
  Rake::Task["pl:ship_tar"].execute
109
109
  Rake::Task["pl:jenkins:ship"].invoke("shipped")
110
- add_shipped_metrics(:pe_version => ENV['PE_VER'], :is_rc => (! is_final?)) if @build.benchmark
111
- post_shipped_metrics if @build.benchmark
110
+ add_shipped_metrics(:pe_version => ENV['PE_VER'], :is_rc => (! Pkg::Util::Version.is_final?)) if Pkg::Config.benchmark
111
+ post_shipped_metrics if Pkg::Config.benchmark
112
112
  else
113
113
  puts "Ship canceled"
114
114
  exit
@@ -126,12 +126,12 @@ namespace :pl do
126
126
  task :ship, :target do |t, args|
127
127
  invoke_task("pl:fetch")
128
128
  target = args.target || "artifacts"
129
- artifact_dir = "#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}"
129
+ artifact_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/#{target}"
130
130
 
131
131
  # In order to get a snapshot of what this build looked like at the time
132
132
  # of shipping, we also generate and ship the params file
133
133
  #
134
- @build.params_to_yaml('pkg')
134
+ Pkg::Config.config_to_yaml('pkg')
135
135
 
136
136
 
137
137
  # Sadly, the packaging repo cannot yet act on its own, without living
@@ -141,28 +141,50 @@ namespace :pl do
141
141
  # clone itself.
142
142
  git_bundle('HEAD', 'signing_bundle', 'pkg')
143
143
 
144
+ # While we're bundling things, let's also make a git bundle of the
145
+ # packaging repo that we're using when we invoke pl:jenkins:ship. We can
146
+ # have a reasonable level of confidence, later on, that the git bundle on
147
+ # the distribution server was, in fact, the git bundle used to create the
148
+ # associated packages. This is because this ship task is automatically
149
+ # called upon completion each cell of the pl:jenkins:uber_build, and we
150
+ # have --ignore-existing set below. As such, the only git bundle that
151
+ # should possibly be on the distribution is the one used to create the
152
+ # packages.
153
+ # We're bundling the packaging repo because it allows us to keep an
154
+ # archive of the packaging source that was used to create the packages,
155
+ # so that later on if we need to rebuild an older package to audit it or
156
+ # for some other reason we're assured that the new package isn't
157
+ # different by virtue of the packaging automation.
158
+ if defined?(PACKAGING_ROOT)
159
+ packaging_bundle = ''
160
+ cd PACKAGING_ROOT do
161
+ packaging_bundle = git_bundle('HEAD', 'packaging-bundle')
162
+ end
163
+ mv(packaging_bundle, 'pkg')
164
+ end
165
+
144
166
  retry_on_fail(:times => 3) do
145
- remote_ssh_cmd(@build.distribution_server, "mkdir -p #{artifact_dir}")
167
+ remote_ssh_cmd(Pkg::Config.distribution_server, "mkdir -p #{artifact_dir}")
146
168
  end
147
169
  retry_on_fail(:times => 3) do
148
170
  ignore_existing = "--ignore-existing"
149
- rsync_to("pkg/", @build.distribution_server, "#{artifact_dir}/ #{ignore_existing} --exclude repo_configs")
171
+ rsync_to("pkg/", Pkg::Config.distribution_server, "#{artifact_dir}/ #{ignore_existing} --exclude repo_configs")
150
172
  end
151
173
  # If we just shipped a tagged version, we want to make it immutable
152
174
  files = Dir.glob("pkg/**/*").select { |f| File.file?(f) }.map do |file|
153
175
  "#{artifact_dir}/#{file.sub(/^pkg\//,'')}"
154
176
  end
155
- remote_set_immutable(@build.distribution_server, files)
177
+ remote_set_immutable(Pkg::Config.distribution_server, files)
156
178
  end
157
179
 
158
180
  desc "Ship generated repository configs to the distribution server"
159
181
  task :ship_repo_configs do
160
- empty_dir?("pkg/repo_configs") and fail "No repo configs have been generated! Try pl:deb_repo_configs or pl:rpm_repo_configs"
182
+ Pkg::Util::File.empty_dir?("pkg/repo_configs") and fail "No repo configs have been generated! Try pl:deb_repo_configs or pl:rpm_repo_configs"
161
183
  invoke_task("pl:fetch")
162
- repo_dir = "#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/repo_configs"
163
- remote_ssh_cmd(@build.distribution_server, "mkdir -p #{repo_dir}")
184
+ repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs"
185
+ remote_ssh_cmd(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
164
186
  retry_on_fail(:times => 3) do
165
- rsync_to("pkg/repo_configs/", @build.distribution_server, repo_dir)
187
+ rsync_to("pkg/repo_configs/", Pkg::Config.distribution_server, repo_dir)
166
188
  end
167
189
  end
168
190
  end