diff options
author | 2017-12-01 22:05:22 +0100 | |
---|---|---|
committer | 2017-12-05 22:59:32 +1100 | |
commit | d8a3e892b0cedbc5dd1b1e1f78e851c83b639b87 (patch) | |
tree | 00e230c61cacfde592404ebe40020cf5ec731be2 | |
parent | factor out script replacements (diff) | |
download | tatt-d8a3e892b0cedbc5dd1b1e1f78e851c83b639b87.tar.gz tatt-d8a3e892b0cedbc5dd1b1e1f78e851c83b639b87.tar.bz2 tatt-d8a3e892b0cedbc5dd1b1e1f78e851c83b639b87.zip |
factor out error handling of use and revdep testing scripts
This makes them much more readable.
-rw-r--r-- | templates/revdep-header | 18 | ||||
-rw-r--r-- | templates/revdep-snippet | 12 | ||||
-rw-r--r-- | templates/use-header | 18 | ||||
-rw-r--r-- | templates/use-snippet | 12 |
4 files changed, 38 insertions, 22 deletions
diff --git a/templates/revdep-header b/templates/revdep-header index e1ede27..3732fbd 100644 --- a/templates/revdep-header +++ b/templates/revdep-header @@ -2,3 +2,21 @@ # Reverse dependency testing for @@JOB@@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM + +function tatt_pkg_error +{ + local eout=${2} + + echo "${eout}" + + if [[ "${eout}" =~ REQUIRED_USE ]] ; then + echo "USE='${USE}' : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ + elif [[ "${eout}" =~ USE\ changes ]] ; then + echo "USE='${USE}' : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ + elif [[ "${eout}" =~ keyword\ changes ]]; then + echo "USE='${USE}' : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ + else + echo "USE='${USE}' FEATURES='${FEATURES}' failed for ${1:?}" >> @@REPORTFILE@@ + fi +} + diff --git a/templates/revdep-snippet b/templates/revdep-snippet index 982b179..03fa511 100644 --- a/templates/revdep-snippet +++ b/templates/revdep-snippet @@ -1,16 +1,6 @@ eout=$( @@FEATURES@@ @@USE@@ emerge -1 @@EMERGEOPTS@@ @@CPV@@ 2>&1 1>/dev/tty ) if [[ $? == 0 ]] ; then echo "@@FEATURES@@ @@USE@@ succeeded for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo "${eout}" - echo "@@CPV@@ : REQUIRED_USE not satisfied (probably) for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ USE\ changes ]] ; then - echo "${eout}" - echo "@@CPV@@ : USE dependencies not satisfied (probably) for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ keyword\ changes ]]; then - echo "${eout}" - echo "@@USE@@ : unkeyworded dependencies (probably) for @@CPV@@" >> @@REPORTFILE@@ else - echo "${eout}" - echo "@@FEATURES@@ failed for @@CPV@@" >> @@REPORTFILE@@ + @@USE@@ @@FEATURES@@ tatt_pkg_error "@@CPV@@" "${eout}" fi diff --git a/templates/use-header b/templates/use-header index cbfffd4..e4e8bc5 100644 --- a/templates/use-header +++ b/templates/use-header @@ -2,3 +2,21 @@ #USE-Flag build tests for job @@JOB@@ trap "echo 'signal captured, exiting the entire script...'; exit" SIGHUP SIGINT SIGTERM + +function tatt_pkg_error +{ + local eout=${2} + + echo "${eout}" + + if [[ "${eout}" =~ REQUIRED_USE ]] ; then + echo "USE='${USE}' : REQUIRED_USE not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ + elif [[ "${eout}" =~ USE\ changes ]] ; then + echo "USE='${USE}' : USE dependencies not satisfied (probably) for ${1:?}" >> @@REPORTFILE@@ + elif [[ "${eout}" =~ keyword\ changes ]]; then + echo "USE='${USE}' : unkeyworded dependencies (probably) for ${1:?}" >> @@REPORTFILE@@ + else + echo "USE='${USE}' FEATURES='${FEATURES}' failed for ${1:?}" >> @@REPORTFILE@@ + fi +} + diff --git a/templates/use-snippet b/templates/use-snippet index aabe700..fc88834 100644 --- a/templates/use-snippet +++ b/templates/use-snippet @@ -1,16 +1,6 @@ eout=$( @@USE@@ @@FEATURES@@ emerge -1 @@EMERGEOPTS@@ @@CPV@@ 2>&1 1>/dev/tty ) if [[ $? == 0 ]] ; then echo "@@USE@@ @@FEATURES@@ succeeded for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ REQUIRED_USE ]] ; then - echo "${eout}" - echo "@@USE@@ : REQUIRED_USE not satisfied (probably) for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ USE\ changes ]] ; then - echo "${eout}" - echo "@@USE@@ : USE dependencies not satisfied (probably) for @@CPV@@" >> @@REPORTFILE@@ -elif [[ "${eout}" =~ keyword\ changes ]]; then - echo "${eout}" - echo "@@USE@@ : unkeyworded dependencies (probably) for @@CPV@@" >> @@REPORTFILE@@ else - echo "${eout}" - echo "@@USE@@ @@FEATURES@@ failed for @@CPV@@" >> @@REPORTFILE@@ + @@USE@@ @@FEATURES@@ tatt_pkg_error "@@CPV@@" "${eout}" fi |