[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:20:45 UTC 2009


The following commit has been merged in the master branch:
commit fecdfbc9ac3d99ff76674f9093fc07830776a32f
Author: James Turnbull <james at lovedthanlost.net>
Date:   Fri Aug 1 11:16:24 2008 +1000

    A working script to create an OS X pkg out of the Puppet repository

diff --git a/CHANGELOG b/CHANGELOG
index 05c6021..b7d83ca 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,34 @@
 0.24.x
-    Added feature #1241 : Improve performance of group lookups
+    A working script to create an OS X pkg out of the Puppet repository
 
-    Fixed bug #1448: Puppet CA incorrectly writes out all certs to inventory .txt on each certificate signing
+    Fixed #1441 - Updated console colours
 
-    Fixing puppetlast to make it work with 0.24.5 / 0.25
+    Expose all puppet variables as instance member variables of the template wrapper.
+    This helps resolve redmine #1427, by providing a safe mechanism to access variables.
+    
+     * Implement Puppet::Parser::Scope#to_hash, which returns a hash containing all the
+       variable bindings in the current and, optionally, parent scope.
+     * Use that to set instance member variables into Puppet::Parser::Templatewrapper
+     * Report the time taken for variable binding at debug level, to help identify any
+       performance regression that is encountered in the real world.
+     * Rename the @scope and @file members of the template wrapper, to avoid clashing
+       with a scope variable exposed within puppet.
+
+    Ensure that we consistently use either string #{} interpolation or String.%
+    interpolation, not both, to avoid issues where a #{} interpolated value
+    contains a % character.
+
+    Feature #1476: Allow specification of --bindir --sbindir --sitelibdir --mandir --destdir 
+    in installation
     
+    Added feature #1241 : Improve performance of group lookups
+
+    Fixed bug #1448: Puppet CA incorrectly writes out all certs to inventory .txt on each 
+    certificate signing
+
+    Fixing puppetlast to make it work with 0.24.5 / 0.25.  Made puppetlast work on 0.24.5 
+    by using the YAML indirector
+ 
 0.24.5
     You can now select the encoding format when transferring the catalog,
     with 'yaml' still being the default but 'marshal' being an option.
diff --git a/conf/osx/PackageInfo.plist b/conf/osx/PackageInfo.plist
new file mode 100644
index 0000000..e8a4e6f
--- /dev/null
+++ b/conf/osx/PackageInfo.plist
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleIdentifier</key>
+	<string>com.reductivelabs.puppet</string>
+	<key>CFBundleShortVersionString</key>
+	<string>{SHORTVERSION}</string>
+	<key>IFMajorVersion</key>
+	<integer>{MAJORVERSION}</integer>
+	<key>IFMinorVersion</key>
+	<integer>{MINORVERSION}</integer>
+	<key>IFPkgFlagAllowBackRev</key>
+	<false/>
+	<key>IFPkgFlagAuthorizationAction</key>
+	<string>RootAuthorization</string>
+	<key>IFPkgFlagDefaultLocation</key>
+	<string>/</string>
+	<key>IFPkgFlagFollowLinks</key>
+	<true/>
+	<key>IFPkgFlagInstallFat</key>
+	<false/>
+	<key>IFPkgFlagIsRequired</key>
+	<false/>
+	<key>IFPkgFlagOverwritePermissions</key>
+	<true/>
+	<key>IFPkgFlagRelocatable</key>
+	<false/>
+	<key>IFPkgFlagRestartAction</key>
+	<string>None</string>
+	<key>IFPkgFlagRootVolumeOnly</key>
+	<true/>
+	<key>IFPkgFlagUpdateInstalledLanguages</key>
+	<false/>
+</dict>
+</plist>
diff --git a/conf/osx/createpackage.sh b/conf/osx/createpackage.sh
new file mode 100755
index 0000000..3ac4d09
--- /dev/null
+++ b/conf/osx/createpackage.sh
@@ -0,0 +1,167 @@
+#!/bin/bash
+#
+# Script to build an "old style" not flat pkg out of the puppet repository.
+#
+# Author: Nigel Kersten (nigelk at google.com)
+#
+# Last Updated: 2008-07-31
+#
+# Copyright 2008 Google Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+
+INSTALLRB="install.rb"
+BINDIR="/usr/bin"
+SITELIBDIR="/usr/lib/ruby/site_ruby/1.8"
+PACKAGEMAKER="/Developer/usr/bin/packagemaker"
+PROTO_PLIST="PackageInfo.plist"
+PREFLIGHT="preflight"
+
+
+function find_installer() {
+  # we walk up three directories to make this executable from the root, 
+  # root/conf or root/conf/osx
+  if [ -f "./${INSTALLRB}" ]; then
+    installer="$(pwd)/${INSTALLRB}"
+  elif [ -f "../${INSTALLRB}" ]; then
+    installer="$(pwd)/../${INSTALLRB}"
+  elif [ -f "../../${INSTALLRB}" ]; then
+    installer="$(pwd)/../${INSTALLRB}"
+  else
+    installer=""
+  fi
+}
+
+function find_puppet_root() {
+  puppet_root=$(dirname "${installer}")
+}
+
+function install_puppet() {
+  echo "Installing Puppet to ${pkgroot}"
+  "${installer}" --destdir="${pkgroot}" --bindir="${BINDIR}" --sitelibdir="${SITELIBDIR}" &> /dev/null
+  chown -R root:admin "${pkgroot}"
+}
+
+function get_puppet_version() {
+  puppet_version=$(RUBYLIB="${pkgroot}/${SITELIBDIR}:${RUBYLIB}" ruby -e "require 'puppet'; puts Puppet.version")
+}
+
+function prepare_package() {
+  # As we can't specify to follow symlinks from the command line, we have
+  # to go through the hassle of creating an Info.plist file for packagemaker
+  # to look at for package creation and substitue the version strings out.
+  # Major/Minor versions can only be integers, so we have "0" and "245" for
+  # puppet version 0.24.5
+  # Note too that for 10.5 compatibility this Info.plist *must* be set to 
+  # follow symlinks.
+  VER1=$(echo ${puppet_version} | awk -F "." '{print $1}')
+  VER2=$(echo ${puppet_version} | awk -F "." '{print $2}')
+  VER3=$(echo ${puppet_version} | awk -F "." '{print $3}')
+  major_version="${VER1}"
+  minor_version="${VER2}${VER3}"
+  cp "${puppet_root}/conf/osx/${PROTO_PLIST}" "${pkgtemp}"
+  sed -i '' "s/{SHORTVERSION}/${puppet_version}/g" "${pkgtemp}/${PROTO_PLIST}"
+  sed -i '' "s/{MAJORVERSION}/${major_version}/g" "${pkgtemp}/${PROTO_PLIST}"
+  sed -i '' "s/{MINORVERSION}/${minor_version}/g" "${pkgtemp}/${PROTO_PLIST}"
+  
+  # We need to create a preflight script to remove traces of previous
+  # puppet installs due to limitations in Apple's pkg format.
+  mkdir "${pkgtemp}/scripts"
+  cp "${puppet_root}/conf/osx/${PREFLIGHT}" "${pkgtemp}/scripts"
+  
+  # substitute in the sitelibdir specified above on the assumption that this
+  # is where any previous puppet install exists that should be cleaned out.
+  sed -i '' "s|{SITELIBDIR}|${SITELIBDIR}|g" "${pkgtemp}/scripts/${PREFLIGHT}"
+  chmod 0755 "${pkgtemp}/scripts/${PREFLIGHT}"
+}
+
+function create_package() {
+  rm -fr "$(pwd)/puppet-${puppet_version}.pkg"
+  echo "Building package"
+  echo "Note that packagemaker is reknowned for spurious errors. Don't panic."
+  "${PACKAGEMAKER}" --root "${pkgroot}" \
+                    --info "${pkgtemp}/${PROTO_PLIST}" \
+                    --scripts ${pkgtemp}/scripts \
+                    --out "$(pwd)/puppet-${puppet_version}.pkg"
+  if [ $? -ne 0 ]; then
+    echo "There was a problem building the package."
+    cleanup_and_exit 1
+    exit 1
+  else
+    echo "The package has been built at:"
+    echo "$(pwd)/puppet-${puppet_version}.pkg"
+  fi
+}
+
+function cleanup_and_exit() {
+  if [ -d "${pkgroot}" ]; then
+    rm -fr "${pkgroot}"
+  fi
+  if [ -d "${pkgtemp}" ]; then
+    rm -fr "${pkgtemp}"
+  fi
+  exit $1
+}
+
+# Program entry point
+function main() {
+
+  if [ $(whoami) != "root" ]; then
+    echo "This script needs to be run as root via su or sudo."
+    cleanup_and_exit 1
+  fi
+
+  find_installer
+  
+  if [ ! "${installer}" ]; then
+    echo "Unable to find ${INSTALLRB}"
+    cleanup_and_exit 1
+  fi
+
+  find_puppet_root
+  
+  if [ ! "${puppet_root}" ]; then
+    echo "Unable to find puppet repository root."
+    cleanup_and_exit 1
+  fi
+  
+  pkgroot=$(mktemp -d -t puppetpkg)
+  
+  if [ ! "${pkgroot}" ]; then
+    echo "Unable to create temporary package root."
+    cleanup_and_exit 1
+  fi
+  
+  pkgtemp=$(mktemp -d -t puppettmp)
+  
+  if [ ! "${pkgtemp}" ]; then
+    echo "Unable to create temporary package root."
+    cleanup_and_exit 1
+  fi
+  
+  install_puppet
+  get_puppet_version
+  
+  if [ ! "${puppet_version}" ]; then
+    echo "Unable to retrieve puppet version"
+    cleanup_and_exit 1
+  fi
+  
+  prepare_package
+  create_package
+  
+  cleanup_and_exit 0
+}
+
+main "$@"
diff --git a/conf/osx/preflight b/conf/osx/preflight
new file mode 100755
index 0000000..57ebcb6
--- /dev/null
+++ b/conf/osx/preflight
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# Make sure that old puppet cruft is removed
+# This also allows us to downgrade puppet as
+# it's more likely that installing old versions
+# over new will cause issues.
+#
+# ${3} is the destination volume so that this works correctly
+# when being installed to volumes other than the current OS.
+
+rm -Rf "${3}{SITELIBDIR}/puppet*"

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list