puppet 2.7.20.rc1 → 2.7.20

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.

@@ -4,7 +4,10 @@ This is a repository for packaging automation for Puppet Labs software.
4
4
  The goal is to abstract and automate packaging processes beyond individual
5
5
  software projects to a level where this repo can be cloned inside any project
6
6
  and used to build Debian and Redhat packages, as well as gems, apple packages
7
- and tarballs.
7
+ and tarballs. This repo is currently under heavy development and in a state
8
+ flux, and it should not be considered to have a formal API. However, every
9
+ effort is being made to ensure existing tasks/behavior are not broken as we
10
+ continue to iterate and improve upon it.
8
11
 
9
12
  ##Using the Packaging Repo
10
13
 
@@ -22,7 +25,8 @@ create rpms and debs, but any build dependencies will need to be satisifed by
22
25
  the building host, and any dynamically generated dependencies may result in
23
26
  packages that are only suitable for the OS/version of the build host. However,
24
27
  for rolling one's own debs and rpms or for use in environments without many
25
- OSes/versions, this may work just fine.
28
+ OSes/versions, this may work just fine. To build an rpm using the packaging
29
+ repo, do a `rake package:rpm`. To build a deb, use `rake package:deb`.
26
30
 
27
31
  `pl:` namespaced tasks rely on a slighly more complex toolchain for packaging
28
32
  inside clean chroot environments for the various operating systems and
@@ -32,12 +36,48 @@ pdebuild and [cowbuilder](http://wiki.debian.org/cowbuilder). For the most
32
36
  part, these tasks are keyed to puppetlabs infrastructure, and are used by the
33
37
  Release Engineering team to create release packages. However, they can
34
38
  certainly be modified to suit other environments, and much effort went into
35
- making tasks as modular and reusable as possible.
39
+ making tasks as modular and reusable as possible. Several Puppet Labs-specific
40
+ tasks are only available if the file '~/.packaging/builder\_data.yaml' is present.
41
+ This file is created by the `pl:fetch` task, which pulls down another yaml file
42
+ from a [separate build data repository](https://github.com/puppetlabs/build-data),
43
+ which contains additional settings/data specific to Puppet Labs release
44
+ infrastructure. The goal in separating these data and tasks out is to refrain
45
+ from presenting by default yet more Puppet Labs-specific tasks that aren't
46
+ generally consumable by everyone. To build a deb from a local repository using
47
+ a `pl` task, ssh into a builder (e.g., one stood up using the modules detailed
48
+ below) and clone the source repo, e.g. puppet. Then, run `rake package:bootstrap`
49
+ and `rake pl:deb` to create a deb, and `rake pl:mock` to make an rpm (on a debian
50
+ or redhat host, respectively).
51
+
52
+ There is also a `pe:` namespace, for the building of Puppet Labs' Puppet
53
+ Enterprise packages that have been converted to using this repo. The `pe:`
54
+ tasks rely heavily on PL internal infrastructure, and are not generally useful
55
+ outside of this environment. To create packages, in the source repository run
56
+ `rake package:bootstrap`, followed by `rake pl:fetch`. These two commands
57
+ bootstrap the packaging environment and pull in the additional data needed for
58
+ PE building (see `pl:fetch` notes above).
59
+ Then, to make a debian package, run `rake pe:deb`, and to make an rpm, run
60
+ `rake pe:mock`. There are also `pe:deb_all` and `pe:mock_all` tasks, which build
61
+ packages against all shipped debian/redhat targets. The `pe:deb_all` task is not
62
+ generally necessary for developer use for building test packages; the `pe:deb`
63
+ task creates a package that will work against virtually all supported PE debian
64
+ versions. The same is generally true for PE internal rpms, but because of variances
65
+ in build macros for rpm, rpms should generally be built with `pe:mock_all`, and
66
+ then the desired version installed, or by building only for a specific target.
67
+ This is accomplished by passing MOCK=<mock> to the rake call, e.g. `rake pe:mock MOCK=<mock>`.
68
+ The available mocks are listed in `ext/build_defaults.yaml` after `final_mocks:`.
69
+ For PE, the mocks are formatted as `pupent-<peversion>-<distversion>-<arch>`, e.g.
70
+ `pupent-2.7-el5-i386`. To build for a specific target, set `MOCK=<mock>` to the mock
71
+ that matches the target. The `pe:deb` and `pe:mock` tasks work by building on a
72
+ remote builder using the current committed state of the source repository. To forego
73
+ remote building and build on the local station (e.g., by ssh-ing into a remote
74
+ builder first), the tasks `pe:local_mock` and `pe:local_deb` build using the
75
+ local host.
36
76
 
37
77
  A puppet module,
38
78
  [puppetlabs-debbuilder](https://github.com/puppetlabs/puppetlabs-debbuilder),
39
79
  has been created to stand up a debian build host compatible with the debian
40
- side this packaging repo. The rpm-side module,
80
+ side of this packaging repo. The rpm-side module,
41
81
  [puppetlabs-rpmbuilder](https://github.com/puppetlabs/puppetlabs-rpmbuilder),
42
82
  is currently a work in progress and.
43
83
 
@@ -47,8 +87,9 @@ package:implode`.
47
87
  ##Setting up projects for the Packaging Repo
48
88
 
49
89
  The packaging repo requires many project-side artifacts inside the ext
50
- directory at the top level. It expects the following directory structure in
51
- the project
90
+ directory at the top level. [facter](https://github.com:puppetlabs/facter) and
91
+ [hiera](https://github.com:puppetlabs/hiera) are good examples.
92
+ It expects the following directory structure in the project
52
93
 
53
94
  * ext/{debian,redhat,osx}
54
95
 
@@ -234,7 +234,7 @@ def gpg_sign_file(file)
234
234
  if gpg
235
235
  sh "#{gpg} --armor --detach-sign -u #{@gpg_key} #{file}"
236
236
  else
237
- STDERR.puts "No gpg available. Cannot sign tarball. Exiting..."
237
+ STDERR.puts "No gpg available. Cannot sign #{file}. Exiting..."
238
238
  exit 1
239
239
  end
240
240
  end
@@ -268,9 +268,14 @@ def ln(target, name)
268
268
  FileUtils.ln(name, target, :force => true, :verbose => true)
269
269
  end
270
270
 
271
- def git_commit_file(file)
271
+ def git_commit_file(file, message=nil)
272
272
  if has_tool('git') and File.exist?('.git')
273
- %x{git commit #{file} -m "Commit changes to #{file}" &> /dev/null}
273
+ message ||= "changes"
274
+ puts "Commiting changes:"
275
+ puts
276
+ diff = %x{git diff HEAD #{file}}
277
+ puts diff
278
+ %x{git commit #{file} -m "Commit #{message} in #{file}" &> /dev/null}
274
279
  end
275
280
  end
276
281
 
@@ -278,11 +283,6 @@ def ship_gem(file)
278
283
  %x{gem push #{file}}
279
284
  end
280
285
 
281
- def x(v)
282
- puts %[#{v}]
283
- print %x[#{v}]
284
- end
285
-
286
286
  def ask_yes_or_no
287
287
  return boolean_value(ENV['ANSWER_OVERRIDE']) unless ENV['ANSWER_OVERRIDE'].nil?
288
288
  answer = STDIN.gets.downcase.chomp
@@ -345,12 +345,16 @@ def git_bundle(treeish)
345
345
  "#{temp}/#{@name}-#{@version}-#{appendix}.tar.gz"
346
346
  end
347
347
 
348
- def remote_bootstrap(host, treeish)
348
+ # We take a tar argument for cases where `tar` isn't best, e.g. Solaris
349
+ def remote_bootstrap(host, treeish, tar_cmd=nil)
350
+ unless tar = tar_cmd
351
+ tar = 'tar'
352
+ end
349
353
  tarball = git_bundle(treeish)
350
354
  tarball_name = File.basename(tarball).gsub('.tar.gz','')
351
355
  rsync_to(tarball, host, '/tmp')
352
356
  appendix = rand_string
353
- sh "ssh -t #{host} 'tar -zxvf /tmp/#{tarball_name}.tar.gz -C /tmp/ ; git clone --recursive /tmp/#{tarball_name} /tmp/#{@name}-#{appendix} ; cd /tmp/#{@name}-#{appendix} ; rake package:bootstrap'"
357
+ sh "ssh -t #{host} '#{tar} -zxvf /tmp/#{tarball_name}.tar.gz -C /tmp/ ; git clone --recursive /tmp/#{tarball_name} /tmp/#{@name}-#{appendix} ; cd /tmp/#{@name}-#{appendix} ; rake package:bootstrap'"
354
358
  "/tmp/#{@name}-#{appendix}"
355
359
  end
356
360
 
@@ -380,3 +384,4 @@ end
380
384
  def empty_dir?(dir)
381
385
  File.exist?(dir) and File.directory?(dir) and Dir["#{dir}/**/*"].empty?
382
386
  end
387
+
@@ -53,6 +53,7 @@ begin
53
53
  @ips_repo = @pkg_defaults['ips_repo']
54
54
  @ips_store = @pkg_defaults['ips_store']
55
55
  @ips_host = @pkg_defaults['ips_host']
56
+ @ips_inter_cert = @pkg_defaults['ips_inter_cert']
56
57
  rescue => e
57
58
  STDERR.puts "There was an error loading the packaging defaults from the 'ext/build_defaults.yaml' file.\n" + e
58
59
  exit 1
@@ -1,21 +1,34 @@
1
+ # The pl:load_extras tasks is intended to load variables
2
+ # from the extra yaml file downloaded by the pl:fetch task.
3
+ # The goal is to be able to augment/override settings in the
4
+ # source project's build_data.yaml and project_data.yaml with
5
+ # Puppet Labs-specific data, rather than having to clutter the
6
+ # generic tasks with data not generally useful outside the
7
+ # PL Release team
1
8
  namespace :pl do
2
9
  task :load_extras do
3
10
  begin
4
11
  @build_data = YAML.load_file("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
5
- @rpm_build_host = @build_data['rpm_build_host'] if @build_data['rpm_build_host']
6
- @deb_build_host = @build_data['deb_build_host'] if @build_data['deb_build_host']
7
- @osx_build_host = @build_data['osx_build_host'] if @build_data['osx_build_host']
8
- @tarball_path = @build_data['tarball_path'] if @build_data['tarball_path']
9
- @dmg_path = @build_data['dmg_path'] if @build_data['dmg_path']
10
- @pe_version = @build_data['pe_version'] if @build_data['pe_version']
11
- @team = @build_data['team'] if @build_data['team']
12
- @yum_repo_path = @build_data['yum_repo_path'] if @build_data['yum_repo_path']
13
- @apt_repo_path = @build_data['apt_repo_path'] if @build_data['apt_repo_path']
14
- @freight_conf = @build_data['freight_conf'] if @build_data['freight_conf']
15
- @sles_build_host = @build_data['sles_build_host'] if @build_data['sles_build_host']
16
- @sles_arch_repos = @build_data['sles_arch_repos'] if @build_data['sles_arch_repos']
17
- @sles_repo_path = @build_data['sles_repo_path'] if @build_data['sles_repo_path']
18
- @sles_repo_host = @build_data['sles_repo_host'] if @build_data['sles_repo_host']
12
+ @rpm_build_host = @build_data['rpm_build_host'] if @build_data['rpm_build_host']
13
+ @deb_build_host = @build_data['deb_build_host'] if @build_data['deb_build_host']
14
+ @osx_build_host = @build_data['osx_build_host'] if @build_data['osx_build_host']
15
+ @ips_build_host = @build_data['ips_build_host'] if @build_data['ips_build_host']
16
+ @tarball_path = @build_data['tarball_path'] if @build_data['tarball_path']
17
+ @dmg_path = @build_data['dmg_path'] if @build_data['dmg_path']
18
+ @pe_version = @build_data['pe_version'] if @build_data['pe_version']
19
+ @team = @build_data['team'] if @build_data['team']
20
+ @yum_repo_path = @build_data['yum_repo_path'] if @build_data['yum_repo_path']
21
+ @apt_repo_path = @build_data['apt_repo_path'] if @build_data['apt_repo_path']
22
+ @freight_conf = @build_data['freight_conf'] if @build_data['freight_conf']
23
+ @sles_build_host = @build_data['sles_build_host'] if @build_data['sles_build_host']
24
+ @sles_arch_repos = @build_data['sles_arch_repos'] if @build_data['sles_arch_repos']
25
+ @sles_repo_path = @build_data['sles_repo_path'] if @build_data['sles_repo_path']
26
+ @sles_repo_host = @build_data['sles_repo_host'] if @build_data['sles_repo_host']
27
+ @ips_path = @build_data['ips_path'] if @build_data['ips_path']
28
+ @ips_package_host = @build_data['ips_package_host'] if @build_data['ips_package_host']
29
+ @certificate_pem = @build_data['certificate_pem'] if @build_data['certificate_pem']
30
+ @privatekey_pem = @build_data['privatekey_pem'] if @build_data['privatekey_pem']
31
+ @ips_inter_cert = @build_data['ips_inter_cert'] if @build_data['ips_inter_cert']
19
32
  rescue => e
20
33
  STDERR.puts "There was an error loading the builder data from #{ENV['HOME']}/.packaging/#{@builder_data_file}. Try rake pl:fetch to download the current extras builder data.\n" + e
21
34
  exit 1
@@ -4,6 +4,12 @@ else
4
4
  pl_packaging_url = "https://raw.github.com/puppetlabs/build-data/#{@name}"
5
5
  end
6
6
 
7
+ # The pl:fetch task pulls down a file from the build-data repo that contains additional
8
+ # data specific to Puppet Labs release infrastructure intended to augment/override any
9
+ # defaults specified in the source project repo, e.g. in ext/build_defaults.yaml
10
+ #
11
+ # It uses curl to download the file, and places it in a hidden directory in the home
12
+ # directory, e.g. ~/.packaging/@builder_data_file
7
13
  namespace :pl do
8
14
  task :fetch do
9
15
  rm_rf "#{ENV['HOME']}/.packaging"
@@ -2,24 +2,27 @@ if @build_ips
2
2
  require 'erb'
3
3
  namespace :package do
4
4
  namespace :ips do
5
- workdir = "pkg/ips"
5
+ workdir = "pkg/ips/workdir"
6
6
  proto = workdir + '/proto'
7
7
  repo = workdir + '/repo'
8
- pkgs = workdir + '/pkgs'
9
- repouri = "file://#{`pwd`.strip + '/' + repo}"
10
- artifact = "#{pkgs}/#{@name}@#{@ipsversion}.p5p"
8
+ pkgs = 'pkg/ips/pkgs'
9
+ repouri = 'file://' + Dir.pwd + '/' + repo
10
+ artifact = pkgs + "/#{@name}@#{@ipsversion}.p5p"
11
11
 
12
12
  # Create a source repo
13
13
  # We dont clean the base pkg directory only ips work dir.
14
14
  task :clean do
15
- %x[rm -rf #{workdir}]
15
+ rm_rf workdir
16
+ end
17
+
18
+ task :clean_pkgs do
19
+ rm_rf pkgs
16
20
  end
17
21
 
18
22
  # Create an installation image at ips/proto
19
- task :prepare => :clean do
20
- check_tool('pkgsend')
21
- x %[mkdir -p #{workdir}]
22
- x %[gmake -f ext/ips/rules DESTDIR=#{proto} 2>#{workdir}/build.out ]
23
+ task :prepare do
24
+ mkdir_pr workdir, pkgs
25
+ sh "gmake -f ext/ips/rules DESTDIR=#{proto} 2>#{workdir}/build.out"
23
26
  end
24
27
 
25
28
  # Process templates and write the initial manifest
@@ -29,52 +32,92 @@ if @build_ips
29
32
 
30
33
  # Update manifest to include the installation image information.
31
34
  task :protogen => :prototmpl do
32
- x %[pkgsend generate #{proto} >> #{workdir}/#{@name}.p5m.x ]
33
- os=%x[uname -p].chomp
35
+ sh "pkgsend generate #{proto} >> #{workdir}/#{@name}.p5m.x"
34
36
  end
35
37
 
36
38
  # Generate and resolve dependency list
37
39
  task :protodeps => :protogen do
38
- x %[pkgdepend generate -d #{proto} #{workdir}/#{@name}.p5m.x > #{workdir}/#{@name}.depends ]
39
- x %[pkgdepend resolve -m #{workdir}/#{@name}.depends ]
40
- x %[cat #{workdir}/#{@name}.depends.res >> #{workdir}/#{@name}.p5m.x]
40
+ sh "pkgdepend generate -d #{proto} #{workdir}/#{@name}.p5m.x > #{workdir}/#{@name}.depends"
41
+ sh "pkgdepend resolve -m #{workdir}/#{@name}.depends"
42
+ sh "cat #{workdir}/#{@name}.depends.res >> #{workdir}/#{@name}.p5m.x"
41
43
  end
42
44
 
43
45
  # Mogrify manifest to remove unncecessary info, and other kinds of transforms.
44
46
  task :protomogrify => :protodeps do
45
- x %[pkgmogrify ./ext/ips/transforms ./#{workdir}/#{@name}.p5m.x| pkgfmt >> #{workdir}/#{@name}.p5m ]
47
+ sh "pkgmogrify ./ext/ips/transforms ./#{workdir}/#{@name}.p5m.x| pkgfmt >> #{workdir}/#{@name}.p5m"
46
48
  end
47
49
 
48
50
  # Generate and resolve dependency list
49
51
  task :license => :protomogrify do
50
- x %[cp LICENSE #{proto}/#{@name}.license]
52
+ cp 'LICENSE', "#{proto}/#{@name}.license"
51
53
  end
52
54
 
53
55
  # Ensure that our manifest is sane.
54
56
  task :lint => :license do
55
- x %[pkglint #{workdir}/#{@name}.p5m]
57
+ print %x{pkglint #{workdir}/#{@name}.p5m}
58
+ end
59
+
60
+ task :package => [:clean_pkgs, :clean, :prepare, :lint] do
61
+ # the package is actually created via the dependency chain of :lint
62
+ end
63
+
64
+ # Create a local file-based IPS repository
65
+ task :createrepo do
66
+ check_tool('pkgrepo')
67
+ sh "pkgrepo create #{repo}"
68
+ sh "pkgrepo set -s #{repo} publisher/prefix=puppetlabs.com"
69
+ end
70
+
71
+ # Send a created package to the local IPS repository
72
+ task :send do
73
+ check_tool('pkgsend')
74
+ sh "pkgsend -s #{repouri} publish -d #{proto} --fmri-in-manifest #{workdir}/#{@name}.p5m"
75
+ end
76
+
77
+ # Retrieve the package from the remote repository in .p5p archive format
78
+ task :receive do
79
+ check_tool('pkgrecv')
80
+ sh "pkgrecv -s #{repouri} -a -d #{artifact} #{@name}@#{@ipsversion}"
56
81
  end
57
82
 
58
- task :package => :lint do
59
- x %[rm -rf #{pkgs}]
60
- x %[mkdir -p #{pkgs}]
61
- x %[pkgrepo create #{repo}]
62
- x %[pkgrepo set -s #{repo} publisher/prefix=puppetlabs.com]
63
- x %[pkgsend -s #{repouri} publish -d #{proto} --fmri-in-manifest #{workdir}/#{@name}.p5m]
64
- x %[rm -f #{artifact}]
65
- x %[pkgrecv -s #{repouri} -a -d #{artifact} #{@name}@#{@ipsversion}]
66
- end
67
83
 
68
84
  task :dry_install do
69
- x %[pkg install -nv -g #{artifact} #{@name}@#{@ipsversion}]
85
+ sh "pkg install -nv -g #{artifact} #{@name}@#{@ipsversion}"
70
86
  end
71
- end
72
87
 
73
- desc "Creates an ips version"
74
- task :ips do
75
- Rake::Task['package:ips:prepare'].invoke
76
- Rake::Task['package:ips:package'].invoke
88
+ task :p5p, :sign_ips do |t, args|
89
+ # make sure our system dependencies are met
90
+ check_tool('pkg')
91
+ check_tool('pkgdepend')
92
+ check_tool('pkgsend')
93
+ check_tool('pkglint')
94
+ check_tool('pkgmogrify')
95
+ sign_ips = args.sign_ips
96
+ # create the package manifest & files (the "package")
97
+ Rake::Task['package:ips:package'].invoke
98
+ # create the local repository
99
+ Rake::Task['package:ips:createrepo'].invoke
100
+ # publish the package to the repository
101
+ Rake::Task['package:ips:send'].invoke
102
+ # signing the package occurs remotely in the repository
103
+ Rake::Task['pl:sign_ips'].invoke(repouri,"#{@name}@#{@ipsversion}") if sign_ips
104
+ # retrieve the signed package in a .p5p archive file format
105
+ Rake::Task['package:ips:receive'].invoke
106
+ # clean up the workdir area
107
+ Rake::Task['package:ips:clean'].execute
108
+ STDOUT.puts "Created #{Dir['pkg/ips/pkgs/*']}"
109
+ end
77
110
  end
78
111
 
112
+ desc "Creates an ips p5p archive package from this repository"
113
+ task :ips => ['package:ips:p5p']
114
+ end
115
+
116
+ namespace :pl do
117
+ desc "Create and sign a p5p archive package from this repository"
118
+ task :ips => ['pl:fetch', 'pl:load_extras'] do
119
+ Rake::Task['package:ips:p5p'].reenable
120
+ Rake::Task['package:ips:p5p'].invoke(TRUE)
121
+ end
79
122
  end
80
123
  end
@@ -1,3 +1,22 @@
1
+ # The mock methods/tasks are fairly specific to puppetlabs infrastructure, e.g., the mock configs
2
+ # have to be named in a format like the PL mocks, e.g. dist-version-architecture, such as:
3
+ # el-5-i386
4
+ # fedora-17-i386
5
+ # as well as the oddly formatted exception, 'pl-5-i386' which is the default puppetlabs FOSS mock
6
+ # format for 'el-5-i386' (note swap 'pl' for 'el')
7
+ #
8
+ # The mock-built rpms are placed in a directory structure under 'pkg' based on how the Puppet Labs
9
+ # repo structure is laid out in order to facilitate easy shipping from the local repository to the
10
+ # Puppet Labs repos. For open source, the directory structure mirrors that of yum.puppetlabs.com:
11
+ # pkg/<dist>/<version>/{products,devel,dependencies}/<arch>/*.rpm
12
+ # e.g.,
13
+ # pkg/el/5/products/i386/*.rpm
14
+ # pkg/fedora/f15/products/i386/*.rpm
15
+ #
16
+ # For PE, the directory structure is flatter:
17
+ # pkg/<dist>-<version>-<arch>/*.rpm
18
+ # e.g.,
19
+ # pkg/el-5-i386/*.rpm
1
20
 
2
21
  def mock(mock_config, srpm)
3
22
  check_tool('mock')
@@ -1,3 +1,8 @@
1
+ # For PE, the natural default tasks are the remote tasks, rather than
2
+ # the local ones, in reflection of which will be most ideal for PE devs.
3
+ # e.g., pe:local_deb is the task to build a deb on the local host,
4
+ # while pe:deb is the task for building on the remote builder host
5
+
1
6
  if @build_pe
2
7
  namespace :pe do
3
8
  desc "Create a PE deb from this repo using the default cow #{@default_cow}."
@@ -1,3 +1,8 @@
1
+ # For PE, the natural default tasks are the remote tasks, rather than
2
+ # the local ones, in reflection of which will be most ideal for PE devs.
3
+ # e.g., pe:local_deb is the task to build a deb on the local host,
4
+ # while pe:deb is the task for building on the remote builder host
5
+
1
6
  if @build_pe
2
7
  namespace :pe do
3
8
  desc "Execute remote debian build using default cow on builder and retrieve package"
@@ -2,8 +2,12 @@ if @build_pe
2
2
  namespace :pe do
3
3
  desc "ship PE rpms to #{@yum_host}"
4
4
  task :ship_rpms => ["pl:load_extras"] do
5
- rsync_to('pkg/pe/rpm/', @yum_host, "#{@yum_repo_path}/#{@pe_version}/repos/")
6
- Rake::Task["pe:remote_update_yum_repo"].invoke
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
+ else
8
+ rsync_to('pkg/pe/rpm/', @yum_host, "#{@yum_repo_path}/#{@pe_version}/repos/")
9
+ Rake::Task["pe:remote_update_yum_repo"].invoke
10
+ end
7
11
  end
8
12
 
9
13
  desc "Update remote rpm repodata for PE on #{@yum_host}"
@@ -14,14 +18,17 @@ if @build_pe
14
18
  desc "Ship PE debs to #{@apt_host}"
15
19
  task :ship_debs => "pl:load_extras" do
16
20
  dist = @default_cow.split('-')[1]
17
- if Dir["pkg/pe/deb/#{dist}/*"].empty?
18
- STDERR.puts "The pkg/pe/deb/#{dist} directory has no packages. Did you run rake pe:deb?"
21
+ if empty_dir?("pkg/pe/deb/#{dist}")
22
+ STDERR.puts "The 'pkg/pe/deb/#{dist}' directory has no packages. Did you run rake pe:deb?"
19
23
  else
20
24
  rsync_to("pkg/pe/deb/#{dist}/", @apt_host, "#{@apt_repo_path}/#{@pe_version}/repos/incoming/unified/")
21
25
  Rake::Task["pe:remote_freight"].invoke
22
26
  end
23
27
  end
24
28
 
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
25
32
  desc "remote freight PE packages to #{@apt_host}"
26
33
  task :remote_freight => "pl:load_extras" do
27
34
  remote_ssh_cmd(@apt_host, "sudo pe-the-things #{@pe_version} #{@apt_repo_path} #{@freight_conf}")
@@ -66,8 +66,12 @@ namespace :pl do
66
66
  Rake::Task["pl:ship_dmg"].execute
67
67
  end
68
68
  end if @build_dmg
69
+
70
+ desc "Release ips, e.g. pl:ips, pl:ship_ips"
71
+ task :release_ips => ['pl:fetch', 'pl:load_extras'] do
72
+ Rake::Task['pl:ips'].invoke
73
+ Rake::Task['pl:ship_ips'].invoke
74
+ end
69
75
  end
70
76
  end
71
77
 
72
-
73
-
@@ -1,11 +1,13 @@
1
1
  # Tasks for remote building on builder hosts
2
+
2
3
  if File.exist?("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
3
4
  namespace 'pl' do
4
- task :remote_build, :host, :treeish, :task do |t, args|
5
+ task :remote_build, :host, :treeish, :task, :tar do |t, args|
5
6
  host = args.host
6
7
  treeish = args.treeish
7
8
  task = args.task
8
- remote_repo = remote_bootstrap(host, treeish)
9
+ tar = args.tar
10
+ remote_repo = remote_bootstrap(host, treeish, tar)
9
11
  STDOUT.puts "Beginning package build on #{host}"
10
12
  remote_ssh_cmd(host, "cd #{remote_repo} ; rake #{task} ANSWER_OVERRIDE=no")
11
13
  rsync_from("#{remote_repo}/pkg/", host, 'pkg/')
@@ -16,27 +18,57 @@ if File.exist?("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
16
18
  desc "Execute release_deb_rc full build set on remote debian build host"
17
19
  task :remote_deb_rc => ['pl:fetch', 'pl:load_extras'] do
18
20
  Rake::Task["pl:remote_build"].reenable
19
- Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:release_deb_rc")
21
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:release_deb_rc COW='#{@cows}'")
22
+ end
23
+
24
+ desc "Execute deb_all_rc build on remote debian build host (no signing)"
25
+ task :remote_deb_rc_build => ['pl:fetch', 'pl:load_extras'] do
26
+ Rake::Task["pl:remote_build"].reenable
27
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:deb_all_rc COW='#{@cows}'")
20
28
  end
21
29
 
22
30
  desc "Execute release_deb_final full build set on remote debian build host"
23
31
  task :remote_deb_final => ['pl:fetch', 'pl:load_extras'] do
24
32
  Rake::Task["pl:remote_build"].reenable
25
- Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:release_deb_final")
33
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:release_deb_final COW='#{@cows}'")
34
+ end
35
+
36
+ desc "Execute deb_all on remote debian build host (no signing)"
37
+ task :remote_deb_final_build => ['pl:fetch', 'pl:load_extras'] do
38
+ Rake::Task["pl:remote_build"].reenable
39
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pl:deb_all COW='#{@cows}'")
26
40
  end
27
41
 
28
42
  desc "Execute release_rpm_rc full build set on remote rpm build host"
29
43
  task :remote_rpm_rc => ['pl:fetch', 'pl:load_extras'] do
30
44
  Rake::Task["pl:remote_build"].reenable
31
- Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:release_rpm_rc")
45
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:release_rpm_rc MOCK='#{@rc_mocks}'")
32
46
  end
33
47
 
34
- desc "Execute release_deb_final full build set on remote rpm build host"
48
+ desc "Execute mock_rc on remote rpm build host (no signing)"
49
+ task :remote_rpm_rc_build => ['pl:fetch', 'pl:load_extras'] do
50
+ Rake::Task["pl:remote_build"].reenable
51
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:mock_rc MOCK='#{@rc_mocks}'")
52
+ end
53
+
54
+ desc "Execute release_rpm_final full build set on remote rpm build host"
35
55
  task :remote_rpm_final => ['pl:fetch', 'pl:load_extras'] do
36
56
  Rake::Task["pl:remote_build"].reenable
37
- Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:release_rpm_final")
57
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:release_rpm_final MOCK='#{@final_mocks}'")
58
+ end
59
+
60
+ desc "Execute mock_final on remote rpm build host (no signing)"
61
+ task :remote_mock_final => ['pl:fetch', 'pl:load_extras'] do
62
+ Rake::Task["pl:remote_build"].reenable
63
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pl:mock_final MOCK='#{@final_mocks}'")
38
64
  end
39
65
 
66
+ desc "Execute pl:ips on remote ips build host"
67
+ task :remote_ips => ['pl:fetch', 'pl:load_extras'] do
68
+ Rake::Task["pl:remote_build"].reenable
69
+ Rake::Task["pl:remote_build"].invoke(@ips_build_host, 'HEAD', 'pl:ips', 'gtar')
70
+ end if @build_ips
71
+
40
72
  desc "Execute package:apple on remote apple build host"
41
73
  task :remote_dmg => ['pl:fetch', 'pl:load_extras'] do
42
74
  # Because we use rvmsudo for apple, we end up replicating the :remote_build task
@@ -61,6 +93,7 @@ if File.exist?("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
61
93
  Rake::Task["pl:sign_tar"].invoke
62
94
  Rake::Task["pl:uber_ship"].execute
63
95
  Rake::Task["pl:remote_freight_devel"].invoke
96
+ Rake::Task["pl:remote_update_yum_repo"].invoke
64
97
  end
65
98
 
66
99
  desc "UBER FINAL build: build and ship FINAL tar, gem (as applicable), remote dmg, remote deb, remote rpm"
@@ -73,6 +106,7 @@ if File.exist?("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
73
106
  Rake::Task["pl:sign_tar"].invoke
74
107
  Rake::Task["pl:uber_ship"].execute
75
108
  Rake::Task["pl:remote_freight_final"].invoke
109
+ Rake::Task["pl:remote_update_yum_repo"].invoke
76
110
  end
77
111
  end
78
112
  end
@@ -7,7 +7,10 @@ def build_rpm(buildarg = "-bs")
7
7
  --define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
8
8
  --define "_default_patch_fuzz 2"'
9
9
  args = rpm_define + ' ' + rpm_old_version
10
- mkdir_pr temp, 'pkg/rpm', 'pkg/srpm', "#{temp}/SOURCES", "#{temp}/SPECS"
10
+ mkdir_pr temp, 'pkg/srpm', "#{temp}/SOURCES", "#{temp}/SPECS"
11
+ if buildarg == '-ba'
12
+ mkdir_p 'pkg/rpm'
13
+ end
11
14
  if @sign_tar
12
15
  Rake::Task["pl:sign_tar"].invoke
13
16
  cp_p "pkg/#{@name}-#{@version}.tar.gz.asc", "#{temp}/SOURCES"
@@ -16,7 +19,9 @@ def build_rpm(buildarg = "-bs")
16
19
  erb "ext/redhat/#{@name}.spec.erb", "#{temp}/SPECS/#{@name}.spec"
17
20
  sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@name}.spec"
18
21
  mv FileList["#{temp}/SRPMS/*.rpm"], "pkg/srpm"
19
- mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
22
+ if buildarg == '-ba'
23
+ mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
24
+ end
20
25
  rm_rf temp
21
26
  puts
22
27
  output = FileList['pkg/*/*.rpm']
@@ -18,6 +18,8 @@ namespace :pl do
18
18
  rsync_to('pkg/deb/', @apt_host, @apt_repo_path)
19
19
  end
20
20
 
21
+ # These hacky bits execute a pre-existing rake task on the @apt_host that adds the debs
22
+ # shipped with the ship task to the apt repo and updates the repo metadata
21
23
  desc "freight RCs to devel repos on #{@apt_host}"
22
24
  task :remote_freight_devel do
23
25
  STDOUT.puts "Really run remote freight RC command on #{@apt_host}? [y,n]"
@@ -29,6 +31,8 @@ namespace :pl do
29
31
  end
30
32
  end
31
33
 
34
+ # These similar hacky bits execute the same pre-existing rake task on the @apt_host, but
35
+ # with a different argument
32
36
  desc "remote freight final packages to PRODUCTION repos on #{@apt_host}"
33
37
  task :remote_freight_final do
34
38
  STDOUT.puts "Really run remote freight final command on #{@apt_host}? [y,n]"
@@ -40,12 +44,23 @@ namespace :pl do
40
44
 
41
45
  desc "Update remote ips repository on #{@ips_host}"
42
46
  task :update_ips_repo do
43
- rsync_to('pkg/ips/pkgs', @ips_host, @ips_store)
47
+ rsync_to('pkg/ips/pkgs/', @ips_host, @ips_store)
44
48
  remote_ssh_cmd(@ips_host, "pkgrecv -s #{@ips_store}/pkgs/#{@name}@#{@ipsversion}.p5p -d #{@ips_repo} \\*")
45
49
  remote_ssh_cmd(@ips_host, "pkgrepo refresh -s #{@ips_repo}")
46
50
  remote_ssh_cmd(@ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
47
51
  end if @build_ips
48
52
 
53
+ if File.exist?("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
54
+ desc "Upload ips p5p packages to downloads"
55
+ task :ship_ips => [ 'pl:fetch', 'pl:load_extras' ] 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/', @ips_package_host, @ips_path)
60
+ end
61
+ end if @build_ips
62
+ end
63
+
49
64
  desc "Ship built gem to rubygems"
50
65
  task :ship_gem do
51
66
  ship_gem("pkg/#{@name}-#{@gemversion}.gem")
@@ -16,10 +16,12 @@ def sign_deb_changes(file)
16
16
  end
17
17
 
18
18
  # requires atleast a self signed prvate key and certificate pair
19
- def sign_ips(pkg)
20
- %x{pkgsign -s pkg/ips/repo/ -k #{@privatekey_pem} -c #{@certificate_pem} #{@name}@#{@ipsversion}}
21
- %x{rm -f #{pkg}}
22
- %x{pkgrecv -s pkg/ips/repo -a -d #{pkg} #{@name}@#{@ipsversion}}
19
+ # fmri is the full IPS package name with version, e.g.
20
+ # facter@facter@1.6.15,5.11-0:20121112T042120Z
21
+ # technically this can be any ips-compliant package identifier, e.g. application/facter
22
+ # repo_uri is the path to the repo currently containing the package
23
+ def sign_ips(fmri, repo_uri)
24
+ %x{pkgsign -s #{repo_uri} -k #{@privatekey_pem} -c #{@certificate_pem} -i #{@ips_inter_cert} #{fmri}}
23
25
  end
24
26
 
25
27
  namespace :pl do
@@ -49,10 +51,11 @@ namespace :pl do
49
51
  end
50
52
 
51
53
  desc "Sign ips package, Defaults to PL Key, pass KEY to override"
52
- task :sign_ips do
53
- ips_pkgs = Dir["pkg/ips/pkgs/*.p5p"].join(' ')
54
+ task :sign_ips, :repo_uri, :fmri do |t, args|
55
+ repo_uri = args.repo_uri
56
+ fmri = args.fmri
54
57
  puts "Signing ips packages..."
55
- sign_ips ips_pkgs
58
+ sign_ips(fmri, repo_uri)
56
59
  end if @build_ips
57
60
 
58
61
  desc "Check if all rpms are signed"
@@ -1,11 +1,26 @@
1
+ # This is something of a work in progress. Unfortunately,
2
+ # many of the projects that use the packaging repo carry
3
+ # version files with hard-coded versions, and many of these
4
+ # are in completely disparate formats.
5
+ #
6
+ # This task attempts to automate the updating of this file
7
+ # with the version to be packaged, but given the many version
8
+ # file formats in use, doing so cleanly is difficult. With
9
+ # any luck, going forward some of these projects will move
10
+ # away from maintaining hard-coded versions in source.
11
+ # However, if this effort loses momentum, we may end up
12
+ # revisiting this task and improving it substantially,
13
+ # and/or standardizing the expected version file format.
1
14
  namespace :package do
2
15
  desc "Update the version in #{@version_file} to current and commit."
3
16
  task :versionbump do
17
+ version = ENV['VERSION'] || @version.to_s.strip
4
18
  old_version = get_version_file_version
5
19
  contents = IO.read(@version_file)
6
- new_version = '"' + @version.to_s.strip + '"'
20
+ new_version = '"' + version + '"'
21
+ puts "Updating #{old_version} to #{new_version} in #{@version_file}"
7
22
  if contents.match("@DEVELOPMENT_VERSION@")
8
- contents.gsub!("@DEVELOPMENT_VERSION@", @version.to_s.strip)
23
+ contents.gsub!("@DEVELOPMENT_VERSION@", version)
9
24
  elsif contents.match("VERSION = #{old_version}")
10
25
  contents.gsub!("VERSION = #{old_version}", "VERSION = #{new_version}")
11
26
  elsif contents.match("#{@name.upcase}VERSION = #{old_version}")
@@ -17,5 +32,12 @@ namespace :package do
17
32
  file.write contents
18
33
  file.close
19
34
  end
35
+
36
+ desc "Set and commit the version in #{@version_file}, requires VERSION."
37
+ task :versionset do
38
+ check_var('VERSION', ENV['VERSION'])
39
+ Rake::Task["package:versionbump"].invoke
40
+ git_commit_file(@version_file, "update to #{ENV['VERSION']}")
41
+ end
20
42
  end
21
43
 
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
  #
8
8
  module Puppet
9
- PUPPETVERSION = '2.7.20-rc1'
9
+ PUPPETVERSION = '2.7.20'
10
10
 
11
11
  def self.version
12
12
  @puppet_version || PUPPETVERSION
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.20.rc1
5
- prerelease: 7
4
+ version: 2.7.20
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Puppet Labs
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-10 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter
@@ -1972,9 +1972,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1972
1972
  required_rubygems_version: !ruby/object:Gem::Requirement
1973
1973
  none: false
1974
1974
  requirements:
1975
- - - ! '>'
1975
+ - - ! '>='
1976
1976
  - !ruby/object:Gem::Version
1977
- version: 1.3.1
1977
+ version: '0'
1978
1978
  requirements: []
1979
1979
  rubyforge_project: puppet
1980
1980
  rubygems_version: 1.8.24