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