puppet 2.7.22 → 2.7.23

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 (55) hide show
  1. data/CHANGELOG +21 -0
  2. data/Rakefile +0 -2
  3. data/ext/build_defaults.yaml +1 -1
  4. data/ext/packaging/README.md +88 -33
  5. data/ext/packaging/packaging.rake +45 -0
  6. data/ext/packaging/spec/tasks/build_object_spec.rb +2 -0
  7. data/ext/packaging/tasks/00_utils.rake +94 -54
  8. data/ext/packaging/tasks/10_setupvars.rake +40 -28
  9. data/ext/packaging/tasks/apple.rake +20 -27
  10. data/ext/packaging/tasks/build.rake +3 -8
  11. data/ext/packaging/tasks/deb.rake +12 -36
  12. data/ext/packaging/tasks/deb_repos.rake +28 -36
  13. data/ext/packaging/tasks/fetch.rake +1 -2
  14. data/ext/packaging/tasks/jenkins.rake +22 -56
  15. data/ext/packaging/tasks/jenkins_dynamic.rake +111 -0
  16. data/ext/packaging/tasks/mock.rake +101 -56
  17. data/ext/packaging/tasks/pe_deb.rake +5 -7
  18. data/ext/packaging/tasks/pe_remote.rake +30 -42
  19. data/ext/packaging/tasks/pe_rpm.rake +3 -11
  20. data/ext/packaging/tasks/pe_ship.rake +14 -18
  21. data/ext/packaging/tasks/pe_sign.rake +11 -0
  22. data/ext/packaging/tasks/pe_tar.rake +1 -1
  23. data/ext/packaging/tasks/release.rake +0 -6
  24. data/ext/packaging/tasks/remote_build.rake +1 -13
  25. data/ext/packaging/tasks/retrieve.rake +1 -1
  26. data/ext/packaging/tasks/rpm.rake +15 -10
  27. data/ext/packaging/tasks/rpm_repos.rake +45 -56
  28. data/ext/packaging/tasks/ship.rake +46 -37
  29. data/ext/packaging/tasks/sign.rake +22 -14
  30. data/ext/packaging/tasks/tar.rake +1 -1
  31. data/ext/packaging/tasks/template.rake +1 -1
  32. data/ext/packaging/templates/README +1 -0
  33. data/ext/packaging/templates/downstream.xml.erb +32 -0
  34. data/ext/packaging/templates/packaging.xml.erb +182 -0
  35. data/ext/packaging/templates/repo.xml.erb +93 -0
  36. data/lib/puppet.rb +2 -0
  37. data/lib/puppet/file_system.rb +3 -0
  38. data/lib/puppet/file_system/path_pattern.rb +97 -0
  39. data/lib/puppet/module.rb +25 -4
  40. data/lib/puppet/module_tool/applications/unpacker.rb +5 -1
  41. data/lib/puppet/parser/files.rb +20 -15
  42. data/lib/puppet/parser/parser_support.rb +10 -1
  43. data/lib/puppet/parser/type_loader.rb +48 -28
  44. data/lib/puppet/version.rb +1 -1
  45. data/spec/unit/file_system/path_pattern_spec.rb +139 -0
  46. data/spec/unit/module_spec.rb +8 -1
  47. data/spec/unit/module_tool/applications/unpacker_spec.rb +6 -0
  48. data/spec/unit/parser/files_spec.rb +6 -67
  49. data/spec/unit/parser/parser_spec.rb +15 -5
  50. data/spec/unit/parser/type_loader_spec.rb +14 -33
  51. data/spec/unit/resource/type_collection_spec.rb +39 -55
  52. metadata +11 -5
  53. data/Gemfile.lock +0 -44
  54. data/ext/packaging/tasks/pe_sles.rake +0 -101
  55. data/ext/packaging/tasks/pre_tasks.rake +0 -0
@@ -2,29 +2,25 @@ if @build.build_pe
2
2
  namespace :pe do
3
3
  desc "ship PE rpms to #{@build.yum_host}"
4
4
  task :ship_rpms => "pl:fetch" do
5
- if empty_dir?("pkg/pe/rpm")
6
- STDERR.puts "The 'pkg/pe/rpm' directory has no packages. Did you run rake pe:deb?"
7
- exit 1
8
- else
9
- target_path = ENV['YUM_REPO'] ? ENV['YUM_REPO'] : "#{@build.yum_repo_path}/#{@build.pe_version}/repos/"
5
+ empty_dir?("pkg/pe/rpm") and fail "The 'pkg/pe/rpm' directory has no packages. Did you run rake pe:deb?"
6
+ target_path = ENV['YUM_REPO'] ? ENV['YUM_REPO'] : "#{@build.yum_repo_path}/#{@build.pe_version}/repos/"
7
+ retry_on_fail(:times => 3) do
10
8
  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
9
+ end
10
+ if @build.team == 'release'
11
+ Rake::Task["pe:remote:update_yum_repo"].invoke
14
12
  end
15
13
  end
16
14
 
17
15
  desc "Ship PE debs to #{@build.apt_host}"
18
16
  task :ship_debs => "pl:fetch" do
19
- if empty_dir?("pkg/pe/deb")
20
- STDERR.puts "The 'pkg/pe/deb' directory has no packages!"
21
- exit 1
22
- else
23
- target_path = ENV['APT_REPO'] ? ENV['APT_REPO'] : "#{@build.apt_repo_path}/#{@build.pe_version}/repos/incoming/disparate/"
17
+ empty_dir?("pkg/pe/deb") and fail "The 'pkg/pe/deb' directory has no packages!"
18
+ target_path = ENV['APT_REPO'] ? ENV['APT_REPO'] : "#{@build.apt_repo_path}/#{@build.pe_version}/repos/incoming/disparate/"
19
+ retry_on_fail(:times => 3) do
24
20
  rsync_to("pkg/pe/deb/", @build.apt_host, target_path)
25
- if @build.team == 'release'
26
- Rake::Task["pe:remote:freight"].invoke
27
- end
21
+ end
22
+ if @build.team == 'release'
23
+ Rake::Task["pe:remote:freight"].invoke
28
24
  end
29
25
  end
30
26
 
@@ -34,12 +30,12 @@ if @build.build_pe
34
30
  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")
35
31
  end
36
32
 
37
- # This is particularly hacky. The 'pe-the-things' script resides on the @build.apt_host and takes packages placed
33
+ # This is hacky. The freight.rb script resides on the @build.apt_host and takes packages placed
38
34
  # in the directory/structure shown in the rsync target of pe:ship_debs and adds them to the remote PE
39
35
  # freight repository and updates the apt repo metadata
40
36
  desc "remote freight PE packages to #{@build.apt_host}"
41
37
  task :freight => "pl:fetch" do
42
- remote_ssh_cmd(@build.apt_host, "sudo pe-the-things #{@build.pe_version} #{@build.apt_repo_path} #{@build.freight_conf}")
38
+ remote_ssh_cmd(@build.apt_host, "ruby /opt/enterprise/bin/freight.rb --version #{@build.pe_version} --basedir #{@build.apt_repo_path} --config /etc/freight.conf.d/#{@build.freight_conf}")
43
39
  end
44
40
  end
45
41
  end
@@ -7,6 +7,9 @@ if @build.build_pe
7
7
  task :sign_rpms do
8
8
  old_rpms = FileList.new
9
9
  modern_rpms = FileList.new
10
+ # Find x86_64 noarch rpms that have been created as hard links and remove them
11
+ rm_r Dir["pkg/pe/rpm/*-*-x86_64/*.noarch.rpm"]
12
+ # We'll sign the remaining noarch
10
13
  sign_dists = 'el5', 'el6', 'sles11'
11
14
  ['i386', 'x86_64'].each do |arch|
12
15
  sign_dists.each do |dist|
@@ -23,6 +26,14 @@ if @build.build_pe
23
26
  end
24
27
  sign_el5(old_rpms) unless old_rpms.empty?
25
28
  sign_modern(modern_rpms) unless modern_rpms.empty?
29
+ # Now we hardlink them back in
30
+ Dir["pkg/pe/rpm/*-*-i386/*.noarch.rpm"].each do |rpm|
31
+ dir = rpm.split('/')[-2]
32
+ family, version, _arch = dir.split('-')
33
+ cd File.dirname(rpm) do
34
+ ln File.basename(rpm), File.join('..', "#{family}-#{version}-x86_64")
35
+ end
36
+ end
26
37
  end
27
38
  # This is essentially a duplicate of the logic in pl:sign_deb_changes, but
28
39
  # since the plan is eventually to rip out the PE work, it'll be easier if
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # An alias from pe:tar to package:tar, for easier automation in jenkins.rake
3
3
  namespace :pe do
4
- task :local_tar => ["package:tar"]
4
+ task :tar => ["package:tar"]
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # These tasks are "release" chains that couple as much of the release process for a package as possible
2
2
 
3
3
  namespace :pl do
4
- desc "Release gem, e.g. package:gem, pl:ship_gem"
5
4
  task :release_gem do
6
5
  invoke_task("package:gem")
7
6
  if confirm_ship(FileList["pkg/*.gem"])
@@ -29,7 +28,6 @@ namespace :pl do
29
28
  end
30
29
  end
31
30
 
32
- desc "Release deb, e.g. package:tar, pl:{deb_all, sign_deb_changes, ship_debs}"
33
31
  task :release_deb do
34
32
  load_keychain if has_tool('keychain')
35
33
  invoke_task("pl:deb_all")
@@ -59,7 +57,6 @@ namespace :pl do
59
57
  end
60
58
  end
61
59
 
62
- desc "Release rpms, e.g. package:tar, pl:{mock_all, sign_rpms, ship_rpms, update_yum_repo}"
63
60
  task :release_rpm do
64
61
  invoke_task("pl:mock_all")
65
62
  invoke_task("pl:sign_rpms")
@@ -70,7 +67,6 @@ namespace :pl do
70
67
  end
71
68
 
72
69
  if File.exist?("#{ENV['HOME']}/.packaging")
73
- desc "Release tarball, e.g. package:tar, pl:{sign_tar, ship_tar}"
74
70
  task :release_tar => 'pl:fetch' do
75
71
  invoke_task("package:tar")
76
72
  invoke_task("pl:sign_tar")
@@ -79,7 +75,6 @@ namespace :pl do
79
75
  end
80
76
  end
81
77
 
82
- desc "Release dmg, e.g. package:apple, pl:ship_dmg"
83
78
  task :release_dmg => 'pl:fetch' do
84
79
  sh "rvmsudo rake package:apple"
85
80
  if confirm_ship(FileList["pkg/apple/*.dmg"])
@@ -87,7 +82,6 @@ namespace :pl do
87
82
  end
88
83
  end if @build.build_dmg
89
84
 
90
- desc "Release ips, e.g. pl:ips, pl:ship_ips"
91
85
  task :release_ips => 'pl:fetch' do
92
86
  Rake::Task['pl:ips'].invoke
93
87
  Rake::Task['pl:ship_ips'].invoke
@@ -4,10 +4,7 @@ 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
- if source_dirty?
8
- warn "The source tree is dirty, e.g. there are uncommited changes. Please commit/discard changes and try again."
9
- exit 1
10
- end
7
+ fail_on_dirty_source
11
8
  host = args.host
12
9
  treeish = args.treeish
13
10
  task = args.task
@@ -46,19 +43,16 @@ if File.exist?("#{ENV['HOME']}/.packaging")
46
43
  Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb_all")
47
44
  end
48
45
 
49
- desc "Execute pl:deb (single default cow deb package) on remote debian build host (no signing)"
50
46
  task :deb => 'pl:fetch' do
51
47
  Rake::Task["pl:remote:build"].reenable
52
48
  Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb")
53
49
  end
54
50
 
55
- desc "Execute pl:deb_all on remote debian build host (no signing)"
56
51
  task :deb_all => 'pl:fetch' do
57
52
  Rake::Task["pl:remote:build"].reenable
58
53
  Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:deb_all")
59
54
  end
60
55
 
61
- desc "Execute remote pl:release_deb_all full build set on remote debian build host"
62
56
  task :release_deb => 'pl:fetch' do
63
57
  Rake::Task["pl:remote:build"].reenable
64
58
  Rake::Task["pl:remote:build"].invoke(@build.deb_build_host, 'HEAD', "pl:release_deb")
@@ -82,7 +76,6 @@ if File.exist?("#{ENV['HOME']}/.packaging")
82
76
  Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:release_rpm_final")
83
77
  end
84
78
 
85
- desc "Execute remote pl:release_rpm full build set on remote rpm build host"
86
79
  task :release_rpm => 'pl:fetch' do
87
80
  Rake::Task["pl:remote:build"].reenable
88
81
  Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:release_rpm")
@@ -94,25 +87,21 @@ if File.exist?("#{ENV['HOME']}/.packaging")
94
87
  Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock_final")
95
88
  end
96
89
 
97
- desc "Execute pl:mock (single default mock package) on remote rpm build host (no signing)"
98
90
  task :mock => 'pl:fetch' do
99
91
  Rake::Task["pl:remote:build"].reenable
100
92
  Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock")
101
93
  end
102
94
 
103
- desc "Execute pl:mock_all on remote rpm build host (no signing)"
104
95
  task :mock_all => 'pl:fetch' do
105
96
  Rake::Task["pl:remote:build"].reenable
106
97
  Rake::Task["pl:remote:build"].invoke(@build.rpm_build_host, 'HEAD', "pl:mock_all")
107
98
  end
108
99
 
109
- desc "Execute pl:ips on remote ips build host"
110
100
  task :ips => 'pl:fetch' do
111
101
  Rake::Task["pl:remote:build"].reenable
112
102
  Rake::Task["pl:remote:build"].invoke(@build.ips_build_host, 'HEAD', 'pl:ips', 'gtar')
113
103
  end if @build.build_ips
114
104
 
115
- desc "Execute package:apple on remote apple build host"
116
105
  task :dmg => 'pl:fetch' do
117
106
  # Because we use rvmsudo for apple, we end up replicating the :remote_build task
118
107
  host = @build.osx_build_host
@@ -154,7 +143,6 @@ if File.exist?("#{ENV['HOME']}/.packaging")
154
143
  Rake::Task["pl:remote:update_yum_repo"].invoke
155
144
  end
156
145
 
157
- desc "UBER build: build, sign and ship tar, gem (as applicable), remote dmg, remote deb, remote rpm"
158
146
  task :uber_release do
159
147
  Rake::Task["package:gem"].invoke if @build.build_gem
160
148
  Rake::Task["pl:remote:release_deb"].invoke
@@ -24,7 +24,7 @@ namespace :pl do
24
24
  begin
25
25
  rsync_from("#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}/", @build.distribution_server, "pkg/")
26
26
  rescue
27
- puts "Couldn't download packages from distribution server. Try installing wget!"
27
+ fail "Couldn't download packages from distribution server. Try installing wget!"
28
28
  end
29
29
  end
30
30
  puts "Packages staged in pkg"
@@ -1,32 +1,37 @@
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"
6
+ temp
7
+ end
8
+
1
9
  def build_rpm(buildarg = "-bs")
2
10
  check_tool('rpmbuild')
3
- temp = get_temp
11
+ workdir = prep_rpm_build_dir
4
12
  if dist = el_version
5
13
  if dist.to_i < 6
6
14
  dist_string = "--define \"%dist .el#{dist}"
7
15
  end
8
16
  end
9
- rpm_define = "#{dist_string} --define \"%_topdir #{temp}\" "
17
+ rpm_define = "#{dist_string} --define \"%_topdir #{workdir}\" "
10
18
  rpm_old_version = '--define "_source_filedigest_algorithm 1" --define "_binary_filedigest_algorithm 1" \
11
19
  --define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
12
20
  --define "_default_patch_fuzz 2"'
13
21
  args = rpm_define + ' ' + rpm_old_version
14
- mkdir_pr temp, 'pkg/srpm', "#{temp}/SOURCES", "#{temp}/SPECS"
22
+ mkdir_pr 'pkg/srpm'
15
23
  if buildarg == '-ba'
16
24
  mkdir_p 'pkg/rpm'
17
25
  end
18
26
  if @build.sign_tar
19
27
  Rake::Task["pl:sign_tar"].invoke
20
- cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz.asc", "#{temp}/SOURCES"
21
28
  end
22
- cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz", "#{temp}/SOURCES"
23
- erb "ext/redhat/#{@build.project}.spec.erb", "#{temp}/SPECS/#{@build.project}.spec"
24
- sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@build.project}.spec"
25
- mv FileList["#{temp}/SRPMS/*.rpm"], "pkg/srpm"
29
+ sh "rpmbuild #{args} #{buildarg} --nodeps #{workdir}/SPECS/#{@build.project}.spec"
30
+ mv FileList["#{workdir}/SRPMS/*.rpm"], "pkg/srpm"
26
31
  if buildarg == '-ba'
27
- mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
32
+ mv FileList["#{workdir}/RPMS/*/*.rpm"], "pkg/rpm"
28
33
  end
29
- rm_rf temp
34
+ rm_rf workdir
30
35
  puts
31
36
  output = FileList['pkg/*/*.rpm']
32
37
  puts "Wrote:"
@@ -13,43 +13,44 @@ namespace :pl do
13
13
  namespace :jenkins do
14
14
  desc "Create yum repositories of built RPM packages for this SHA on the distribution server"
15
15
  task :rpm_repos => "pl:fetch" do
16
- # Formulate our command string, which will just find directories with rpms
17
- # and create and update repositories.
18
- #
19
- artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
16
+ begin
17
+ # Formulate our command string, which will just find directories with rpms
18
+ # and create and update repositories.
19
+ #
20
+ artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
20
21
 
21
- ##
22
- # Test that the artifacts directory exists on the distribution server.
23
- # This will give us some more helpful output.
24
- #
25
- cmd = 'echo "Checking for build artifacts. Will exit if not found." ; '
26
- cmd << "[ -d #{artifact_directory}/artifacts ] || exit 0 ; "
22
+ ##
23
+ # Test that the artifacts directory exists on the distribution server.
24
+ # This will give us some more helpful output.
25
+ #
26
+ cmd = 'echo "Checking for build artifacts. Will exit if not found." ; '
27
+ cmd << "[ -d #{artifact_directory}/artifacts ] || exit 1 ; "
27
28
 
28
- ##
29
- # Enter the directory containing the build artifacts and create repos.
30
- #
31
- cmd << "pushd #{artifact_directory} ; "
32
- cmd << 'echo "Checking for running repo creation. Will wait if detected." ; '
33
- cmd << "while [ -f .lock ] ; do sleep 1 ; echo -n '.' ; done ; "
34
- cmd << 'echo "Setting lock" ; '
35
- cmd << "touch .lock ; "
36
- cmd << "rsync -avxl artifacts/ repos/ ; pushd repos ; "
37
- cmd << "createrepo=$(which createrepo) ; "
38
- cmd << 'for repodir in $(find ./ -name "*.rpm" | xargs -I {} dirname {}) ; do '
39
- cmd << "pushd $repodir && $createrepo -d --update . && popd ; "
40
- cmd << "done ; popd "
41
-
42
- remote_ssh_cmd(@build.distribution_server, cmd)
43
-
44
- # Always remove the lock file, even if we've failed
45
- remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
46
-
47
- # Now that we've created our repositories, we can create the configs for
48
- # them
49
- Rake::Task["pl:jenkins:generate_rpm_repo_configs"].execute
50
-
51
- # And once they're created, we can ship them
52
- Rake::Task["pl:jenkins:ship_repo_configs"].execute
29
+ ##
30
+ # Enter the directory containing the build artifacts and create repos.
31
+ #
32
+ cmd << "pushd #{artifact_directory} ; "
33
+ cmd << 'echo "Checking for running repo creation. Will wait if detected." ; '
34
+ cmd << "while [ -f .lock ] ; do sleep 1 ; echo -n '.' ; done ; "
35
+ cmd << 'echo "Setting lock" ; '
36
+ cmd << "touch .lock ; "
37
+ cmd << "rsync -avxl artifacts/ repos/ ; pushd repos ; "
38
+ cmd << "createrepo=$(which createrepo) ; "
39
+ cmd << 'for repodir in $(find ./ -name "*.rpm" | xargs -I {} dirname {}) ; do '
40
+ cmd << "pushd $repodir && $createrepo -d --update . && popd ; "
41
+ cmd << "done ; popd "
42
+
43
+ remote_ssh_cmd(@build.distribution_server, cmd)
44
+ # Now that we've created our repositories, we can create the configs for
45
+ # them
46
+ Rake::Task["pl:jenkins:generate_rpm_repo_configs"].execute
47
+
48
+ # And once they're created, we can ship them
49
+ Rake::Task["pl:jenkins:ship_repo_configs"].execute
50
+ ensure
51
+ # Always remove the lock file, even if we've failed
52
+ remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
53
+ end
53
54
  end
54
55
 
55
56
  # Generate yum configuration files that point to the repositories created
@@ -65,10 +66,7 @@ namespace :pl do
65
66
  # We have a hard requirement on wget because of all the download magicks
66
67
  # we have to do
67
68
  #
68
- unless wget = find_tool("wget")
69
- warn "Could not find `wget` tool. This is needed for composing the yum repo configurations. Install `wget` and try again."
70
- exit 0
71
- end
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."
72
70
 
73
71
  # This is the standard path to all build artifacts on the distribution
74
72
  # server for this commit
@@ -94,10 +92,7 @@ namespace :pl do
94
92
  end
95
93
  end
96
94
 
97
- if yum_repos.empty?
98
- puts "No rpm repos were found to generate configs from. Exiting.."
99
- exit 0
100
- end
95
+ yum_repos.empty? and fail "No rpm repos were found to generate configs from!"
101
96
 
102
97
  mkdir_p File.join("pkg","repo_configs","rpm")
103
98
 
@@ -109,7 +104,6 @@ namespace :pl do
109
104
  # We ship a base 'srpm' that gets turned into a repo, but we want to
110
105
  # ignore this one because its an extra
111
106
  next if url == "#{base_url}srpm/"
112
- elements = url.split('/')
113
107
 
114
108
  dist,version,subdir,arch = url.split('/')[-4..-1]
115
109
 
@@ -131,18 +125,13 @@ namespace :pl do
131
125
 
132
126
  desc "Retrieve rpm yum repository configs from distribution server"
133
127
  task :rpm_repo_configs => "pl:fetch" do
134
- if wget = find_tool("wget")
135
- mkdir_p "pkg/repo_configs"
136
- config_url = "#{@build.builds_server}/#{@build.project}/#{@build.ref}/repo_configs/rpm/"
137
- begin
138
- sh "#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{config_url}"
139
- rescue
140
- warn "Couldn't retrieve rpm yum repo configs. See preceding http response for more info."
141
- exit 1
142
- end
143
- else
144
- warn "Could not find `wget` tool! wget is required to download the repository configs."
145
- exit 1
128
+ wget = find_tool("wget") or fail "Could not find `wget` tool! wget is required to download the repository configs."
129
+ mkdir_p "pkg/repo_configs"
130
+ config_url = "#{@build.builds_server}/#{@build.project}/#{@build.ref}/repo_configs/rpm/"
131
+ begin
132
+ sh "#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{config_url}"
133
+ rescue
134
+ fail "Couldn't retrieve rpm yum repo configs. See preceding http response for more info."
146
135
  end
147
136
  end
148
137
  end
@@ -1,8 +1,12 @@
1
1
  namespace :pl do
2
2
  desc "Ship mocked rpms to #{@build.yum_host}"
3
3
  task :ship_rpms do
4
- rsync_to('pkg/el', @build.yum_host, @build.yum_repo_path)
5
- rsync_to('pkg/fedora', @build.yum_host, @build.yum_repo_path)
4
+ retry_on_fail(:times => 3) do
5
+ rsync_to('pkg/el', @build.yum_host, @build.yum_repo_path)
6
+ end
7
+ retry_on_fail(:times => 3) do
8
+ rsync_to('pkg/fedora', @build.yum_host, @build.yum_repo_path)
9
+ end
6
10
  end
7
11
 
8
12
  namespace :remote do
@@ -31,7 +35,9 @@ namespace :pl do
31
35
 
32
36
  desc "Ship cow-built debs to #{@build.apt_host}"
33
37
  task :ship_debs do
34
- rsync_to('pkg/deb/', @build.apt_host, @build.apt_repo_path)
38
+ retry_on_fail(:times => 3) do
39
+ rsync_to('pkg/deb/', @build.apt_host, @build.apt_repo_path)
40
+ end
35
41
  end
36
42
 
37
43
  namespace :remote do
@@ -45,44 +51,44 @@ namespace :pl do
45
51
  remote_ssh_cmd(@build.ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
46
52
  end if @build.build_ips
47
53
 
48
- if File.exist?("#{ENV['HOME']}/.packaging")
49
- desc "Upload ips p5p packages to downloads"
50
- task :ship_ips => 'pl:fetch' do
51
- if Dir['pkg/ips/pkgs/**/*'].empty?
52
- STDOUT.puts "There aren't any p5p packages in pkg/ips/pkgs. Maybe something went wrong?"
53
- else
54
- rsync_to('pkg/ips/pkgs/', @build.ips_package_host, @build.ips_path)
55
- end
56
- end if @build.build_ips
57
- end
54
+ desc "Upload ips p5p packages to downloads"
55
+ task :ship_ips => 'pl:fetch' do
56
+ if Dir['pkg/ips/pkgs/**/*'].empty?
57
+ STDOUT.puts "There aren't any p5p packages in pkg/ips/pkgs. Maybe something went wrong?"
58
+ else
59
+ rsync_to('pkg/ips/pkgs/', @build.ips_package_host, @build.ips_path)
60
+ end
61
+ end if @build.build_ips
58
62
 
59
63
  desc "Ship built gem to rubygems"
60
64
  task :ship_gem do
61
65
  ship_gem("pkg/#{@build.project}-#{@build.gemversion}.gem")
62
66
  end if @build.build_gem
63
67
 
64
- if File.exist?("#{ENV['HOME']}/.packaging")
65
- desc "ship apple dmg to #{@build.yum_host}"
66
- task :ship_dmg => 'pl:fetch' do
68
+ desc "ship apple dmg to #{@build.yum_host}"
69
+ task :ship_dmg => 'pl:fetch' do
70
+ retry_on_fail(:times => 3) do
67
71
  rsync_to('pkg/apple/*.dmg', @build.yum_host, @build.dmg_path)
68
- end if @build.build_dmg
72
+ end
73
+ end if @build.build_dmg
69
74
 
70
- desc "ship tarball and signature to #{@build.tar_host}"
71
- task :ship_tar => 'pl:fetch' do
75
+ desc "ship tarball and signature to #{@build.tar_host}"
76
+ task :ship_tar => 'pl:fetch' do
77
+ retry_on_fail(:times => 3) do
72
78
  rsync_to("pkg/#{@build.project}-#{@build.version}.tar.gz*", @build.tar_host, @build.tarball_path)
73
79
  end
80
+ end
74
81
 
75
- desc "UBER ship: ship all the things in pkg"
76
- task :uber_ship => 'pl:fetch' do
77
- if confirm_ship(FileList["pkg/**/*"])
78
- ENV['ANSWER_OVERRIDE'] = 'yes'
79
- Rake::Task["pl:ship_gem"].invoke if @build.build_gem
80
- Rake::Task["pl:ship_rpms"].invoke
81
- Rake::Task["pl:ship_debs"].invoke
82
- Rake::Task["pl:ship_dmg"].execute if @build.build_dmg
83
- Rake::Task["pl:ship_tar"].execute
84
- Rake::Task["pl:jenkins:ship"].invoke("shipped")
85
- end
82
+ desc "UBER ship: ship all the things in pkg"
83
+ task :uber_ship => 'pl:fetch' do
84
+ if confirm_ship(FileList["pkg/**/*"])
85
+ ENV['ANSWER_OVERRIDE'] = 'yes'
86
+ Rake::Task["pl:ship_gem"].invoke if @build.build_gem
87
+ Rake::Task["pl:ship_rpms"].invoke
88
+ Rake::Task["pl:ship_debs"].invoke
89
+ Rake::Task["pl:ship_dmg"].execute if @build.build_dmg
90
+ Rake::Task["pl:ship_tar"].execute
91
+ Rake::Task["pl:jenkins:ship"].invoke("shipped")
86
92
  end
87
93
  end
88
94
 
@@ -98,20 +104,23 @@ namespace :pl do
98
104
  invoke_task("pl:fetch")
99
105
  target = args.target || "artifacts"
100
106
  artifact_dir = "#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}"
101
- remote_ssh_cmd(@build.distribution_server, "mkdir -p #{artifact_dir}")
102
- rsync_to("pkg/", @build.distribution_server, "#{artifact_dir}/ --exclude repo_configs")
107
+ retry_on_fail(:times => 3) do
108
+ remote_ssh_cmd(@build.distribution_server, "mkdir -p #{artifact_dir}")
109
+ end
110
+ retry_on_fail(:times => 3) do
111
+ rsync_to("pkg/", @build.distribution_server, "#{artifact_dir}/ --exclude repo_configs")
112
+ end
103
113
  end
104
114
 
105
115
  desc "Ship generated repository configs to the distribution server"
106
116
  task :ship_repo_configs do
107
- if empty_dir?("pkg/repo_configs")
108
- warn "No repo configs have been generated! Try pl:deb_repo_configs or pl:rpm_repo_configs"
109
- exit 1
110
- end
117
+ empty_dir?("pkg/repo_configs") and fail "No repo configs have been generated! Try pl:deb_repo_configs or pl:rpm_repo_configs"
111
118
  invoke_task("pl:fetch")
112
119
  repo_dir = "#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/repo_configs"
113
120
  remote_ssh_cmd(@build.distribution_server, "mkdir -p #{repo_dir}")
114
- rsync_to("pkg/repo_configs/", @build.distribution_server, repo_dir)
121
+ retry_on_fail(:times => 3) do
122
+ rsync_to("pkg/repo_configs/", @build.distribution_server, repo_dir)
123
+ end
115
124
  end
116
125
  end
117
126
  end