diff --git a/build_functions.sh b/build_functions.sh index 8d30c07..15c06e3 100644 --- a/build_functions.sh +++ b/build_functions.sh @@ -209,8 +209,24 @@ build_install () { make install 2>&1 | tee "${LOG}/make-install.log" } +module_capture_prereq () { + # This function returns the module system "prereq" lines + # built from the curently loaded modules listed in `$LOADEDMODULES` + MODULES="${LOADEDMODULES:-}" + for dep in ${MODULES//:/ }; do + if echo "$dep" | grep "Builder" >/dev/null; then + # nothing should ever automatically depend on builder + # so we skip this dependency. + continue; + fi + echo -n "prereq $dep\\n" + done +} + module_install () { AUTOMATIC_BUILD_WARNING=" This file was automatically produced by Builder.\n# Any changes may be overwritten without notice.\n#\n# Please see ${BUILDER_PATH} for details." + + PREREQ_DEPENDS="$(module_capture_prereq)" if [ -r "${PLAN}.module" ]; then module_path="${MODULE_INSTALL_PATH}/${PACKAGE}/${VERSION}/${VARIANT}" #PYTHON_SCRIPTS="$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))")" @@ -221,7 +237,7 @@ module_install () { mkdir -pv "$(dirname "${module_path}")" module="$(cat "${PLAN}.module")" if version_gt $BASH_VERSION 4.4; then - echo "${module@P}" >"${module_path}" + echo -e "${module@P}" >"${module_path}" else # this is a bad substitute for the power of the bash>4.4 notation. echo "${module}" | sed \ @@ -243,6 +259,7 @@ module_install () { -e "s%\${\?TARGET}\?%$TARGET%g" \ -e "s%\${\?BUILD}\?%$BUILD%g" \ -e "s%\${\?LOG}\?%$LOG%g" \ + -e "s%\${\?PREREQ_DEPENDS}\?%$PREREQ_DEPENDS%g" \ -e "s%\${\?VIRTUAL_ENV}\?%${VIRTUAL_ENV:-/}%g" \ -e 's%__NOT_BUILDER_DOLLAR__%$%g' \ > "${module_path}" diff --git a/doc/module-dependencies b/doc/module-dependencies new file mode 100644 index 0000000..5c1143f --- /dev/null +++ b/doc/module-dependencies @@ -0,0 +1,19 @@ +# Module files and Dependencies + +Builder does explicitly not track dependencies between packages, but is designed +to work with what is there. This is necessary to be able to integrate well with +different environments on each machine. What builder can do, however, is to track +which modules where loaded during the build time. It is (for now) assumed that + +* run-time dependencies are at least a sub-set of the build-time dependencies, + so that requiring build-time deps at run-time provides all package requirements, + and +* build-time loaded modules are also available at run-time (not a given, if + packages are built on a head node, but run on a compute node, for example). + +Additional points to note are + +* required modules are different on all systems, so module-names can not be + hard-coded in planfiles or modulefile templates. +* Builder is not designed for cross-compiles. + diff --git a/plans/bats/1.2.1/default b/plans/bats/1.2.1/default new file mode 100644 index 0000000..6eee4c3 --- /dev/null +++ b/plans/bats/1.2.1/default @@ -0,0 +1,31 @@ +# +# This file is part of Builder. +# +# Builder is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Builder is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Builder. If not, see . +# +URL="https://github.com/bats-core/bats-core/archive/v${VERSION}.tar.gz" +MD5SUM="e0efccc6345218d40c39678d1c89e67e" +SHA256SUM="91c49b1fe6f0656c46491929ed728f8dfa9a96df0cce294963e8c6082bff87a2" + +build_prepare() { + log_status ">>> nothing to prepare" +} +build_package() { + log_status ">>> nothing to build" +} +build_install () { + log_status ">>> installing..." + cd "${SOURCE}" + ./install.sh "${TARGET}" 2>&1 | tee "${LOG}/make-install.log" +} diff --git a/plans/bats/1.2.1/default.module b/plans/bats/1.2.1/default.module new file mode 100644 index 0000000..f1769a8 --- /dev/null +++ b/plans/bats/1.2.1/default.module @@ -0,0 +1,23 @@ +#%Module1.0##################################################################### +## +set INSTALLDIR "${TARGET}" + +proc ModulesHelp { } { + puts stderr " + Bats is a TAP-compliant testing framework for Bash. It provides a simple way + to verify that the UNIX programs you write behave as expected. + + A Bats test file is a Bash script with special syntax for defining test + cases. Under the hood, each test case is just a function with a description. + + See https://github.com/bats-core/bats-core#bats-core-bash-automated-testing-system-2018 +" +} + +module-whatis "Bash testing framework (${VERSION})" + +conflict ${PACKAGE} +${PREREQ_DEPENDS} + +prepend-path PATH \$INSTALLDIR/bin +prepend-path MANPATH \$INSTALLDIR/share/man diff --git a/plans/nest-simulator/2.20.0/default.module b/plans/nest-simulator/2.20.0/default.module index c251809..a023fbb 100644 --- a/plans/nest-simulator/2.20.0/default.module +++ b/plans/nest-simulator/2.20.0/default.module @@ -30,6 +30,7 @@ INSTALLDIR: \$INSTALLDIR" module-whatis "NEST spiking neural network simulator, version ${VERSION} (${VARIANT} build)" conflict ${PACKAGE} +${PREREQ_DEPENDS} ################################################################################ # from \$INSTALLDIR/bin/nest_vars.sh