summaryrefslogtreecommitdiff
path: root/wwwbin/consistency-check.sh
blob: ddee3ca9d061500c8fef4e390077a1b802edb2e7 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

export LC_ALL=C

filter_deps() {
	grep -Ev "(FileDigestParameterized|unsatisfied dependencies found|-multilib-|zsh/latest/functions|VirtualBox.*libc\.so\.6|obextool.*libc\.so\.6)" | \
	grep -v "uname(release)" |
	grep -v "/eclipse/"
}

# group errors by same error kind
group_deps() {
	local t=$(mktemp)
	cat > $t
	sed -ne 's/.*req \(.*\) not found.*/\1/p' $t | sort -u | while read dep; do
		grep -F "req $dep not found" $t
	done
	rm -f $t
}

# convert pkg name to src.rpm name
# uses poldek
pkg2src() {
	local t=$(mktemp)
	local t1=$(mktemp)
	local t2=$(mktemp)
	local t3=$(mktemp)

	# save input
	cat > $t

	# create list of packages from error report
	# error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
	sed -ne 's/error: \(.*\): req .* not found/\1/p' $t | sort -u > $t1

	# create list of package -> src.rpm names
	poldek --noignore -Q "$@" --cmd ls -q -s > $t2

	# create N-V-R -> N list
	local pkg error message srpm out
	while read pkg; do
		pkg=$(echo "$pkg" | sed -e 's,+,\\+,g')

		# there's no space between the columns, so need to match with known archs
		# see https://bugs.launchpad.net/poldek/+bug/1031767
		out=$(sed -rne "s/^($pkg)\.(x86_64|i686|noarch)(.+)-[^-]+-[^-]+\.src\.rpm$/\1\t\3/p" $t2)
		if [ -z "$out" ]; then
			echo >&2 "nvr: No match for [$pkg]"
		fi
		echo "$out"
	done < $t1 > $t3

	while read error pkg message; do
		# error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
		srpm=$(awk -vpkg="${pkg%:}" '$1 == pkg {printf("%s.spec", $2)}' $t3)
		if [ -z "$srpm" ]; then
			echo >&2 "srpms: No match for [${pkg%:}]"
		fi
		echo "$error [$srpm] $pkg $message"
	done < $t

	rm -f $t $t1 $t2 $t3
}

gen_list() {
	date
	/usr/bin/poldek -O "auto directory dependencies = yes" \
	--ignore "*-debuginfo-*" \
	--ignore "opera-plugin32-*" \
	--ignore "nspluginwrapper-*" \
	--ignore "mbrola-voice-*" \
	--ignore "pysql-*" \
	--ignore "yasql-*" \
	--ignore "kde4-kdenetwork-kopete-protocol-skype-*.x86_64" \
	--ignore "libpurple-protocol-skype-*.x86_64" \
	--ignore "*-video-nvidia-legacy3-*" \
	--verify=deps -Q "$@" | filter_deps | group_deps | sort | pkg2src "$@"
}

gen_list_uniq() {
	gen_list -O"unique package names = yes" "$@"
}

t=$(mktemp)
ftpdir=$HOME/ftp
gen_list      -s $ftpdir/PLD/x86_64/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ > $t && cat $t > $HOME/www/main.txt
gen_list_uniq -s $ftpdir/PLD/x86_64/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/x86_64/RPMS/ -s $ftpdir/ready/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready.txt
gen_list_uniq -s $ftpdir/PLD/x86_64/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/x86_64/RPMS/ -s $ftpdir/ready/noarch/RPMS/ -s $ftpdir/test/x86_64/RPMS/ -s $ftpdir/test/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-test.txt

gen_list      -s $ftpdir/PLD/i686/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ > $t && cat $t > $HOME/www/main-i686.txt
gen_list_uniq -s $ftpdir/PLD/i686/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/i686/RPMS/ -s $ftpdir/ready/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-i686.txt
gen_list_uniq -s $ftpdir/PLD/i686/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/i686/RPMS/ -s $ftpdir/ready/noarch/RPMS/ -s $ftpdir/test/i686/RPMS/ -s $ftpdir/test/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-test-i686.txt

gen_list      -s $ftpdir/PLD/i486/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ > $t && cat $t > $HOME/www/main-i486.txt
gen_list_uniq -s $ftpdir/PLD/i486/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/i486/RPMS/ -s $ftpdir/ready/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-i486.txt
gen_list_uniq -s $ftpdir/PLD/i486/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/i486/RPMS/ -s $ftpdir/ready/noarch/RPMS/ -s $ftpdir/test/i486/RPMS/ -s $ftpdir/test/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-test-i486.txt

(date; $HOME/bin/ac-th-diff.py) > $t && cat $t > $HOME/www/ac-th-diff.txt

chmod 644 $HOME/www/*.txt
rm -f $t