summaryrefslogtreecommitdiff
blob: ad5c6e46f16352afc26c257b530cedb9c77c990a (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
#!/bin/bash

if [[ -f /var/log/emerge.log ]]; then
    rm -f /var/log/emerge.log
fi

# Don't tweet this away if we're running a non-test try
if [[ -z "${FEATURES}" ]]; then
    echo "$1 queued" | bti --background;
fi

emerge --nospinner -1Du --keep-going --selective=n "$1" < /dev/null

res=$?

echo -5 | etc-update

if [[ $res != 0 ]]; then
    if ! fgrep -q ">>> emerge" /var/log/emerge.log; then
	# Here it means that the merge was rejected; the common case
	# it's a cyclic dependency that Portage cannot break, which is
	# unfortunately common when enabling tests e.g. with Ruby-NG
	# ebuilds. To try recovering from this, try a merge without
	# test features enabled.
	if [[ -z "${FEATURES}" ]]; then
	    FEATURES=-test $0 "$@"
	else
	    # This only hits the second time, so we're safely assuming
	    # that the package will reject to be merged as it is, why,
	    # we'll have to check.
	    echo "$1 merge #rejected" | bti --background
	fi
    fi
fi

rm -f /var/log/emerge.log