aboutsummaryrefslogtreecommitdiff
blob: 57d3d651c50042a720b74f25a5318ad83dbfa9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/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#=}
  BUILDDIR=/var/tmp/portage/${CP}
  BUILDLOG=${BUILDDIR}/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}"
    TESTLOGS=($(find ${BUILDDIR}/work -iname '*test*log*'))
    if [ ${#TESTLOGS[@]} -gt 0 ]; then
      tar cf ${LOGNAME}.tar ${TESTLOGS[@]}
      echo "    testsuite logs have been saved as ${LOGNAME}.tar" >> "${TATT_REPORTFILE}"
    fi
  fi
}

function tatt_test_pkg
{
  if [ "${1:?}" == "--test" ]; then
    shift
    if ! emerge --onlydeps -1 --with-test-deps ${TATT_EMERGEOPTS} "${1:?}"; then
      echo "merging test dependencies of ${1} failed" >> "${TATT_REPORTFILE}"
      return 0
    fi
    TFEATURES="${FEATURES} test"
  else
    TFEATURES="${FEATURES}"
  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}"
    return 1
  fi
}