HomePhorge

Build a Rake task for building Apple Packages
8cca3770ee08Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Build a Rake task for building Apple Packages

The goal is to have our release managers build all Puppet packages
within Rake, and so this commit adds a rake task (apple_package) that
will build a DMG-encapsulated package for OS X and put it into the
pkg/apple directory off of the Puppet Root.

To accomplish this goal, a folder structure is created in
/tmp/puppet/puppet-#{version} that mirrors the structure needed for
Apple's Packagemaker CLI tool to build a package for OS X. Next, the
necessary files are copied from the Puppet source into the structure in
/tmp/puppet/puppet-#{version} and then packagemaker is run
(targeting that folder structure) to build an initial package. Hdiutil
then encapsulates that package into a DMG, and the file is finally
copied into the pkg/apple directory.

Namespace package:apple rake task

To align with the current rake workflow, the action to build an Apple
package should be namespaced under the package action. This commit does
that. Checks have also been added to ensure that the package:apple task
is run as root (which is necessary for OS X) and that the packagemaker
binary is installed (as its necessary for the task). If neither is true,
the task will fail sanely (as opposed to a stack trace).

Use git describe to get Puppet version

Using git describe over Puppet::PUPPETVERSION to get the current
Puppet version allows us to pull in the 'RCx' tag which can be used to
build the package. git describe is split on the hyphen ( - ) to remove
all the additional cruft at the end. Finally, the package minor version
splits on 'rc' since prototype.plist can only contain integers and not
string data.

Install into /usr/lib/ruby/site_ruby

In order to support 10.4 (which will be dropped in 2.8.x), we must
install puppet into /usr/lib/ruby/site_ruby/1.8 as opposed to
/Library/Ruby/Site/1.8. The prototype.plist file we bundle with the
package we create sets the IFPkgFlagFollowLinks key to true, so as long
as the symlink exists the package we build will respect it.

There IS a bug in OS X
(http://openradar.appspot.com/9202152) where the symlink in
/usr/lib/ruby/site_ruby is incorrect PRIOR to the first time the OS is
booted, but the symlink gets fixed at first boot. Users who build a
previously-unbooted-pristine-image of OS X and who also intend to
install Puppet on that image BEFORE it is booted may need to modify
their package to target /Library/Ruby/Site/1.8, however we cannot do
this at this time as OS X 10.4 DOES NOT have a /Library/Ruby/Site/1.8
folder.