diff options
| author | Jonathan Bauer | 2013-02-27 17:18:55 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2013-02-27 17:18:55 +0100 |
| commit | fd7d5b81d0e2c193bf5ca678e054c216da03f90c (patch) | |
| tree | 0e742a553c62c064f51a701c6ceed500b8c37a9f /remote/setup_tools | |
| parent | using binutils EVERYWHERE (diff) | |
| parent | Implemented more flexible command line parsing (diff) | |
| download | tm-scripts-fd7d5b81d0e2c193bf5ca678e054c216da03f90c.tar.gz tm-scripts-fd7d5b81d0e2c193bf5ca678e054c216da03f90c.tar.xz tm-scripts-fd7d5b81d0e2c193bf5ca678e054c216da03f90c.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Conflicts:
remote/setup_tools
remote/tools/base/base.build
remote/tools/dbus/dbus.build
Diffstat (limited to 'remote/setup_tools')
| -rwxr-xr-x | remote/setup_tools | 128 |
1 files changed, 75 insertions, 53 deletions
diff --git a/remote/setup_tools b/remote/setup_tools index 0660e2ef..e0c092a4 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -1,10 +1,13 @@ #!/bin/bash -MODULE_DIR=${ROOT_DIR}/remote +MODULE_DIR="${ROOT_DIR}/remote" #Create tools directory if not exists -TOOL_DIR=${MODULE_DIR}/tools -INIT_DIR=${MODULE_DIR}/stage3.2 +TOOL_DIR="${MODULE_DIR}/tools" +INIT_DIR="${MODULE_DIR}/stage3.2" + +# Keep track of processed modules +PROCESSED_MODULES="" initial_checks () { @@ -18,20 +21,26 @@ initial_checks () read_config () { - local TOOL_CONFIG=${TOOL_DIR}/${TOOL}/${TOOL}.conf + unset REQUIRED_BINARIES + unset REQUIRED_LIBRARIES + unset REQUIRED_DIRECTORIES + unset REQUIRED_FILES + unset REQUIRED_MODULES - [ ! -e ${TOOL_CONFIG} ] && perror "Config for '$TOOL' not found." + local TOOL_CONFIG="${TOOL_DIR}/${TOOL}/${TOOL}.conf" - . ${TOOL_CONFIG} + [ ! -e "${TOOL_CONFIG}" ] && perror "Config for '$TOOL' not found." + + . "${TOOL_CONFIG}" || perror "Sourcing '${TOOL_CONFIG}' failed." } read_build () { - local BUILD_SCRIPT=${TOOL_DIR}/${TOOL}/${TOOL}.build + local BUILD_SCRIPT="${TOOL_DIR}/${TOOL}/${TOOL}.build" - [ ! -e ${BUILD_SCRIPT} ] && perror "Build script for specified tool not found." + [ ! -e "${BUILD_SCRIPT}" ] && perror "Build script for specified tool not found." - . ${BUILD_SCRIPT} + . "${BUILD_SCRIPT}" || perror "Sourcing '${BUILD_SCRIPT}' failed." } copyfileswithdependencies () @@ -100,10 +109,6 @@ copyfileswithdependencies () local RET=$? [ "x$RET" != "x0" ] && perror "Could not tar-copy to $INIT_DIR" fi - unset REQUIRED_BINARIES - unset REQUIRED_LIBRARIES - unset REQUIRED_DIRECTORIES - unset REQUIRED_FILES } get_basic_libs () { @@ -139,48 +144,66 @@ generate_stage32 () { fi # now iterate over given tools and copy them - cd ${TOOL_DIR} while (( "$#" )); do - TOOL=$1 - if [ -d ${TOOL} ]; - then - TOOL_STR="[${TOOL}]" - pinfo "## ## Processing module ## ##" - - #[ "x$DEBUG" != "x1" ] \ - # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ - # && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log - # TODO: Make above work with the new logging system (add function to logging.inc to switch logfile) - cd "${TOOL}" - pinfo "## Reading config" - read_config - pinfo "## Reading build" - read_build - pinfo "## Installing dependencies" - install_dependencies - pinfo "## Fetching source" - fetch_source - pinfo "## Building" - build - # remove *.la files as they might confuse libtool/linker of other tool packages - find "${TOOL_DIR}/${TOOL}/build" -name '*.la' -exec rm -f {} \; - pinfo "## Copying files with dependencies" - copyfileswithdependencies - pinfo "## Post copy" - post_copy - cd ${TOOL_DIR} - - # reset pipes - #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- - # TODO - pinfo "## ## Module completed ## ##" - TOOL_STR="" - else - perror "Tool directory for '$TOOL' not found." - # maybe make this a warning instead of error? - fi + process_module "$1" shift done + TOOL_STR="" +} + +process_module() { + [ "$#" -ne "1" ] && perror "process_module: want 1 param." + local TOOL="$1" + [[ "$PROCESSED_MODULES" == *"!${TOOL}!"* ]] && return # Already processed this module + PROCESSED_MODULES="${PROCESSED_MODULES}!${TOOL}!" + local TOOL_STR="" + pinfo ">>>>>>>>>>>>>>>>> Processing module [ $TOOL ]" + TOOL_STR="[${TOOL}]" + if [ -d "${TOOL_DIR}/${TOOL}" ]; + then + + #[ "x$DEBUG" != "x1" ] \ + # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ + # && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log + # TODO: Make above work with the new logging system (add function to logging.inc to switch logfile) + cd "${TOOL_DIR}/${TOOL}" || perror "Tool dir '${TOOL_DIR}/${TOOL}' seems to exist, but cd to it failed." + pinfo "## Reading config" + read_config + # Check if this module has a dependency that wasn't built yet: + if [ ! -z "$REQUIRED_MODULES" ]; then + pinfo "$TOOL depends on ${REQUIRED_MODULES}...." + for DEP in $REQUIRED_MODULES; do + #[[ "$DESIRED_MODULES" != *"!${DEP}!"* ]] && perror "$TOOL has dependency $DEP, but $DEP is not in current profile." + process_module "$DEP" + done + # Read old config again, as it got overwritten by the deps + cd "${TOOL_DIR}/${TOOL}" || perror "Tool dir '${TOOL_DIR}/${TOOL}' seems to exist, but cd to it failed (after building deps)." + read_config + pinfo "<<<<<<<<<<<<<<<<< Dependency modules processed, back to module [ $TOOL ]" + fi + pinfo "## Reading build" + read_build + pinfo "## Installing dependencies" + install_dependencies + pinfo "## Fetching source" + fetch_source + pinfo "## Building" + build + # remove *.la files as they might confuse libtool/linker of other tool packages + find "${TOOL_DIR}/${TOOL}/build" -name '*.la' -exec rm -f {} \; + pinfo "## Copying files with dependencies" + copyfileswithdependencies + pinfo "## Post copy" + post_copy + + # reset pipes + #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- + # TODO + pinfo "Module completed." + else + perror "Tool directory for '$TOOL' not found." + # maybe make this a warning instead of error? + fi } clean_tools() { @@ -188,7 +211,6 @@ clean_tools() { #clean all if [ -d ${INIT_DIR} ]; then rm -rf "${INIT_DIR}" || perror "Error deleting $INIT_DIR" - pinfo "Cleaned ${INIT_DIR}" fi for TOOL in $(ls ${TOOL_DIR}); do clean_tool $TOOL |
