puppet 2.7.20 → 2.7.21

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 (81) hide show
  1. data/CHANGELOG +226 -0
  2. data/conf/auth.conf +3 -3
  3. data/ext/packaging/README.md +191 -57
  4. data/ext/packaging/spec/spec_helper.rb +2 -2
  5. data/ext/packaging/spec/tasks/00_utils_spec.rb +63 -18
  6. data/ext/packaging/spec/tasks/build_object_spec.rb +171 -0
  7. data/ext/packaging/tasks/00_utils.rake +186 -33
  8. data/ext/packaging/tasks/10_setupvars.rake +94 -65
  9. data/ext/packaging/tasks/20_setupextravars.rake +45 -26
  10. data/ext/packaging/tasks/30_metrics.rake +41 -0
  11. data/ext/packaging/tasks/apple.rake +92 -36
  12. data/ext/packaging/tasks/build.rake +183 -0
  13. data/ext/packaging/tasks/deb.rake +45 -40
  14. data/ext/packaging/tasks/deb_repos.rake +103 -0
  15. data/ext/packaging/tasks/doc.rake +5 -5
  16. data/ext/packaging/tasks/fetch.rake +35 -10
  17. data/ext/packaging/tasks/gem.rake +38 -27
  18. data/ext/packaging/tasks/ips.rake +14 -14
  19. data/ext/packaging/tasks/jenkins.rake +337 -0
  20. data/ext/packaging/tasks/mock.rake +153 -72
  21. data/ext/packaging/tasks/pe_deb.rake +2 -2
  22. data/ext/packaging/tasks/pe_remote.rake +22 -19
  23. data/ext/packaging/tasks/pe_rpm.rake +5 -5
  24. data/ext/packaging/tasks/pe_ship.rake +31 -21
  25. data/ext/packaging/tasks/pe_sign.rake +20 -19
  26. data/ext/packaging/tasks/pe_sles.rake +40 -36
  27. data/ext/packaging/tasks/pe_tar.rake +5 -0
  28. data/ext/packaging/tasks/release.rake +32 -12
  29. data/ext/packaging/tasks/remote_build.rake +141 -83
  30. data/ext/packaging/tasks/retrieve.rake +23 -0
  31. data/ext/packaging/tasks/rpm.rake +11 -19
  32. data/ext/packaging/tasks/rpm_repos.rake +127 -0
  33. data/ext/packaging/tasks/ship.rake +68 -55
  34. data/ext/packaging/tasks/sign.rake +38 -10
  35. data/ext/packaging/tasks/tar.rake +25 -9
  36. data/ext/packaging/tasks/update.rake +2 -2
  37. data/ext/packaging/tasks/version.rake +34 -14
  38. data/ext/packaging/tasks/z_data_dump.rake +33 -0
  39. data/lib/puppet/indirector/catalog/compiler.rb +13 -2
  40. data/lib/puppet/indirector/certificate_status/file.rb +5 -0
  41. data/lib/puppet/indirector/errors.rb +5 -0
  42. data/lib/puppet/indirector/file_bucket_file/file.rb +4 -0
  43. data/lib/puppet/indirector/file_bucket_file/selector.rb +4 -0
  44. data/lib/puppet/indirector/indirection.rb +1 -0
  45. data/lib/puppet/indirector/resource/active_record.rb +3 -0
  46. data/lib/puppet/indirector/resource/ral.rb +4 -0
  47. data/lib/puppet/indirector/resource/store_configs.rb +3 -0
  48. data/lib/puppet/indirector/resource/validator.rb +8 -0
  49. data/lib/puppet/indirector/rest.rb +8 -0
  50. data/lib/puppet/indirector/run/local.rb +4 -0
  51. data/lib/puppet/indirector/terminus.rb +20 -0
  52. data/lib/puppet/network/formats.rb +3 -3
  53. data/lib/puppet/network/handler/master.rb +1 -1
  54. data/lib/puppet/network/handler/report.rb +1 -1
  55. data/lib/puppet/network/http/handler.rb +7 -1
  56. data/lib/puppet/network/http/rack/rest.rb +7 -2
  57. data/lib/puppet/network/http/webrick.rb +1 -0
  58. data/lib/puppet/network/rest_authconfig.rb +1 -1
  59. data/lib/puppet/parser/templatewrapper.rb +17 -17
  60. data/lib/puppet/util/monkey_patches.rb +58 -0
  61. data/lib/puppet/version.rb +1 -1
  62. data/spec/integration/indirector/catalog/compiler_spec.rb +1 -0
  63. data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
  64. data/spec/integration/resource/catalog_spec.rb +1 -0
  65. data/spec/unit/indirector/catalog/compiler_spec.rb +29 -2
  66. data/spec/unit/indirector/indirection_spec.rb +18 -1
  67. data/spec/unit/indirector/terminus_spec.rb +191 -177
  68. data/spec/unit/network/formats_spec.rb +6 -6
  69. data/spec/unit/network/http/handler_spec.rb +25 -0
  70. data/spec/unit/network/http/rack/rest_spec.rb +17 -0
  71. data/spec/unit/network/http/webrick_spec.rb +4 -0
  72. data/spec/unit/network/http_pool_spec.rb +0 -1
  73. data/spec/unit/network/rest_authconfig_spec.rb +16 -1
  74. data/spec/unit/parser/functions/inline_template_spec.rb +13 -0
  75. data/spec/unit/parser/functions/template_spec.rb +15 -0
  76. data/spec/unit/parser/templatewrapper_spec.rb +19 -4
  77. data/spec/unit/ssl/certificate_request_spec.rb +2 -0
  78. data/spec/unit/ssl/host_spec.rb +1 -0
  79. data/spec/unit/util/monkey_patches_spec.rb +12 -0
  80. data/test/language/snippets.rb +1 -1
  81. metadata +13 -2
@@ -11,7 +11,7 @@
11
11
  # pkg/<dist>/<version>/{products,devel,dependencies}/<arch>/*.rpm
12
12
  # e.g.,
13
13
  # pkg/el/5/products/i386/*.rpm
14
- # pkg/fedora/f15/products/i386/*.rpm
14
+ # pkg/fedora/f16/products/i386/*.rpm
15
15
  #
16
16
  # For PE, the directory structure is flatter:
17
17
  # pkg/<dist>-<version>-<arch>/*.rpm
@@ -19,8 +19,29 @@
19
19
  # pkg/el-5-i386/*.rpm
20
20
 
21
21
  def mock(mock_config, srpm)
22
- check_tool('mock')
23
- sh "mock -r #{mock_config} #{srpm}"
22
+ unless mock = find_tool('mock')
23
+ warn "mock is required for building rpms with mock. Please install mock and try again."
24
+ exit 1
25
+ end
26
+ if @build.random_mockroot
27
+ basedir = get_temp
28
+ chown("#{ENV['USER']}", "mock", basedir)
29
+ # Mock requires the sticky bit be set on the basedir
30
+ chmod(02775, basedir)
31
+ mockfile = File.join('/', 'etc', 'mock', "#{mock_config}.cfg")
32
+ puts "Setting mock basedir to #{basedir}"
33
+ config = mock_with_basedir(mockfile, basedir)
34
+ configdir = setup_mock_config_dir(config)
35
+ # Clean up the new mock config
36
+ rm_r File.dirname(config)
37
+ configdir_arg = " --configdir #{configdir}"
38
+ mock << configdir_arg
39
+ end
40
+ sh "#{mock} -r #{mock_config} #{srpm}"
41
+ # Clean up the configdir
42
+ rm_r configdir
43
+
44
+ basedir
24
45
  end
25
46
 
26
47
  def srpm_file
@@ -30,116 +51,176 @@ def srpm_file
30
51
  end
31
52
 
32
53
  def mock_el_family(mock_config)
33
- if @build_pe
54
+ if @build.build_pe
34
55
  family = mock_config.split('-')[2][/[a-z]+/]
35
56
  else
36
- family = mock_config.split('-')[0]
37
- family = 'el' if family == 'pl'
57
+ first, second = mock_config.split('-')
58
+ if (first == 'el' || first == 'fedora')
59
+ family = first
60
+ elsif first == 'pl'
61
+ if second.match(/^\d+$/)
62
+ family = 'el'
63
+ else
64
+ family = second
65
+ end
66
+ end
38
67
  end
39
68
  family
40
69
  end
41
70
 
42
71
  def mock_el_ver(mock_config)
43
- if @build_pe
72
+ if @build.build_pe
44
73
  version = mock_config.split('-')[2][/[0-9]+/]
45
74
  else
46
- version = mock_config.split('-')[1]
47
- version = "f#{version}" if mock_config.split('-')[0] == 'fedora'
75
+ first, second, third = mock_config.split('-')
76
+ if (first == 'el' || first == 'fedora') || (first == 'pl' && second.match(/^\d+$/))
77
+ version = second
78
+ else
79
+ version = third
80
+ end
81
+ end
82
+ if [first,second].include?('fedora')
83
+ version = "f#{version}"
48
84
  end
49
85
  version
50
86
  end
51
87
 
52
88
  def mock_arch(mock_config)
53
- if @build_pe
89
+ if @build.build_pe
54
90
  arch = mock_config.split('-')[3]
55
91
  else
56
92
  arch = mock_config.split('-')[2]
57
93
  end
58
94
  end
59
95
 
60
- def build_rpm_with_mock(mocks, is_rc, subdir)
96
+ def build_rpm_with_mock(mocks, is_rc)
61
97
  mocks.split(' ').each do |mock_config|
62
98
  family = mock_el_family(mock_config)
63
99
  version = mock_el_ver(mock_config)
64
100
  arch = mock_arch(mock_config)
65
- result = "/var/lib/mock/#{mock_config}/result/*.rpm"
101
+ subdir = is_rc ? 'devel' : 'products'
102
+ bench = Benchmark.realtime do
103
+ resultdir = mock(mock_config, srpm_file)
104
+ result = "#{resultdir}/#{mock_config}/result/*.rpm"
66
105
 
67
- mock(mock_config, srpm_file)
68
-
69
- Dir[result].each do |rpm|
70
- rpm.strip!
71
- unless ENV['RC_OVERRIDE'] == '1'
72
- if is_rc == FALSE and rpm =~ /[0-9]+rc[0-9]+\./
73
- puts "It looks like you might be trying to ship an RC to the production repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
74
- next
75
- elsif is_rc and rpm !~ /[0-9]+rc[0-9]+\./
76
- puts "It looks like you might be trying to ship a production release to the development repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
77
- next
106
+ Dir[result].each do |rpm|
107
+ rpm.strip!
108
+ unless ENV['RC_OVERRIDE'] == '1'
109
+ if is_rc == FALSE and rpm =~ /[0-9]+rc[0-9]+\./
110
+ puts "It looks like you might be trying to ship an RC to the production repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
111
+ next
112
+ elsif is_rc and rpm !~ /[0-9]+rc[0-9]+\./
113
+ puts "It looks like you might be trying to ship a production release to the development repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
114
+ next
115
+ end
78
116
  end
79
- end
80
117
 
81
- if @build_pe
82
- case File.basename(rpm)
83
- when /debuginfo/
84
- rm_rf(rpm)
85
- when /src\.rpm/
86
- cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-srpms")
87
- when /i.?86/
88
- cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
89
- when /x66_64/
90
- cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-x86_64")
91
- when /noarch/
92
- cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
93
- ln("pkg/pe/rpm/#{family}-#{version}-i386/#{File.basename(rpm)}", "pkg/pe/rpm/#{family}-#{version}-x86_64/")
118
+ if @build.build_pe
119
+ %x{mkdir -p pkg/pe/rpm/#{family}-#{version}-{srpms,i386,x86_64}}
120
+ case File.basename(rpm)
121
+ when /debuginfo/
122
+ rm_rf(rpm)
123
+ when /src\.rpm/
124
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-srpms")
125
+ when /i.?86/
126
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
127
+ when /x66_64/
128
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-x86_64")
129
+ when /noarch/
130
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
131
+ ln("pkg/pe/rpm/#{family}-#{version}-i386/#{File.basename(rpm)}", "pkg/pe/rpm/#{family}-#{version}-x86_64/")
132
+ end
133
+ else
134
+ %x{mkdir -p pkg/#{family}/#{version}/#{subdir}/{SRPMS,i386,x86_64}}
135
+ case File.basename(rpm)
136
+ when /debuginfo/
137
+ rm_rf(rpm)
138
+ when /src\.rpm/
139
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/SRPMS")
140
+ when /i.?86/
141
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
142
+ when /x86_64/
143
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/x86_64")
144
+ when /noarch/
145
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
146
+ ln("pkg/#{family}/#{version}/#{subdir}/i386/#{File.basename(rpm)}", "pkg/#{family}/#{version}/#{subdir}/x86_64/")
147
+ end
94
148
  end
95
- else
96
- case File.basename(rpm)
97
- when /debuginfo/
98
- rm_rf(rpm)
99
- when /src\.rpm/
100
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/SRPMS")
101
- when /i.?86/
102
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
103
- when /x86_64/
104
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/x86_64")
105
- when /noarch/
106
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
107
- ln("pkg/#{family}/#{version}/#{subdir}/i386/#{File.basename(rpm)}", "pkg/#{family}/#{version}/#{subdir}/x86_64/")
149
+ end
150
+ # To avoid filling up the system with our random mockroots, we should
151
+ # clean up. However, this requires sudo. If we don't have sudo, we'll
152
+ # just fail and not clean up, but warn the user about it.
153
+ if @build.random_mockroot
154
+ %x{sudo -n echo 'Cleaning build root.'}
155
+ if $?.success?
156
+ sh "sudo -n rm -r #{resultdir}" unless resultdir.nil?
157
+ else
158
+ warn "Couldn't clean #{resultdir} without sudo. Leaving."
108
159
  end
109
160
  end
110
161
  end
162
+ add_metrics({ :dist => "#{family}-#{version}", :bench => bench }) if @build.benchmark
111
163
  end
112
164
  end
113
165
 
166
+ # With the advent of using Jenkins to parallelize builds, it becomes critical
167
+ # that we be able to use the same mock at the same time for > 1 builds without
168
+ # clobbering the mock root every time. Here we add a method that takes the full
169
+ # path to a mock configuration and a path, and adds a base directory
170
+ # configuration directive to the mock to use the path as the directory for the
171
+ # mock build root. The new mock config is written to a temporary space, and its
172
+ # location is returned. This allows us to create mock configs with randomized
173
+ # temporary mock roots.
174
+ #
175
+ def mock_with_basedir(mock, basedir)
176
+ config = IO.readlines(mock)
177
+ basedir = "config_opts['basedir'] = '#{basedir}'"
178
+ config.unshift(basedir)
179
+ tempdir = get_temp
180
+ newmock = File.join(tempdir, File.basename(mock))
181
+ File.open(newmock, 'w') { |f| f.puts config }
182
+ newmock
183
+ end
184
+
185
+ # Mock accepts an alternate configuration directory to /etc/mock for mock
186
+ # configs, but the directory has to include both site-defaults.cfg and
187
+ # logging.ini. This is a simple utility method to set a mock configuration dir
188
+ # by copying a mock and the required defaults to a temporary directory and
189
+ # returning that directory. This method takes the full path to a mock
190
+ # configuration file and returns the path to the new configuration dir.
191
+ #
192
+ def setup_mock_config_dir(mock)
193
+ tempdir = get_temp
194
+ cp File.join('/', 'etc', 'mock', 'site-defaults.cfg'), tempdir
195
+ cp File.join('/', 'etc', 'mock', 'logging.ini'), tempdir
196
+ cp mock, tempdir
197
+ tempdir
198
+ end
114
199
 
115
200
  namespace :pl do
116
- task :setup_el_dirs do
117
- if @build_pe
118
- %x{mkdir -p pkg/pe/rpm/sles-11-{i586,x86_64,srpms}}
119
- %x{mkdir -p pkg/pe/rpm/el-{5,6}-{i386,x86_64,srpms}}
120
- else
121
- %x{mkdir -p pkg/el/{5,6}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
122
- %x{mkdir -p pkg/fedora/{f15,f16,f17}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
123
- end
201
+ desc "Use default mock to make a final rpm, keyed to PL infrastructure, pass MOCK to specify config"
202
+ task :mock => "package:srpm" do
203
+ # If default mock isn't specified, just take the first one in the @build.final_mocks list
204
+ @build.default_mock ||= @build.final_mocks.split(' ')[0]
205
+ build_rpm_with_mock(@build.default_mock, is_rc?)
206
+ post_metrics if @build.benchmark
124
207
  end
125
208
 
126
- desc "Use default mock to make a final rpm, keyed to PL infrastructure, pass MOCK to specify config"
127
- task :mock => [ "package:srpm", "pl:setup_el_dirs" ] do
128
- # If default mock isn't specified, just take the first one in the @final_mocks list
129
- @default_mock ||= @final_mocks.split(' ')[0]
130
- subdir = ENV['subdir'] || 'products'
131
- build_rpm_with_mock(@default_mock, FALSE, subdir)
209
+ task :mock_final => "package:srpm" do
210
+ deprecate("pl:mock_final", "pl:mock_all")
211
+ build_rpm_with_mock(@build.final_mocks, FALSE)
212
+ post_metrics if @build.benchmark
132
213
  end
133
214
 
134
- desc "Use specified mocks to make final rpms, keyed to PL infrastructure, pass MOCK to specifiy config"
135
- task :mock_final => [ "package:srpm", "pl:setup_el_dirs" ] do
136
- subdir = ENV['subdir'] || 'products'
137
- build_rpm_with_mock(@final_mocks, FALSE, subdir)
215
+ task :mock_rc => "package:srpm" do
216
+ deprecate("pl:mock_rc", "pl:mock_all")
217
+ build_rpm_with_mock(@build.rc_mocks, TRUE)
218
+ post_metrics if @build.benchmark
138
219
  end
139
220
 
140
- desc "Use specified mocks to make RC rpms, keyed to PL infrastructure, pass MOCK to specify config"
141
- task :mock_rc => [ "package:srpm", "pl:setup_el_dirs" ] do
142
- subdir = 'devel'
143
- build_rpm_with_mock(@rc_mocks, TRUE, subdir)
221
+ desc "Use specified mocks to make rpms, keyed to PL infrastructure, pass MOCK to specifiy config"
222
+ task :mock_all => "package:srpm" do
223
+ build_rpm_with_mock(@build.final_mocks, is_rc?)
224
+ post_metrics if @build.benchmark
144
225
  end
145
226
  end
@@ -3,9 +3,9 @@
3
3
  # e.g., pe:local_deb is the task to build a deb on the local host,
4
4
  # while pe:deb is the task for building on the remote builder host
5
5
 
6
- if @build_pe
6
+ if @build.build_pe
7
7
  namespace :pe do
8
- desc "Create a PE deb from this repo using the default cow #{@default_cow}."
8
+ desc "Create a PE deb from this repo using the default cow #{@build.default_cow}."
9
9
  task :local_deb => "pl:deb"
10
10
 
11
11
  desc "Create PE debs from this git repository using all cows specified in build_defaults yaml"
@@ -3,44 +3,47 @@
3
3
  # e.g., pe:local_deb is the task to build a deb on the local host,
4
4
  # while pe:deb is the task for building on the remote builder host
5
5
 
6
- if @build_pe
6
+ if @build.build_pe
7
7
  namespace :pe do
8
8
  desc "Execute remote debian build using default cow on builder and retrieve package"
9
- task :deb => ['pl:fetch', 'pl:load_extras'] do
10
- ENV['PE_VER'] ||= @pe_version
9
+ task :deb => 'pl:fetch' do
10
+ ENV['PE_VER'] ||= @build.pe_version
11
11
  check_var('PE_VER', ENV['PE_VER'])
12
- Rake::Task["pl:remote_build"].reenable
13
- Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pe:local_deb PE_VER=#{ENV['PE_VER']}")
12
+ Rake::Task["pl:remote:build"].reenable
13
+ Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pe:local_deb PE_BUILD=#{@build.build_pe} TEAM=#{@build.team} PE_VER=#{ENV['PE_VER']}")
14
14
  end
15
15
 
16
16
  desc "Execute remote debian build using ALL cows on builder and retrieve packages"
17
- task :deb_all => ['pl:fetch', 'pl:load_extras'] do
18
- ENV['PE_VER'] ||= @pe_version
17
+ task :deb_all => 'pl:fetch' do
18
+ ENV['PE_VER'] ||= @build.pe_version
19
19
  check_var('PE_VER', ENV['PE_VER'])
20
- Rake::Task["pl:remote_build"].reenable
21
- Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pe:local_deb_all PE_VER=#{ENV['PE_VER']}")
20
+ Rake::Task["pl:remote:build"].reenable
21
+ Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pe:local_deb_all PE_BUILD=#{@build.build_pe} COW='#{@build.cows}' TEAM=#{@build.team} PE_VER=#{ENV['PE_VER']}")
22
22
  end
23
23
 
24
24
  desc "Execute remote rpm build using default mock on builder and retrieve package"
25
- task :mock => ['pl:fetch', 'pl:load_extras'] do
26
- Rake::Task["pl:remote_build"].reenable
27
- Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pe:local_mock TEAM=#{@team}")
25
+ task :mock => 'pl:fetch' do
26
+ ENV['PE_VER'] ||= @build.pe_version
27
+ Rake::Task["pl:remote:build"].reenable
28
+ Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pe:local_mock PE_BUILD=#{@build.build_pe} TEAM=#{@build.team} PE_VER=#{ENV['PE_VER']}")
28
29
  end
29
30
 
30
31
  desc "Execute remote rpm build with ALL mocks on builder and retrieve packages"
31
- task :mock_all => ['pl:fetch', 'pl:load_extras'] do
32
- Rake::Task["pl:remote_build"].reenable
33
- Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pe:local_mock_final TEAM=#{@team}")
32
+ task :mock_all => 'pl:fetch' do
33
+ ENV['PE_VER'] ||= @build.pe_version
34
+ Rake::Task["pl:remote:build"].reenable
35
+ Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pe:local_mock_all PE_BUILD=#{@build.build_pe} MOCK='#{@build.final_mocks}' TEAM=#{@build.team} PE_VER=#{ENV['PE_VER']}")
34
36
  end
35
37
 
36
38
  desc "Execute remote sles rpm build and retrieve package"
37
- task :sles => ['pl:fetch', 'pl:load_extras'] do
38
- Rake::Task["pl:remote_build"].reenable
39
- Rake::Task["pl:remote_build"].invoke(@sles_build_host, 'HEAD', "pe:local_sles TEAM=#{@team}")
39
+ task :sles => 'pl:fetch' do
40
+ ENV['PE_VER'] ||= @build.pe_version
41
+ Rake::Task["pl:remote:build"].reenable
42
+ Rake::Task["pl:remote:build"].invoke(@build.sles_build_host, 'HEAD', "pe:local_sles PE_BUILD=#{@build.build_pe} TEAM=#{@build.team} PE_VER=#{ENV['PE_VER']}")
40
43
  end
41
44
 
42
45
  desc "Execute remote debian, el, and sles builds, sign, and ship pkgs"
43
- task :all => ['clean', 'pl:fetch', 'pl:load_extras'] do
46
+ task :all => ['clean', 'pl:fetch'] do
44
47
  ['pe:deb', 'pe:mock_all', 'pe:sles', 'pe:ship_rpms', 'pe:ship_debs'].each do |task|
45
48
  Rake::Task[task].execute
46
49
  end
@@ -1,18 +1,18 @@
1
- if @build_pe
1
+ if @build.build_pe
2
2
  namespace :pe do
3
3
  desc "Build a PE rpm using rpmbuild (requires all BuildRequires, rpmbuild, etc)"
4
4
  task :local_rpm => "package:rpm"
5
5
 
6
6
  desc "Build rpms using ALL final mocks in build_defaults yaml, keyed to PL infrastructure, pass MOCK to override"
7
- task :local_mock_final => ["pl:fetch", "pl:load_extras", "pl:mock_final"] do
8
- if @team == 'release'
7
+ task :local_mock_all => ["pl:fetch", "pl:mock_all"] do
8
+ if @build.team == 'release'
9
9
  Rake::Task["pe:sign_rpms"].invoke
10
10
  end
11
11
  end
12
12
 
13
13
  desc "Build a PE rpm using the default mock"
14
- task :local_mock => ["pl:fetch", "pl:load_extras", "pl:mock" ] do
15
- if @team == 'release'
14
+ task :local_mock => ["pl:fetch", "pl:mock"] do
15
+ if @build.team == 'release'
16
16
  Rake::Task["pe:sign_rpms"].invoke
17
17
  end
18
18
  end
@@ -1,37 +1,47 @@
1
- if @build_pe
1
+ if @build.build_pe
2
2
  namespace :pe do
3
- desc "ship PE rpms to #{@yum_host}"
4
- task :ship_rpms => ["pl:load_extras"] do
3
+ desc "ship PE rpms to #{@build.yum_host}"
4
+ task :ship_rpms => "pl:fetch" do
5
5
  if empty_dir?("pkg/pe/rpm")
6
6
  STDERR.puts "The 'pkg/pe/rpm' directory has no packages. Did you run rake pe:deb?"
7
+ exit 1
7
8
  else
8
- rsync_to('pkg/pe/rpm/', @yum_host, "#{@yum_repo_path}/#{@pe_version}/repos/")
9
- Rake::Task["pe:remote_update_yum_repo"].invoke
9
+ target_path = ENV['YUM_REPO'] ? ENV['YUM_REPO'] : "#{@build.yum_repo_path}/#{@build.pe_version}/repos/"
10
+ rsync_to('pkg/pe/rpm/', @build.yum_host, target_path)
11
+ if @build.team == 'release'
12
+ Rake::Task["pe:remote:update_yum_repo"].invoke
13
+ end
10
14
  end
11
15
  end
12
16
 
13
- desc "Update remote rpm repodata for PE on #{@yum_host}"
14
- task :remote_update_yum_repo => "pl:load_extras" do
15
- remote_ssh_cmd(@yum_host, "for dir in $(find #{@apt_repo_path}/#{@pe_version}/repos/el* -type d | grep -v repodata | grep -v cache | xargs) ; do pushd $dir; sudo rm -rf repodata; createrepo -q -d .; popd &> /dev/null ; done; sync")
16
- end
17
-
18
- desc "Ship PE debs to #{@apt_host}"
19
- task :ship_debs => "pl:load_extras" do
20
- dist = @default_cow.split('-')[1]
17
+ desc "Ship PE debs to #{@build.apt_host}"
18
+ task :ship_debs => "pl:fetch" do
19
+ dist = @build.default_cow.split('-')[1]
21
20
  if empty_dir?("pkg/pe/deb/#{dist}")
22
21
  STDERR.puts "The 'pkg/pe/deb/#{dist}' directory has no packages. Did you run rake pe:deb?"
22
+ exit 1
23
23
  else
24
- rsync_to("pkg/pe/deb/#{dist}/", @apt_host, "#{@apt_repo_path}/#{@pe_version}/repos/incoming/unified/")
25
- Rake::Task["pe:remote_freight"].invoke
24
+ target_path = ENV['APT_REPO'] ? ENV['APT_REPO'] : "#{@build.apt_repo_path}/#{@build.pe_version}/repos/incoming/unified/"
25
+ rsync_to("pkg/pe/deb/#{dist}/", @build.apt_host, target_path)
26
+ if @build.team == 'release'
27
+ Rake::Task["pe:remote:freight"].invoke
28
+ end
26
29
  end
27
30
  end
28
31
 
29
- # This is particularly hacky. The 'pe-the-things' script resides on the @apt_host and takes packages placed
30
- # in the directory/structure shown in the rsync target of pe:ship_debs and adds them to the remote PE
31
- # freight repository and updates the apt repo metadata
32
- desc "remote freight PE packages to #{@apt_host}"
33
- task :remote_freight => "pl:load_extras" do
34
- remote_ssh_cmd(@apt_host, "sudo pe-the-things #{@pe_version} #{@apt_repo_path} #{@freight_conf}")
32
+ namespace :remote do
33
+ desc "Update remote rpm repodata for PE on #{@build.yum_host}"
34
+ task :update_yum_repo => "pl:fetch" do
35
+ remote_ssh_cmd(@build.yum_host, "for dir in $(find #{@build.apt_repo_path}/#{@build.pe_version}/repos/el* -type d | grep -v repodata | grep -v cache | xargs) ; do pushd $dir; sudo rm -rf repodata; createrepo -q -d .; popd &> /dev/null ; done; sync")
36
+ end
37
+
38
+ # This is particularly hacky. The 'pe-the-things' script resides on the @build.apt_host and takes packages placed
39
+ # in the directory/structure shown in the rsync target of pe:ship_debs and adds them to the remote PE
40
+ # freight repository and updates the apt repo metadata
41
+ desc "remote freight PE packages to #{@build.apt_host}"
42
+ task :freight => "pl:fetch" do
43
+ remote_ssh_cmd(@build.apt_host, "sudo pe-the-things #{@build.pe_version} #{@build.apt_repo_path} #{@build.freight_conf}")
44
+ end
35
45
  end
36
46
  end
37
47
  end