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
@@ -2,9 +2,9 @@
2
2
  def add_shipped_metrics args
3
3
  @metrics << {
4
4
  :type => 'shipped',
5
- :package => ( args[:package] || @build.project ),
6
- :version => ( args[:version] || @build.version ),
7
- :pe_version => ( args[:pe_version] || @build.pe_version ),
5
+ :package => ( args[:package] || Pkg::Config.project ),
6
+ :version => ( args[:version] || Pkg::Config.version ),
7
+ :pe_version => ( args[:pe_version] || Pkg::Config.pe_version ),
8
8
  :is_rc => ( args[:is_rc] || false ),
9
9
  }
10
10
  end
@@ -18,7 +18,7 @@ def post_shipped_metrics
18
18
  pe_version = metric[:pe_version]
19
19
  is_rc = metric[:is_rc]
20
20
 
21
- uri = URI(@build.metrics_url)
21
+ uri = URI(Pkg::Config.metrics_url)
22
22
  res = Net::HTTP.post_form(
23
23
  uri,
24
24
  {
@@ -18,16 +18,16 @@ PKGBUILD = '/usr/bin/pkgbuild'
18
18
  task :setup do
19
19
  # Read the Apple file-mappings
20
20
  begin
21
- @source_files = data_from_yaml('ext/osx/file_mapping.yaml')
21
+ @source_files = Pkg::Util::Serialization.load_yaml('ext/osx/file_mapping.yaml')
22
22
  rescue
23
23
  fail "Could not load Apple file mappings from 'ext/osx/file_mapping.yaml'"
24
24
  end
25
- @package_name = @build.project
26
- @title = "#{@build.project}-#{@build.version}"
27
- @reverse_domain = "com.#{@build.packager}.#{@package_name}"
28
- @package_major_version = @build.version.split('.')[0]
29
- @package_minor_version = @build.version.split('.')[1] +
30
- @build.version.split('.')[2].split('-')[0].split('rc')[0]
25
+ @package_name = Pkg::Config.project
26
+ @title = "#{Pkg::Config.project}-#{Pkg::Config.version}"
27
+ @reverse_domain = "com.#{Pkg::Config.packager}.#{@package_name}"
28
+ @package_major_version = Pkg::Config.version.split('.')[0]
29
+ @package_minor_version = Pkg::Config.version.split('.')[1] +
30
+ Pkg::Config.version.split('.')[2].split('-')[0].split('rc')[0]
31
31
  @pm_restart = 'None'
32
32
  @build_date = Time.new.strftime("%Y-%m-%dT%H:%M:%SZ")
33
33
  @apple_bindir = '/usr/bin'
@@ -43,7 +43,7 @@ end
43
43
  # package-specific options) is built from an ERB template located
44
44
  # in the ext/osx directory.
45
45
  def make_directory_tree
46
- project_tmp = "#{get_temp}/#{@package_name}"
46
+ project_tmp = "#{Pkg::Util::File.mktemp}/#{@package_name}"
47
47
  @scratch = "#{project_tmp}/#{@title}"
48
48
  @working_tree = {
49
49
  'scripts' => "#{@scratch}/scripts",
@@ -58,15 +58,15 @@ def make_directory_tree
58
58
  end
59
59
 
60
60
  if File.exists?('ext/osx/postflight.erb')
61
- erb 'ext/osx/postflight.erb', "#{@working_tree["scripts"]}/postinstall"
61
+ Pkg::Util::File.erb_file 'ext/osx/postflight.erb', "#{@working_tree["scripts"]}/postinstall", false, :binding => binding
62
62
  end
63
63
 
64
64
  if File.exists?('ext/osx/preflight.erb')
65
- erb 'ext/osx/preflight.erb', "#{@working_tree["scripts"]}/preinstall"
65
+ Pkg::Util::File.erb_file 'ext/osx/preflight.erb', "#{@working_tree["scripts"]}/preinstall", false, :binding => binding
66
66
  end
67
67
 
68
68
  if File.exists?('ext/osx/prototype.plist.erb')
69
- erb 'ext/osx/prototype.plist.erb', "#{@scratch}/prototype.plist"
69
+ Pkg::Util::File.erb_file 'ext/osx/prototype.plist.erb', "#{@scratch}/prototype.plist", false, :binding => binding
70
70
  end
71
71
 
72
72
  if File.exists?('ext/packaging/static_artifacts/PackageInfo.plist')
@@ -96,7 +96,7 @@ def build_dmg
96
96
  system("sudo #{PKGBUILD} --root #{@working_tree['working']} \
97
97
  --scripts #{@working_tree['scripts']} \
98
98
  --identifier #{@reverse_domain} \
99
- --version #{@version} \
99
+ --version #{Pkg::Config.version} \
100
100
  --install-location / \
101
101
  --ownership preserve \
102
102
  --info #{@scratch}/PackageInfo.plist \
@@ -225,9 +225,24 @@ def pack_source
225
225
  end
226
226
  end
227
227
  end
228
+
229
+ # Hackery here. Our packages were using /usr/bin/env ruby and installing to
230
+ # system ruby loadpath, which breaks horribly in a multi-ruby (rbenv, etc)
231
+ # environment. This goes into the workdir and looks for any files dropped in
232
+ # bin, and "seds" the shebang to /usr/bin/ruby. I would love to be using a
233
+ # ruby approach to this instead of shelling out to sed, but the problem is
234
+ # we've already set ownership on these files, almost exclusively to root, and
235
+ # thus we need to sudo out.
236
+ if @source_files['directories'] and @source_files['directories']['bin']
237
+ if bindir = @source_files['directories']['bin']['path']
238
+ Dir[File.join(work, bindir, '*')].each do |binfile|
239
+ sh "sudo /usr/bin/sed -E -i '' '1 s,^#![[:space:]]*/usr/bin/env[[:space:]]+ruby$,#!/usr/bin/ruby,' #{binfile}"
240
+ end
241
+ end
242
+ end
228
243
  end
229
244
 
230
- if @build.build_dmg
245
+ if Pkg::Config.build_dmg
231
246
  namespace :package do
232
247
  desc "Task for building an Apple Package"
233
248
  task :apple => [:setup] do
@@ -1,177 +1,3 @@
1
- module Build
2
- ##
3
- # This class is meant to encapsulate all of the data we know about a build invoked with
4
- # `rake package:<build>` or `rake pl:<build>`. It can read in this data via a yaml file,
5
- # have it set via accessors, and serialize it back to yaml for easy transport.
6
- #
7
- class BuildInstance
8
- @@build_params = [:apt_host,
9
- :apt_repo_path,
10
- :apt_repo_url,
11
- :author,
12
- :benchmark,
13
- :build_date,
14
- :build_defaults,
15
- :build_dmg,
16
- :build_doc,
17
- :build_gem,
18
- :build_ips,
19
- :build_pe,
20
- :builder_data_file,
21
- :builds_server,
22
- :certificate_pem,
23
- :cows,
24
- :db_table,
25
- :deb_build_host,
26
- :debversion,
27
- :debug,
28
- :default_cow,
29
- :default_mock,
30
- :description,
31
- :distribution_server,
32
- :dmg_path,
33
- :email,
34
- :files,
35
- :final_mocks,
36
- :freight_conf,
37
- :gem_default_executables,
38
- :gem_dependencies,
39
- :gem_description,
40
- :gem_devel_dependencies,
41
- :gem_development_dependencies,
42
- :gem_excludes,
43
- :gem_executables,
44
- :gem_files,
45
- :gem_forge_project,
46
- :gem_name,
47
- :gem_platform_dependencies,
48
- :gem_rdoc_options,
49
- :gem_require_path,
50
- :gem_runtime_dependencies,
51
- :gem_summary,
52
- :gem_test_files,
53
- :gemversion,
54
- :gpg_key,
55
- :gpg_name,
56
- :homepage,
57
- :ips_build_host,
58
- :ips_host,
59
- :ips_inter_cert,
60
- :ips_package_host,
61
- :ips_path,
62
- :ips_repo,
63
- :ips_store,
64
- :ipsversion,
65
- :jenkins_build_host,
66
- :jenkins_packaging_job,
67
- :jenkins_repo_path,
68
- :metrics,
69
- :metrics_url,
70
- :name,
71
- :notify,
72
- :project,
73
- :origversion,
74
- :osx_build_host,
75
- :packager,
76
- :packaging_repo,
77
- :packaging_url,
78
- :pbuild_conf,
79
- :pe_name,
80
- :pe_version,
81
- :pg_major_version,
82
- :pre_tar_task,
83
- :privatekey_pem,
84
- :random_mockroot,
85
- :rc_mocks,
86
- :release,
87
- :rpm_build_host,
88
- :rpmrelease,
89
- :rpmversion,
90
- :ref,
91
- :sign_tar,
92
- :summary,
93
- :tar_excludes,
94
- :tar_host,
95
- :tarball_path,
96
- :task,
97
- :team,
98
- :templates,
99
- :update_version_file,
100
- :version,
101
- :version_file,
102
- :version_strategy,
103
- :yum_host,
104
- :yum_repo_path]
105
-
106
- @@build_params.each do |v|
107
- attr_accessor v
108
- end
109
-
110
- def initialize
111
- @task = { :task => $*[0], :args => $*[1..-1] }
112
- @ref = git_sha_or_tag
113
- end
114
-
115
- ##
116
- # Take a hash of parameters, and iterate over them,
117
- # setting each build param to the corresponding hash key,value.
118
- #
119
- def set_params_from_hash(data = {})
120
- data.each do |param, value|
121
- if @@build_params.include?(param.to_sym)
122
- self.instance_variable_set("@#{param}", value)
123
- else
124
- warn "Warning - No build data parameter found for '#{param}'. Perhaps you have an erroneous entry in your yaml file?"
125
- end
126
- end
127
- end
128
-
129
- ##
130
- # Load build parameters from a yaml file. Uses #data_from_yaml in
131
- # 00_utils.rake
132
- #
133
- def set_params_from_file(file)
134
- build_data = data_from_yaml(file)
135
- set_params_from_hash(build_data)
136
- end
137
-
138
- ##
139
- # Return a hash of all build parameters and their values, nil if unassigned.
140
- #
141
- def params
142
- data = {}
143
- @@build_params.each do |param|
144
- data.store(param, self.instance_variable_get("@#{param}"))
145
- end
146
- data
147
- end
148
-
149
- ##
150
- # Write all build parameters to a yaml file in a temporary location. Print
151
- # the path to the file and return it as a string. Accept an argument for
152
- # the write target directory. The name of the params file is the current
153
- # git commit sha or tag.
154
- #
155
- def params_to_yaml(output_dir=nil)
156
- dir = output_dir.nil? ? get_temp : output_dir
157
- File.writable?(dir) or fail "#{dir} does not exist or is not writable, skipping build params write. Exiting.."
158
- params_file = File.join(dir, "#{self.ref}.yaml")
159
- File.open(params_file, 'w') do |f|
160
- f.puts params.to_yaml
161
- end
162
- puts params_file
163
- params_file
164
- end
165
-
166
- ##
167
- # Print the names and values of all the params known to the build object
168
- #
169
- def print_params
170
- params.each { |k,v| puts "#{k}: #{v}" }
171
- end
172
- end
173
- end
174
-
175
1
  # Perform a build exclusively from a build params file. Requires that the build
176
2
  # params file include a setting for task, which is an array of the arguments
177
3
  # given to rake originally, including, first, the task name. The params file is
@@ -180,7 +6,7 @@ namespace :pl do
180
6
  desc "Build from a build params file"
181
7
  task :build_from_params do
182
8
  check_var('PARAMS_FILE', ENV['PARAMS_FILE'])
183
- git_co(@build.ref)
184
- Rake::Task[@build.task[:task]].invoke(@build.task[:args])
9
+ Pkg::Util::Version.git_co(Pkg::Config.ref)
10
+ Rake::Task[Pkg::Config.task[:task]].invoke(Pkg::Config.task[:args])
185
11
  end
186
12
  end
@@ -1,9 +1,11 @@
1
+ require 'pathname'
2
+
1
3
  def pdebuild args
2
4
  results_dir = args[:work_dir]
3
5
  cow = args[:cow]
4
6
  set_cow_envs(cow)
5
7
  update_cow(cow)
6
- sh "pdebuild --configfile #{@build.pbuild_conf} \
8
+ sh "pdebuild --configfile #{Pkg::Config.pbuild_conf} \
7
9
  --buildresult #{results_dir} \
8
10
  --pbuilder cowbuilder -- \
9
11
  --basepath /var/cache/pbuilder/#{cow}/"
@@ -14,7 +16,7 @@ def update_cow(cow)
14
16
  ENV['PATH'] = "/usr/sbin:#{ENV['PATH']}"
15
17
  set_cow_envs(cow)
16
18
  retry_on_fail(:times => 3) do
17
- sh "sudo -E /usr/sbin/cowbuilder --update --override-config --configfile #{@build.pbuild_conf} --basepath /var/cache/pbuilder/#{cow} --distribution #{ENV['DIST']} --architecture #{ENV['ARCH']}"
19
+ sh "sudo -E /usr/sbin/cowbuilder --update --override-config --configfile #{Pkg::Config.pbuild_conf} --basepath /var/cache/pbuilder/#{cow} --distribution #{ENV['DIST']} --architecture #{ENV['ARCH']}"
18
20
  end
19
21
  end
20
22
 
@@ -23,17 +25,40 @@ def debuild args
23
25
  begin
24
26
  sh "debuild --no-lintian -uc -us"
25
27
  rescue
26
- fail "Something went wrong. Hopefully the backscroll or #{results_dir}/#{@build.project}_#{@build.debversion}.build file has a clue."
28
+ fail "Something went wrong. Hopefully the backscroll or #{results_dir}/#{Pkg::Config.project}_#{Pkg::Config.debversion}.build file has a clue."
27
29
  end
28
30
  end
29
31
 
30
32
  task :prep_deb_tars, :work_dir do |t,args|
31
33
  work_dir = args.work_dir
32
- cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz", work_dir
34
+ cp_p "pkg/#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz", work_dir
33
35
  cd work_dir do
34
- sh "tar zxf #{@build.project}-#{@build.version}.tar.gz"
35
- mv "#{@build.project}-#{@build.version}", "#{@build.project}-#{@build.debversion}"
36
- mv "#{@build.project}-#{@build.version}.tar.gz", "#{@build.project}_#{@build.origversion}.orig.tar.gz"
36
+ sh "tar zxf #{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz"
37
+ mv "#{Pkg::Config.project}-#{Pkg::Config.version}", "#{Pkg::Config.project}-#{Pkg::Config.debversion}"
38
+ mv "#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz", "#{Pkg::Config.project}_#{Pkg::Config.origversion}.orig.tar.gz"
39
+ end
40
+
41
+
42
+ # This assumes that work_dir is absolute, which I hope is a safe assumption.
43
+ #
44
+ # Also, it turns out that invoking 'find' on a directory that doesn't exist
45
+ # will fail in nasty ways, so we only do this if the target exists...
46
+ if Pathname('ext/debian').directory?
47
+ pkg_dir = "#{work_dir}/#{Pkg::Config.project}-#{Pkg::Config.debversion}"
48
+ cd 'ext' do
49
+ Pathname('debian').find do |file|
50
+ case
51
+ when file.to_s =~ /~$/, file.to_s =~ /^#/
52
+ next
53
+ when file.directory?
54
+ mkdir_p "#{pkg_dir}/#{file}"
55
+ when file.extname == '.erb'
56
+ Pkg::Util::File.erb_file(file, "#{pkg_dir}/#{file.sub(/\.[^\.]*$/, '')}", false, :binding => Pkg::Config.get_binding)
57
+ else
58
+ cp file, "#{pkg_dir}/#{file}"
59
+ end
60
+ end
61
+ end
37
62
  end
38
63
  end
39
64
 
@@ -41,19 +66,35 @@ task :build_deb, :deb_command, :cow do |t,args|
41
66
  bench = Benchmark.realtime do
42
67
  deb_build = args.deb_command
43
68
  cow = args.cow
44
- work_dir = get_temp
45
- subdir = 'pe/' if @build.build_pe
46
- dest_dir = "#{@build_root}/pkg/#{subdir}deb/#{cow.split('-')[1] unless cow.nil?}"
47
- check_tool(deb_build)
69
+ work_dir = Pkg::Util::File.mktemp
70
+ subdir = 'pe/' if Pkg::Config.build_pe
71
+ dest_dir = "#{Pkg::Config.project_root}/pkg/#{subdir}deb/#{cow.split('-')[1] unless cow.nil?}"
72
+ Pkg::Util::Tool.check_tool(deb_build)
48
73
  mkdir_p dest_dir
49
74
  deb_args = { :work_dir => work_dir, :cow => cow}
50
75
  Rake::Task[:prep_deb_tars].reenable
51
76
  Rake::Task[:prep_deb_tars].invoke(work_dir)
52
- cd "#{work_dir}/#{@build.project}-#{@build.debversion}" do
53
- mv 'ext/debian', '.'
77
+ cd "#{work_dir}/#{Pkg::Config.project}-#{Pkg::Config.debversion}" do
78
+ if !File.directory?('debian') and File.directory?('ext/debian')
79
+ mv 'ext/debian', 'debian'
80
+ end
81
+
82
+ # So this is terrible. It is a hacky hacky bandaid for until this can be
83
+ # totally refactored into a library with templates drawn entirely from
84
+ # the tarball. The following two lines are needed because the deb.rake
85
+ # logic currently re-templates all of the templates in ext/debian for use
86
+ # in packaging. Then, before the package is built, if the debian
87
+ # directory doesn't exist (this is really only the case for puppetdb),
88
+ # the ext/debian directory from the tarball is moved into place. This
89
+ # breaks ezbake because ezbake maps templates to differently named files
90
+ # in the tarball templating, but those newly generated templates are
91
+ # completely ignored without the following two lines that unconditionally
92
+ # copy anything in ext/debian into the debian directory.
93
+ mkdir_p 'debian'
94
+ cp_pr(Dir.glob("ext/debian/*"), 'debian')
54
95
  send(deb_build, deb_args)
55
- cp FileList["#{work_dir}/*.deb", "#{work_dir}/*.dsc", "#{work_dir}/*.changes", "#{work_dir}/*.debian.tar.gz", "#{work_dir}/*.orig.tar.gz"], dest_dir
56
- rm_rf "#{work_dir}/#{@build.project}-#{@build.debversion}"
96
+ cp FileList["#{work_dir}/*.deb", "#{work_dir}/*.dsc", "#{work_dir}/*.changes", "#{work_dir}/*.debian.tar.gz", "#{work_dir}/*.orig.tar.gz", "${work_dir}/*.diff.gz"], dest_dir
97
+ rm_rf "#{work_dir}/#{Pkg::Config.project}-#{Pkg::Config.debversion}"
57
98
  rm_rf work_dir
58
99
  end
59
100
  end
@@ -68,16 +109,16 @@ namespace :package do
68
109
  end
69
110
 
70
111
  namespace :pl do
71
- desc "Create a deb from this repo using the default cow #{@build.default_cow}."
112
+ desc "Create a deb from this repo using the default cow #{Pkg::Config.default_cow}."
72
113
  task :deb => "package:tar" do
73
- check_var('PE_VER', @build.pe_version) if @build.build_pe
74
- Rake::Task[:build_deb].invoke('pdebuild', @build.default_cow)
114
+ check_var('PE_VER', Pkg::Config.pe_version) if Pkg::Config.build_pe
115
+ Rake::Task[:build_deb].invoke('pdebuild', Pkg::Config.default_cow)
75
116
  end
76
117
 
77
118
  desc "Create debs from this git repository using all cows specified in build_defaults yaml"
78
119
  task :deb_all do
79
- check_var('PE_VER', @build.pe_version) if @build.build_pe
80
- @build.cows.split(' ').each do |cow|
120
+ check_var('PE_VER', Pkg::Config.pe_version) if Pkg::Config.build_pe
121
+ Pkg::Config.cows.split(' ').each do |cow|
81
122
  Rake::Task["package:tar"].invoke
82
123
  Rake::Task[:build_deb].reenable
83
124
  Rake::Task[:build_deb].invoke('pdebuild', cow)
@@ -12,10 +12,10 @@ namespace :pl do
12
12
  namespace :jenkins do
13
13
  desc "Create apt repositories of build DEB packages for this SHA on the distributions erver"
14
14
  task :deb_repos => "pl:fetch" do
15
- prefix = @build.build_pe ? "pe/" : ""
15
+ prefix = Pkg::Config.build_pe ? "pe/" : ""
16
16
 
17
17
  # First, we test that artifacts exist and set up the repos directory
18
- artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
18
+ artifact_directory = File.join(Pkg::Config.jenkins_repo_path, Pkg::Config.project, Pkg::Config.ref)
19
19
 
20
20
  cmd = 'echo " Checking for deb build artifacts. Will exit if not found.." ; '
21
21
  cmd << "[ -d #{artifact_directory}/artifacts/#{prefix}deb ] || exit 1 ; "
@@ -53,7 +53,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; '
53
53
  cmd << "popd ; popd "
54
54
 
55
55
  begin
56
- remote_ssh_cmd(@build.distribution_server, cmd)
56
+ remote_ssh_cmd(Pkg::Config.distribution_server, cmd)
57
57
  # Now that we've created our package repositories, we can generate repo
58
58
  # configurations for use with downstream jobs, acceptance clients, etc.
59
59
  Rake::Task["pl:jenkins:generate_deb_repo_configs"].execute
@@ -62,7 +62,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; '
62
62
  Rake::Task["pl:jenkins:ship_repo_configs"].execute
63
63
  ensure
64
64
  # Always remove the lock file, even if we've failed
65
- remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
65
+ remote_ssh_cmd(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/.lock")
66
66
  end
67
67
 
68
68
  end
@@ -80,12 +80,12 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; '
80
80
  # This is the standard path to all debian build artifact repositories on
81
81
  # the distribution server for this commit
82
82
  #
83
- base_url = "http://#{@build.builds_server}/#{@build.project}/#{@build.ref}/repos/apt/"
83
+ base_url = "http://#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repos/apt/"
84
84
 
85
85
  # We use wget to obtain a directory listing of what are presumably our deb repos
86
86
  #
87
87
  repo_urls = []
88
- wget = find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the debian repo configurations. Install `wget` and try again."
88
+ wget = Pkg::Util::Tool.find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the debian repo configurations. Install `wget` and try again."
89
89
  # First test if the directory even exists
90
90
  #
91
91
  wget_results = %x{#{wget} --spider -r -l 1 --no-parent #{base_url} 2>&1}
@@ -93,7 +93,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; '
93
93
  # We want to exclude index and robots files and only include the http: prefixed elements
94
94
  repo_urls = wget_results.split.uniq.reject{|x| x=~ /\?|index|robots/}.select{|x| x =~ /http:/}.map{|x| x.chomp('/')}
95
95
  else
96
- fail "No debian repos available for #{@build.project} at #{@build.ref}."
96
+ fail "No debian repos available for #{Pkg::Config.project} at #{Pkg::Config.ref}."
97
97
  end
98
98
 
99
99
  # Create apt sources.list files that can be added to hosts for installing
@@ -105,19 +105,19 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; '
105
105
  # We want to skip the base_url, which wget returns as one of the results
106
106
  next if "#{url}/" == base_url
107
107
  dist = url.split('/').last
108
- repoconfig = ["# Packages for #{@build.project} built from ref #{@build.ref}",
108
+ repoconfig = ["# Packages for #{Pkg::Config.project} built from ref #{Pkg::Config.ref}",
109
109
  "deb #{url} #{dist} main"]
110
- config = File.join("pkg", "repo_configs", "deb", "pl-#{@build.project}-#{@build.ref}-#{dist}.list")
110
+ config = File.join("pkg", "repo_configs", "deb", "pl-#{Pkg::Config.project}-#{Pkg::Config.ref}-#{dist}.list")
111
111
  File.open(config, 'w') { |f| f.puts repoconfig }
112
112
  end
113
- puts "Wrote apt repo configs for #{@build.project} at #{@build.ref} to pkg/repo_configs/deb."
113
+ puts "Wrote apt repo configs for #{Pkg::Config.project} at #{Pkg::Config.ref} to pkg/repo_configs/deb."
114
114
  end
115
115
 
116
116
  desc "Retrieve debian apt repository configs for this sha"
117
117
  task :deb_repo_configs => "pl:fetch" do
118
- wget = find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the debian repo configurations. Install `wget` and try again."
118
+ wget = Pkg::Util::Tool.find_tool("wget") or fail "Could not find `wget` tool. This is needed for composing the debian repo configurations. Install `wget` and try again."
119
119
  mkdir_p "pkg/repo_configs"
120
- config_url = "#{@build.builds_server}/#{@build.project}/#{@build.ref}/repo_configs/deb/"
120
+ config_url = "#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/deb/"
121
121
  begin
122
122
  sh "#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{config_url}"
123
123
  rescue