#!/bin/bash BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" SMAGEFILE="$1" if [ -f /etc/rc.d/init.d/functions ] then source /etc/rc.d/init.d/functions else die "/etc/rc.d/init.d/functions not found" fi if [ -f /etc/mage.rc.global ] then source /etc/mage.rc.global else die "/etc/mage.rc.global not found" fi if [ -f /etc/mage.rc ] then source /etc/mage.rc else die "/etc/mage.rc not found" fi if [ -f ${MLIBDIR}/mage4.functions.sh ] then source ${MLIBDIR}/mage4.functions.sh else die "${MLIBDIR}/mage4.functions.sh not found" fi if [ -f ${MLIBDIR}/smage2.functions.sh ] then source ${MLIBDIR}/smage2.functions.sh else die "${MLIBDIR}/smage2.functions.sh not found" fi # do this at least of all includes to prevent path overwrites env-rebuild source /etc/profile # export default path export PATH="${PATH}:${MLIBDIR}" die() { echo "ERROR: $@" exit 1 } is_split_target_magefile() { local mage="$1" for target_mage in ${MY_SPLIT_TARGET_MAGEFILES} do if [[ ${mage} = ${target_mage} ]] then return 0 fi done return 1 } load_mage_features mage_setup if [[ -z ${SMAGEFILE} ]] then die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" fi if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ] then # be silent FVERBOSE=off \ SILENT=1 \ smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE} else die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found." fi # create build info dir install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME} # save STATE, gets deleted by regen_mage_tree BUILDSERVER_SAVED_STATE="${STATE}" #regen_mage_tree # do this after dep install TARGET_MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}" TARGET_SRC_TARBALL="/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}" if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} then echo -en "Package " echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" echo -e " already installed. try a revup." exit 3 fi if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_OK ] then echo -en "Package " echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" echo -e " already build successfully. try a revup." exit 3 fi #if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED ] #then # echo -en "Package " # echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" # echo -e " build has failed already. try to fix build and revup or enforce rebuild." # exit 3 #fi # get all dependencies of this package echo echo -n "Calculating dependencies ... " INSTALL_DEPS="$(${MLIBDIR}/depwalker.sh \ --method install-build-prerequisites \ --smage ${SMAGESCRIPTSDIR}/${SMAGEFILE})" # honor split packages if [[ -n ${SPLIT_PACKAGES} ]] then split_save_variables for subpackage in ${SPLIT_PACKAGES} do # get the right variables for the split export PNAME="${subpackage}" split_info_${PNAME} if [[ -z ${SRC_INSTALL_DEPS} ]] then SRC_INSTALL_DEPS="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}" else SRC_INSTALL_DEPS+=" ${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}" fi # restore smage environment split_restore_variables done # unset all saved smage variables split_unset_variables else SRC_INSTALL_DEPS="${TARGET_MAGEFILE}" fi echo "done" echo echo "---- dependencies ----" install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD} echo "INSTALL_DEPS:" : > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS for i in ${INSTALL_DEPS} do echo " * ${i}" echo "${i}" >> ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS done echo "SRC_INSTALL_DEPS:" : > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS for i in ${SRC_INSTALL_DEPS} do echo " * ${i}" echo "${i}" >> ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS done echo "----------------------"