-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add shell scripts for building and packaging #38
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. separate |
||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the above line intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
|
||
# 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 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct spelling: 'remove'...'dependencies' ... 'packages'