puppetlabs/puppet — pull request #318 by glarizza (2012-01-09 23:32:57+00:00)
Title: 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.

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.