RobertLuptonTheGood/eups — pull request #7 by mjuric (2014-02-14 20:58:11+00:00)
Title: Further enhancements to EupsPkg

Full docs are in eupspkg.py's docstring.

Most important changes:
* I changed build script sourcing logic. Before, eups would look for ./ups/eupspkg to execute, and would execute the built-in version if none was found. The way to override the default behavior was to create ./ups/eupspkg, have it source the built-in library of functions, apply its own overrides (e.g., change variables or redefine subroutines), and then execute the arguments passed on the command line. That required boilerplate; for example, a typical ./ups/eupspkg looked like:
```
#!/bin/bash
. "$EUPS_DIR/lib/eupspkg.sh"

CONFIGURE_OPTIONS="--prefix=$PREFIX --disable-shared"

"$@"
```
Now, the built-in version will look for and source ./ups/eupspkg.sh, if ./ups/eupspkg is not provided. So instead of fully overriding ./ups/eupspkg, one would create an equivalent eupspkg.sh to be sourced, e.g.:
```
# When 'eupspkg' is run from the product root, this file will be sourced
CONFIGURE_OPTIONS="--prefix=$PREFIX --disable-shared"
```
This does make eupspkg.sh a bit more magic, but not by much. It's still possible to debug a failed build by editing it as necessary, and if one suspects a bug in the built-in eupspkg functions, they themselves can be copied over and edited as needed with:
```
cp $EUPS_DIR/lib/eupspkg.default ups/eupspkg
vi ups/eupspkg ....
```
(that wasn't easy to do previously).

* Other changes requested at the design review in Princeton (see individual commits).

End-to-end test:
```
# create a temporary directory for testing and enter it
mkdir eupstest
cd eupstest
RD="$PWD"

# Install mjuric's EUPS fork with EupsPkg (branch: eupspkg)
mkdir sources
cd sources
git clone https://github.com/mjuric/eups.git
cd eups/
git checkout eupspkg

./configure --prefix="$RD/eups" --with-eups="$RD/stack"
make
make install
cd ../..

source "$RD/eups/bin/setups.sh"
export EUPS_PKGROOT="http://lsst-web.ncsa.illinois.edu/~mjuric/pkgs"

# If you don't have git > v1.8.4, do:
eups distrib install git
setup git

# If you don't have python >= 2.7 with numpy >= 1.5.1 and
# matplotlib >=1.2.0, use Anaconda python distribution by installing
# it manually, or use the LSST-packaged one.
eups distrib install anaconda
setup anaconda

# Install the stack
eups distrib install lsst_distrib

# Now, republish pex_config (and its dependencies) from the
# newly installed stack
mkdir distserver

export EUPSPKG_REPOSITORY_PATH='git://git.lsstcorp.org/LSST/DMS/$PRODUCT.git|git://git.lsstcorp.org/LSST/DMS/devenv/$PRODUCT.git|git://git.lsstcorp.org/LSST/DMS/testdata/$PRODUCT.git|git://git.lsstcorp.org/contrib/eupspkg/$PRODUCT'
export EUPSPKG_SOURCE=git

export EUPS_PKGROOT="$RD/distserver"
eups distrib create \
--server-dir=$RD/distserver -f generic -d eupspkg \
-t current \
lsst_distrib
eups distrib declare --server-dir=$RD/distserver -t current

# Now check that we can install from the new distserver
mkdir -p stack2/ups_db
export EUPS_PATH="$RD/stack2"
eups distrib install lsst_distrib
```