#!/bin/sh

VERSION="2.1"

print_help()
{
    printf "%s\n" "
Usage:
any buildtreenew DATA OBJECTS

    Build given OBJECTS with their dependencies.
    Entire tree of dependencies is calculated, disregarding deployed packages.
"
}

# TODO cheap check for tool correctness, but no entire dump

printf "%s\n" "Calculating dependencies..."
deps="$( lspkg -D "${@}" | tr '\n' ',')"
deps="${deps%,}"

if test -n "${deps}" ; then
    printf "%s\n%s\n" "Building the result:" "${deps}"
    any do "${@}" \
        rdd_list_entry="${deps}"
else
    printf "%s\n" "No result in output of command:
lspkg -D ${@}"
fi
