diff --git a/anaconda_build/build b/anaconda_build/build new file mode 100755 index 0000000..50d6ad6 --- /dev/null +++ b/anaconda_build/build @@ -0,0 +1,26 @@ +#!/bin/env bash + +# make sure conda-forge is on the channels list +conda config --append channels conda-forge + +# handle package specific arguments +function build_args() { + package="$1" + args="" + case $package in + ion-functions/) args="--numpy=1.12" ;; + esac + echo "$args $package" +} + +# loop through and build each package +for d in */; do + echo "---------------------------------" + echo "building $d" + echo "---------------------------------" + conda build $(build_args "$d") || exit +done + +# remove temporary build files +echo "build complete, cleaning up..." +conda build purge diff --git a/anaconda_build/install-local b/anaconda_build/install-local new file mode 100755 index 0000000..b1831de --- /dev/null +++ b/anaconda_build/install-local @@ -0,0 +1,30 @@ +#!/bin/env bash + +# install packages as a bundle into local conda location +# can be used to make sure that packages can be bundled together +# and do not have dependency conflicts + +env_name="ooi_python27_$(date +%Y%m%d)" +status_env_name="ooi_status_$(date +%Y%m%d)" + +# build up a list of packages +# make sure gunicorn is installed +install_packages="gunicorn" +for d in */; do + install_packages="${d%/} $install_packages" +done + +# remvoe ooi-status and create a separate env for that one, +# it uses dependancies that conflict with other packges +install_packages="${install_packages/ooi-status/}" + +# create conda environments and install packages from the local build +echo "creating $env_name" +set -x +conda create -y --copy --use-local --name $env_name $install_packages +set +x + +echo "creating $status_env_name" +set -x +conda create -y --copy --use-local --name $status_env_name ooi-status +set +x diff --git a/anaconda_build/package b/anaconda_build/package new file mode 100755 index 0000000..e6a445b --- /dev/null +++ b/anaconda_build/package @@ -0,0 +1,57 @@ +#!/bin/env bash + +# create a package bundle, run after a build +# to copy in most recently built packages + +tarname="ooi_python_$(date +%Y%m%d)" +build_location="$(conda info --root)/conda-bld" + +# copy in the packages +mkdir $tarname +cp -r "$build_location/linux-64" "$tarname" +cp -r "$build_location/noarch" "$tarname" + +# obtain the list of packages +packages="" +for d in */; do + packages="$packages ${d%/}" +done + +# seperate out ooi-status +# it doesn't play well with the others +packages="${packages/ooi-status}" +# exclude the temporary tar dir +packages="${packages/$tarname}" + +# copy in create utility script +cat > "$tarname/create" << HERE +#!/bin/env bash + +# create new ooi_python and ooi_status environments +# based on the packages in this bundle + +set -x +conda create -n ooi_python -c ./ $packages gunicorn +conda create -n ooi_status -c ./ ooi-status +HERE +chmod +x "$tarname/create" + +# copy in update utility script +cat > "$tarname/update" << HERE +set -x + +# update an existing ooi_python and ooi_status environemnt +# based on the packages in this bundle + +conda update -n ooi_python -c ./ $packages gunicorn +conda update -n ooi_status -c ./ ooi-status +HERE +chmod +x "$tarname/update" + +# tar up the bundle +tar -czf $tarname.tgz $tarname + +# clean up the temporary files +rm -fr $tarname + +