]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - wwwbin/consistency-check.sh
Filter out boolean deps, poldek does not support them and reports false negatives
[projects/pld-ftp-admin.git] / wwwbin / consistency-check.sh
1 #!/bin/sh
2
3 export LC_ALL=C
4
5 filter_deps() {
6         boolean_deps="req \(.*\) not found"
7         common_deps="cpuinfo\(|uname\(release\)|-multilib-|\/eclipse\/|statifier|kernel-tools-perf-vdso"
8         x32_deps="libreoffice|nodejs|firefox|seamonkey|thunderbird"
9         if [ $1 = "x32" ]; then
10                 grep -Ev "($boolean_deps|$common_deps|$x32_deps)"
11         else
12                 grep -Ev "($boolean_deps|$common_deps)"
13         fi
14 }
15
16 # group errors by same error kind
17 group_deps() {
18         local t=$(mktemp)
19         cat > $t
20         sed -ne 's/.*req \(.*\) not found.*/\1/p' $t | sort -u | while read dep; do
21                 grep -F "req $dep not found" $t
22         done
23         rm -f $t
24 }
25
26 # convert pkg name to src.rpm name
27 # uses poldek
28 pkg2src() {
29         local t=$(mktemp)
30         local t3=$(mktemp)
31
32         # save input
33         cat > $t
34
35         # create list of N-V-R.A.rpm -> src-N pairs from error report
36         # error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
37         sed -ne 's/error: \(.*\): req .* not found/\1/p' $t | sort -u | \
38                 xargs -d '\n' poldek --noignore -Q "$@" --cmd ls -q -s | \
39                 sed -rne "s/^([^\t ]+)[\t ]+(.+)-[^-]+-[^-]+\.src\.rpm$/\1\t\2/p" >$t3
40
41         local pkg error message srpm
42         while read error pkg message; do
43                 # error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
44                 srpm=$(awk -vpkg="${pkg%:}" '$1 == pkg {printf("%s.spec", $2)}' $t3)
45                 if [ -z "$srpm" ]; then
46                         echo >&2 "srpms: No match for [${pkg%:}]"
47                 fi
48                 echo "$error [$srpm] $pkg $message"
49         done < $t
50
51         rm -f $t $t3
52 }
53
54 gen_list() {
55         arch=$1
56         shift
57         date
58         poldek --cleana
59         poldek \
60          -O "auto directory dependencies = yes" \
61         --ignore "*-debuginfo-*" \
62         --ignore "opera-plugin32-*" \
63         --ignore "nspluginwrapper-*" \
64         --ignore "mbrola-voice-*" \
65         --ignore "pysql-*" \
66         --ignore "yasql-*" \
67         --ignore "kde4-kdenetwork-kopete-protocol-skype-*.x86_64" \
68         --ignore "libpurple-protocol-skype-*.x86_64" \
69         --ignore "nagios-plugin-check_cciss-*" \
70         --ignore "libpng1*" \
71         --verify=deps -Q "$@" | filter_deps $arch | group_deps | pkg2src "$@" | sort
72 }
73
74 gen_list_uniq() {
75         arch=$1
76         shift
77         gen_list $arch -O "unique package names = yes" "$@"
78 }
79
80 t=$(mktemp)
81 ftpdir=$HOME/ftp
82 for arch in x86_64 i686 x32 ; do
83         if [ "$arch" = x86_64 ]; then
84                 outfext=.txt
85         else
86                 outfext=-$arch.txt
87         fi
88         gen_list      $arch -s $ftpdir/PLD/$arch/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ > $t && cat $t > $HOME/www/main$outfext
89         gen_list_uniq $arch -s $ftpdir/PLD/$arch/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/$arch/RPMS/ -s $ftpdir/ready/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready$outfext
90         gen_list_uniq $arch -s $ftpdir/PLD/$arch/RPMS/ -s $ftpdir/PLD/noarch/RPMS/ -s $ftpdir/ready/$arch/RPMS/ -s $ftpdir/ready/noarch/RPMS/ -s $ftpdir/test/$arch/RPMS/ -s $ftpdir/test/noarch/RPMS/ > $t && cat $t > $HOME/www/main-ready-test$outfext
91 done
92
93 chmod 644 $HOME/www/*.txt
94 rm -f $t
This page took 0.281982 seconds and 4 git commands to generate.