aboutsummaryrefslogtreecommitdiff
path: root/tools/masstest_sbo.sh
blob: a544e12066bc7710f95ea55c3f22820423509b11 (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
69
70
71
72
73
74
75
#!/usr/bin/bash

# set DISTCLEAN TRUE to preserve space
sboconfig -d TRUE
# clear out work directories and distfiles
sboclean -dw

SBOS=$(find /usr/sbo -type f -iname \*.info | sed -r 's|.*/([^/]+)\.info$|\1|g');

TLOG=~/tmp.log
ILOG=~/install.log
RLOG=~/remove.log

# zero out logs in case they have content from previous run
:> $ILOG
:> $RLOG

for i in build md5sum wget noinfo nomulti else; do
	:> ~/$i.fail.log
done

function build_things() {
	if [ ! -z $1 ]; then
		. /usr/sbo/*/$1/$1.info
		for i in $REQUIRES; do
			if [[ "$i" != "%README%" ]]; then
				build_things $i
			fi
		done
		echo "=============" > $TLOG
		echo "sboinstall -r $1" >> $TLOG
		sboinstall -r $1 >> $TLOG 2>&1
		case "$?" in
			"0") OLOG="" ;;
			"3") OLOG=~/build.fail.log ;;
			"4") OLOG=~/md5sum.fail.log ;;
			"5") OLOG=~/wget.fail.log ;;
			"7") OLOG=~/noinfo.fail.log ;;
			"9") OLOG=~/nomulti.fail.log ;;
			*) OLOG=~/else.fail.log ;;
		esac
		if [[ "$OLOG" != "" ]]; then
			if ! grep -q "^$1 added to install queue.$" $OLOG; then
				echo "" >> $OLOG
				cat $TLOG >> $OLOG
			fi
		fi
		echo "" >> $ILOG
		cat $TLOG >> $ILOG
		:> $TLOG
	else
		echo "build_things() requires an argument."
		exit 1
	fi
}

function remove_things() {
	if [ ! -z $1 ]; then
		echo "=============" > $TLOG
		echo "sboremove --nointeractive $1" >> $TLOG
		sboremove --nointeractive $1 >> $TLOG 2>&1
		echo "" >> $RLOG
		cat $TLOG >> $RLOG
		:> $TLOG
	fi
}

for i in $SBOS; do
	echo $i
	build_things $i
	remove_things $i
	removepkg $(ls /var/log/packages|grep SBo) > /dev/null 2>&1
done

exit 0