Skip to content

Command to convert tool_dependencies.xml recipes into shell scripts #303

@peterjc

Description

@peterjc

Related to #19 (testing tool_dependencies.xml without a tool shed), I would like to be able to run an install recipe from a tool_dependencies.xml file locally and/or turn it into a simple shell script for the current platform.

(The platform specific actions could be turned into bash if statements if preferred)

This seems to overlap with https://github.com/jmchilton/shed2tap

e.g. https://github.com/peterjc/pico_galaxy/blob/master/tools/effectiveT3/tool_dependencies.xml

<?xml version="1.0"?>
<tool_dependency>
    <package name="effectiveT3" version="1.0.1">
        <install version="1.0">
            <actions>
                <!-- Set environment variable so Python script knows where to look -->
                <action type="set_environment">
                    <environment_variable name="EFFECTIVET3" action="set_to">$INSTALL_DIR</environment_variable>
                </action>
                <!-- Main JAR file -->
                <action type="shell_command">wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_GUI-1.0.1.jar</action>
                <!-- If using action type download_file will need to move the file,
                <action type="move_file"><source>TTSS_GUI-1.0.1.jar</source><destination>$INSTALL_DIR/</destination></action>
                -->
                <!-- Three model JAR files -->
                <action type="make_directory">$INSTALL_DIR/module</action>
                <action type="shell_command">wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_ANIMAL-1.0.1.jar</action>
                <action type="move_file"><source>TTSS_ANIMAL-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action>        
                <action type="shell_command">wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_PLANT-1.0.1.jar</action>
                <action type="move_file"><source>TTSS_PLANT-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action>
                <action type="shell_command">wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_STD-1.0.1.jar</action>
                <action type="move_file"><source>TTSS_STD-1.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action>
                <action type="shell_command">wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_STD-2.0.1.jar</action>
                <action type="move_file"><source>TTSS_STD-2.0.1.jar</source><destination>$INSTALL_DIR/module/</destination></action>
            </actions>
        </install>
        <readme>
Downloads effectiveT3 v1.0.1 and the three models from http://effectors.org/ aka http://effectors.csb.univie.ac.at/
        </readme>
    </package>
</tool_dependency>

Would become something like this (assuming already in install directory as per XML convention):

#!/bin/bash
#House keeping: strict bash mode, etc
set -euo pipefail
export INSTALL_DIR=$PWD
#Start of conversion from XML recipe:
echo "Installing effectiveT3 version 1.0.1"
export EFFECTIVET3=$INSTALL_DIR
wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_GUI-1.0.1.jar
mkdir $INSTALL_DIR/module
wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_ANIMAL-1.0.1.jar
mv TTSS_ANIMAL-1.0.1.jar $INSTALL_DIR/module/
wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_PLANT-1.0.1.jar
mv TTSS_PLANT-1.0.1.jar $INSTALL_DIR/module/
http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_STD-1.0.1.jar
mv TTSS_STD-1.0.1.jar $INSTALL_DIR/module/
wget http://effectors.csb.univie.ac.at/sites/eff/files/others/TTSS_STD-2.0.1.jar
mv TTSS_STD-2.0.1.jar $INSTALL_DIR/module/

I would then be able to run this within TravisCI with the advantages that the install recipe is not repeated (tool_dependencies.xml and .travis.yml) and moreover I would actually be able to test tool_dependencies.xml, e.g. peterjc/pico_galaxy@243311c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions