I've re-submitted this patch.  I rebased against 2.6.x because there
was a slight bug in variable expansion and bash was returning "unbound
variable" errors.

This updated patch fixes that issue.

Nigel requested I try and provide a bit more detail regarding the
glaring warning I've included in the script.  Unfortuantely, I just
don't have the bandwidth to debug exactly what I mean by "Strange
things happen" right now.

Is there a way to get this functionality into ext/ without me taking
the time to properly diagnose exactly what's happening when puppet is
installed in site_lib?

I could remove the warning, or rephase it to not be so unspecific and nebulous.

I know this isn't ideal, but it's the best I can do right now.

-Jeff

On Wed, Oct 27, 2010 at 2:46 PM, Jeff McCune <[email protected]> wrote:
> This script helps people quickly test different branches of various
> puppet related projects like facter, puppet-scaffold, puppet-dashboard,
> etc...  It allows the user to simply clone puppet and start running
> different puppet version without installing puppet or any other setup
> costs.
>
> Signed-off-by: Jeff McCune <[email protected]>
> ---
>  ext/envpuppet |   80 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 80 insertions(+), 0 deletions(-)
>  create mode 100755 ext/envpuppet
>
> diff --git a/ext/envpuppet b/ext/envpuppet
> new file mode 100755
> index 0000000..d921a19
> --- /dev/null
> +++ b/ext/envpuppet
> @@ -0,0 +1,80 @@
> +#! /bin/bash
> +#
> +# Jeff McCune <[email protected]>
> +# 2010-10-20
> +#
> +# Copyright (c) 2010, Puppet Labs
> +# License: BSD 3-clause license
> +#
> +# This script provides a simple way to execute puppet and related tools
> +# directly from a git clone of the upstream repositories.  This allows you to
> +# quickly switch branches and test different versions of code without much
> +# friction.
> +#
> +# NOTE: There may be issues if puppet, facter, etc... are already installed
> +# into RUBY's site_ruby directory.  If you run into strange problems, make 
> sure
> +# the correct ruby libraries are being loaded...
> +#
> +# Sample Usage:
> +# =============
> +# cd ~/src
> +# git clone git://github.com/puppetlabs/puppet.git
> +# git clone git://github.com/puppetlabs/facter.git
> +# pushd puppet
> +# git checkout tags/2.6.1
> +# popd
> +# pushd facter
> +# git checkout tags/1.5.8
> +# export ENVPUPPET_BASEDIR=/home/jeff/src
> +# envpuppet puppet --version
> +# 2.6.1
> +# envpuppet facter --version
> +# 1.5.8
> +
> +set -e
> +set -u
> +
> +if test -d puppet -o -d facter; then
> +    echo " WARNING!"
> +    echo "  Strange things happen if puppet or facter are in the"
> +    echo "  current working directory"
> +    echo "  (import errors from ruby are a prime example)"
> +    echo " WARNING!"
> +    echo ""
> +    echo "I suggest changing to ~ or /tmp or something..."
> +    echo ""
> +    echo "Sleeping 2 seconds."
> +    echo ""
> +    sleep 2
> +fi
> +
> +# Set this to where you check out puppet and facter
> +: ${ENVPUPPET_BASEDIR:="${HOME}/src"}
> +
> +# git://github.com/reductivelabs/puppet.git
> +mypath="${ENVPUPPET_BASEDIR}/puppet/sbin:${ENVPUPPET_BASEDIR}/puppet/bin"
> +myrubylib="${ENVPUPPET_BASEDIR}/puppet/lib"
> +
> +# git://github.com/reductivelabs/facter.git
> +mypath="${mypath}:${ENVPUPPET_BASEDIR}/facter/bin"
> +myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/facter/lib"
> +
> +# http://github.com/jamtur01/puppet-scaffold.git
> +mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-scaffold/bin"
> +myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-scaffold/lib"
> +
> +# http://github.com/puppetlabs/puppet-module-tool.git
> +# Also known as "pmt"  Will become "puppet module"
> +mypath="${mypath}:${ENVPUPPET_BASEDIR}/puppet-module-tool/bin"
> +myrubylib="${myrubylib}:${ENVPUPPET_BASEDIR}/puppet-module-tool/lib"
> +
> +# Use the existing environment, if present.
> +# Default to no value to prevent unbound variable issues
> +mypath="${mypath}:${PATH:-}"
> +myrubylib="${myrubylib}:${RUBYLIB:-}"
> +
> +# Trim any trailing colons from the path list.
> +export PATH="${mypath%%:}"
> +export RUBYLIB="${myrubylib%%:}"
> +
> +exec "$@"
> --
> 1.7.0.6
>
>



-- 
Jeff McCune
http://www.puppetlabs.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to