Permalink
Browse files

Fixup script to auto-build planemo bioconda recipe.

  • Loading branch information...
jmchilton committed Oct 4, 2016
1 parent c0c66c7 commit f0da66f9f130bc9700f7989a74bac0eabc8d3015
Showing with 49 additions and 16 deletions.
  1. +49 −16 scripts/update_bioconda.bash
@@ -2,24 +2,57 @@

set -e

BIOCONDA_PROJECT="jmchilton/bioconda-recipes"
RECIPE="recipes/planemo"
VERSION=`python -c "import xmlrpclib; print xmlrpclib.ServerProxy('https://pypi.python.org/pypi').package_releases('planemo')[0]"`
URL=`python -c "import xmlrpclib; import re; print re.escape([s for s in xmlrpclib.ServerProxy('https://pypi.python.org/pypi').release_urls('planemo', '$VERSION') if s['filename'].endswith('.tar.gz')][0]['url'])"`
MD5SUM=`md5sum dist/planemo-$VERSION.tar.gz | cut -d' ' -f1`
PACKAGE="planemo"
CONDA_RECIPES="bioconda-recipes"
UPSTREAM="bioconda"

if [ ! -d bioconda ];
HUB_EXEC=${HUB_EXEC:-`which hub | echo ''`}
if [ -z "$HUB_EXEC" ];
then
git clone git@github.com:$BIOCONDA_PROJECT.git bioconda-recipes
HUB_EXEC="./hub/hub"
fi
cd bioconda-recipes
HUB_EXEC=`python2 -c "import os; print os.path.abspath('$HUB_EXEC')"`
echo "Using hub executable $HUB_EXEC"

sed -E -i "s/^ version: .*$/ version: \"$VERION\"" $RECIPE/meta.yaml
sed -E -i "s/^ url: .*$/ url: $URL/" $RECIPE/meta.yaml
sed -E -i "s/^ md5: .*$/ md5: $MD5SUM/" $RECIPE/meta.yaml
CONDA_EXEC=${CONDA_EXEC:-`which conda | echo ''`}
if [ -z "$CONDA_EXEC" ];
then
CONDA_EXEC=~/miniconda2/bin/conda
fi
CONDA_EXEC=`python2 -c "import os; print os.path.abspath('$CONDA_EXEC')"`

RECIPE="recipes/$PACKAGE"
VERSION=`python2 -c "import xmlrpclib; print xmlrpclib.ServerProxy('https://pypi.python.org/pypi').package_releases('$PACKAGE')[0]"`
URL=`python2 -c "import xmlrpclib; import re; print re.escape([s for s in xmlrpclib.ServerProxy('https://pypi.python.org/pypi').release_urls('$PACKAGE', '$VERSION') if s['filename'].endswith('.tar.gz')][0]['url'])"`
MD5SUM=`md5sum dist/$PACKAGE-$VERSION.tar.gz | cut -d' ' -f1`
GITHUB_USER=`python2 -c "import json; import os.path; print json.loads(open(os.path.expanduser('~/.github.json'), 'r').read())['login']"`
BRANCH="$PACKAGE-$VERSION"

if [ ! -d $CONDA_RECIPES ];
then
$HUB_EXEC clone $UPSTREAM/$CONDA_RECIPES
fi
cd $CONDA_RECIPES
$HUB_EXEC fork | true

git checkout master
git merge --ff-only origin/master

METADATA="$RECIPE/meta.yaml"
OLD_VERSION=`python2 -c "import yaml; print yaml.load(open('$METADATA', 'r').read())['package']['version']"`

OLD_RECIPE="$RECIPE/$OLD_VERSION"
mkdir "$OLD_RECIPE"
find "$RECIPE" -maxdepth 1 -type f | xargs -I {} cp {} "$OLD_RECIPE"

git checkout -b "$BRANCH"

sed -E -i "s/^ version: .*$/ version: \"$VERSION\"/" $METADATA
sed -E -i "s/^ url: .*$/ url: $URL/" $METADATA
sed -E -i "s/^ md5: .*$/ md5: $MD5SUM/" $METADATA

conda build $RECIPE --channel bioconda --channel r
git add
git add $RECIPE/meta.yaml
git commit -m "Rev planemo to version $VERSION"
git push origin master
"$CONDA_EXEC" build "$RECIPE" --channel bioconda --channel r
git add "$RECIPE/meta.yaml"
git add "$OLD_RECIPE"
git commit -m "Update $PACKAGE to version $VERSION"
git push "$GITHUB_USER" "$BRANCH"

0 comments on commit f0da66f

Please sign in to comment.