diff options
-rw-r--r-- | tatt/scriptwriter.py | 1 | ||||
-rw-r--r-- | templates/revdep-header | 39 | ||||
-rw-r--r-- | templates/revdep-snippet | 7 | ||||
-rw-r--r-- | templates/tatt_functions.sh | 57 | ||||
-rw-r--r-- | templates/use-header | 39 |
5 files changed, 70 insertions, 73 deletions
diff --git a/tatt/scriptwriter.py b/tatt/scriptwriter.py index 5cb5155..8623104 100644 --- a/tatt/scriptwriter.py +++ b/tatt/scriptwriter.py @@ -41,6 +41,7 @@ def scriptTemplate(job, config, filename): snippet = snippet.replace("@@BUILDLOGDIR@@", config['buildlogdir']) snippet = snippet.replace("@@KEYWORDFILE@@", config['unmaskfile']) snippet = snippet.replace("@@NEWKEYWORD@@", newkeyword) + snippet = snippet.replace("@@TEMPLATEDIR@@", config['template-dir']) return snippet def useCombiTestString(job, pack, config, port): diff --git a/templates/revdep-header b/templates/revdep-header index 5d01821..5731d5d 100644 --- a/templates/revdep-header +++ b/templates/revdep-header @@ -3,40 +3,13 @@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM -function tatt_pkg_error -{ - local eout=${2} +export TATT_TEST_TYPE="rdep" +export TATT_REPORTFILE="@@REPORTFILE@@" +export TATT_BUILDLOGDIR="@@BUILDLOGDIR@@" +export TATT_EMERGEOPTS="@@EMERGEOPTS@@" - echo "${eout}" +source "@@TEMPLATEDIR@@tatt_functions.sh" - if [ -n "${USE}" ]; then - echo -n "USE='${USE}'" >> @@REPORTFILE@@ - fi - if [ -n "${FEATURES}" ]; then - echo -n " FEATURES='${FEATURES}'" >> @@REPORTFILE@@ - fi - - if [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ USE\ changes ]] ; then - echo " : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ keyword\ changes ]]; then - echo " : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then - echo " : circular dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Blocked\ Packages ]]; then - echo " : blocked packages (probably) for ${1:?}" >> @@REPORTFILE@@ - else - echo " failed for ${1:?}" >> @@REPORTFILE@@ - fi - - CP=${1#=} - BUILDLOG=/var/tmp/portage/${CP}/temp/build.log - if [[ -n "@@BUILDLOGDIR@@" && -s "${BUILDLOG}" ]]; then - LOGNAME=$(mktemp -p "@@BUILDLOGDIR@@" "${CP/\//_}_rdep_XXXXX") - mv "${BUILDLOG}" "${LOGNAME}" - echo " log has been saved as ${LOGNAME}" >> @@REPORTFILE@@ - fi -} +export USE echo -e "revdep tests started on $(date)\n" >> @@REPORTFILE@@ diff --git a/templates/revdep-snippet b/templates/revdep-snippet index 03fa511..72d7dd2 100644 --- a/templates/revdep-snippet +++ b/templates/revdep-snippet @@ -1,6 +1 @@ -eout=$( @@FEATURES@@ @@USE@@ emerge -1 @@EMERGEOPTS@@ @@CPV@@ 2>&1 1>/dev/tty ) -if [[ $? == 0 ]] ; then - echo "@@FEATURES@@ @@USE@@ succeeded for @@CPV@@" >> @@REPORTFILE@@ -else - @@USE@@ @@FEATURES@@ tatt_pkg_error "@@CPV@@" "${eout}" -fi +@@USE@@ T@@FEATURES@@ tatt_test_pkg "@@CPV@@" diff --git a/templates/tatt_functions.sh b/templates/tatt_functions.sh new file mode 100644 index 0000000..9aeed69 --- /dev/null +++ b/templates/tatt_functions.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +function tatt_pkg_error +{ + local eout=${2} + + echo "${eout}" + + if [ -n "${USE}" ]; then + echo -n "USE='${USE}'" >> "${TATT_REPORTFILE}" + fi + if [ -n "${FEATURES}" ]; then + echo -n " FEATURES='${FEATURES}'" >> "${TATT_REPORTFILE}" + fi + + if [[ "${eout}" =~ REQUIRED_USE ]] ; then + echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ USE\ changes ]] ; then + echo " : USE dependencies not satisfied (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ keyword\ changes ]]; then + echo " : unkeyworded dependencies (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then + echo " : circular dependencies (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + elif [[ "${eout}" =~ Blocked\ Packages ]]; then + echo " : blocked packages (probably) for ${1:?}" >> "${TATT_REPORTFILE}" + else + echo " failed for ${1:?}" >> "${TATT_REPORTFILE}" + fi + + CP=${1#=} + BUILDLOG=/var/tmp/portage/${CP}/temp/build.log + if [[ -n "${TATT_BUILDLOGDIR}" && -s "${BUILDLOG}" ]]; then + LOGNAME=$(mktemp -p "${TATT_BUILDLOGDIR}" "${CP/\//_}_${TATT_TEST_TYPE}_XXXXX") + mv "${BUILDLOG}" "${LOGNAME}" + echo " log has been saved as ${LOGNAME}" >> "${TATT_REPORTFILE}" + fi +} + +function tatt_test_pkg +{ + if [ -n "${TFEATURES}" ]; then + if ! emerge --onlydeps -1 --with-test-deps ${TATT_EMERGEOPTS} "${1:?}"; then + echo "merging test dependencies of ${1} failed" >> "${TATT_REPORTFILE}" + return 0 + fi + fi + + eout=$( FEATURES="${TFEATURES}" emerge -1 ${TATT_EMERGEOPTS} "${1:?}" 2>&1 1>/dev/tty ) + if [[ $? == 0 ]] ; then + if [ -n "${TFEATURES}" ]; then + echo -n "FEATURES='${TFEATURES}' " >> "${TATT_REPORTFILE}" + fi + echo "USE='${USE}' succeeded for ${1:?}" >> "${TATT_REPORTFILE}" + else + FEATURES="${TFEATURES}" tatt_pkg_error "${1:?}" "${eout}" + fi +} diff --git a/templates/use-header b/templates/use-header index 4000a68..d18e080 100644 --- a/templates/use-header +++ b/templates/use-header @@ -3,40 +3,11 @@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM -function tatt_pkg_error -{ - local eout=${2} +export TATT_TEST_TYPE="use" +export TATT_REPORTFILE="@@REPORTFILE@@" +export TATT_BUILDLOGDIR="@@BUILDLOGDIR@@" +export TATT_EMERGEOPTS="@@EMERGEOPTS@@" - echo "${eout}" - - if [ -n "${USE}" ]; then - echo -n "USE='${USE}'" >> @@REPORTFILE@@ - fi - if [ -n "${FEATURES}" ]; then - echo -n " FEATURES='${FEATURES}'" >> @@REPORTFILE@@ - fi - - if [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo " : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ USE\ changes ]] ; then - echo " : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ keyword\ changes ]]; then - echo " : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Error:\ circular\ dependencies: ]]; then - echo " : circular dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ - elif [[ "${eout}" =~ Blocked\ Packages ]]; then - echo " : blocked packages (probably) for ${1:?}" >> @@REPORTFILE@@ - else - echo " failed for ${1:?}" >> @@REPORTFILE@@ - fi - - CP=${1#=} - BUILDLOG=/var/tmp/portage/${CP}/temp/build.log - if [[ -n "@@BUILDLOGDIR@@" && -s "${BUILDLOG}" ]]; then - LOGNAME=$(mktemp -p "@@BUILDLOGDIR@@" "${CP/\//_}_use_XXXXX") - mv "${BUILDLOG}" "${LOGNAME}" - echo " log has been saved as ${LOGNAME}" >> @@REPORTFILE@@ - fi -} +source "@@TEMPLATEDIR@@tatt_functions.sh" echo -e "USE tests started on $(date)\n" >> @@REPORTFILE@@ |