On Fri, Feb 6, 2015 at 1:15 PM, Terje Kvernes <[email protected]> wrote:
> Hi,
>
> I currently have a few minor things I do to fenics-install.sh after 
> downloading it and I thought I’d share.  I’m not sure if these ideas apply to 
> the way fenics-install.sh is supposed to work, but neither patch should 
> change the behaviour of the script if used “normally”.
>
> First I apply the following patch to allow my paths from my current hashdist 
> config to work:
>
> --- fenics-install.sh   2015-02-04 10:45:02.000000000 +0100
> +++ fenics-install.sh.local     2015-02-06 12:53:45.623543000 +0100
> @@ -147,12 +147,17 @@
> PROFILE=default
> PROFILE=$(readlink $PROFILE)
> PROFILE=$(basename $PROFILE)
> +BUILD_STORE=$( grep build_stores: -A1  ~/.hashdist/config.yaml | tail -1 | 
> cut -f2 -d: )
> +if [ "$BUILD_STORE" == "./bld" ]; then
> +    BUILD_STORE="\$HOME/.hashdist/bld/profile"
> +fi
> +
> cat << EOF > $CONFIG_FILE
> # FEniCS configuration file created by fenics-install.sh on $(date)
> # Build type: $BUILD_TYPE
> $FENICS_CHANGESETS
> export PROFILE=$PROFILE
> -export PROFILE_INSTALL_DIR=\$HOME/.hashdist/bld/profile/\$PROFILE
> +export PROFILE_INSTALL_DIR=${BUILD_STORE}/\$PROFILE
> export PATH=\$PROFILE_INSTALL_DIR/bin:\$PATH
> export 
> PYTHONPATH=\$PROFILE_INSTALL_DIR/lib/python2.7/site-packages:\$PYTHONPATH
> export CMAKE_PREFIX_PATH=\$PROFILE_INSTALL_DIR:\$CMAKE_PREFIX_PATH
>
> This gets the PROFILE_INSTALL_DIR correct for me as I alter the build_stores 
> in the config-file for hashdist.  fenlics-install.sh currently assumes that 
> the config file has default values.
>
> I also use a local yam file (called “local.yaml”) as a build spec, and I 
> apply the following patch to use it.  It might be more user friendly to allow 
> this file to reside somewhere outside of the directory that holds 
> fenics-install.sh (like ~), but that’s easy enough to solve.
>
> --- fenics-install.sh   2015-02-04 10:45:02.000000000 +0100
> +++ fenics-install.sh.local     2015-02-06 13:05:59.132022000 +0100
> @@ -3,6 +3,8 @@
> # This script installs FEniCS via HashDist.
> # See README.rst for details.
>
> +ORIGINAL_DIR=$( pwd )
> +
> # Tell script to exit on first error
> trap 'exit' ERR
>
> @@ -88,8 +90,14 @@
>     PROFILE=fenics-deps${PROFILE:6}
> fi
> cd hashstack
> -cp ../fenics-developer-tools/install/profiles/$PROFILE default.yaml
> -echo "Using HashStack profile $PROFILE."
> +# If the user has a local.yaml file already present, use that as the default 
> yaml file.
> +if [ -r "${ORIGINAL_DIR}/local.yaml" ]; then
> +    echo "Using HashStack profile local.yaml"
> +    cp "${ORIGINAL_DIR}/local.yaml" default.yaml
> +else
> +    echo "Using HashStack profile $PROFILE."
> +    cp ../fenics-developer-tools/install/profiles/$PROFILE default.yaml
> +fi
> echo ""
>
> # Use latest changesets from master if development build is requested
>
> I don’t know if these are of any interest to others out there, but it makes 
> my life with the new installer much easier.  It combines the ease of install 
> with the flexibility to modify the build as I see fit and allows me to 
> quickly and easily reproduce my builds with a new installer.

Thanks for the patches. I have applied them with some modifications.
In particular, one can now (in addition to the local.yaml) specify the
profile on the command line:

  fenics-install.sh <profile>

Please let me know if this works as you expected.

Johannes
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to