diff --git a/tatt.5 b/tatt.5 index c40d34c..492b33b 100644 --- a/tatt.5 +++ b/tatt.5 @@ -77,6 +77,13 @@ which usually resides \fI /usr/lib/${python}/site-packages/tatt \fI .br #emergeopts="-v" +.br +# Whether to depclean package dependencies before each build test +.br +# (only applies to usecombis). Set any non-empty value to use. +.br +#cleandeps="yes" + .br # Bugzilla API key, generated at \fIhttps://bugs.gentoo.org/userprefs.cgi?tab=apikey\fP .br diff --git a/tatt/dot-tatt-spec b/tatt/dot-tatt-spec index 33aff95..f4df4eb 100644 --- a/tatt/dot-tatt-spec +++ b/tatt/dot-tatt-spec @@ -5,6 +5,7 @@ unmaskdir=string(default="/etc/portage/package.accept_keywords") arch=string(default="x86") defaultopts=string(default="") emergeopts=string(default="") +cleandeps=string(default="") rdeps=integer(0,512,default=10) usecombis=integer(0,512,default=12) repodir=string(default="") diff --git a/tatt/scriptwriter.py b/tatt/scriptwriter.py index c540626..fdc12e5 100644 --- a/tatt/scriptwriter.py +++ b/tatt/scriptwriter.py @@ -32,6 +32,7 @@ def scriptTemplate(job, config, filename): snippet = snippetfile.read() snippet = snippet.replace("@@EMERGEOPTS@@", config['emergeopts']) + snippet = snippet.replace("@@CLEANDEPS@@", config['cleandeps']) if job.bugnumber: snippet = snippet.replace("@@BUG@@", job.bugnumber) else: diff --git a/templates/tatt_functions.sh b/templates/tatt_functions.sh index 75f6ba4..884190b 100644 --- a/templates/tatt_functions.sh +++ b/templates/tatt_functions.sh @@ -44,6 +44,11 @@ function tatt_pkg_error function tatt_test_pkg { + # unmerge dependencies before tests + if [[ -n $TATT_CLEANDEPS ]]; then + CLEAN_DELAY=0 emerge -cq + fi + if [ "${1:?}" == "--test" ]; then shift if ! emerge --onlydeps -1 --with-test-deps ${TATT_EMERGEOPTS} "${1:?}"; then @@ -53,6 +58,11 @@ function tatt_test_pkg TFEATURES="${FEATURES} test" else TFEATURES="${FEATURES}" + # if not testing, install regular deps first + if ! emerge --onlydeps -1 ${TATT_EMERGEOPTS} "${1:?}"; then + echo "merging dependencies of $1 failed" >> "${TATT_REPORTFILE}" + return 0 + fi fi # --usepkg-exclude needs the package name, so let's extract it diff --git a/templates/use-header b/templates/use-header index 9ae0cdb..1b925c5 100644 --- a/templates/use-header +++ b/templates/use-header @@ -7,6 +7,7 @@ export TATT_TEST_TYPE="use" export TATT_REPORTFILE="@@REPORTFILE@@" export TATT_BUILDLOGDIR="@@BUILDLOGDIR@@" export TATT_EMERGEOPTS="@@EMERGEOPTS@@" +export TATT_CLEANDEPS="@@CLEANDEPS@@" source "@@TEMPLATEDIR@@tatt_functions.sh"