* updated libxspf (1.2.0 -> 1.2.1)
[t2-trunk.git] / scripts / Create-ErrList
blob5fb2e39911c6cb7211ff2d502e0fcf99657661f4
1 #!/bin/bash
3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: scripts/Create-ErrList
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 config=default
16 repstat=0
17 showerr=0
18 showtree=0
19 showdepc=0
20 delete=0
21 remove=0
22 fulldelete=0
23 newdelete=0
24 newremove=0
25 onlyupdated=0
27 repository=""
28 stages="[0123456789]"
29 copydir=""
30 movedir=""
31 logdir=""
33 # uninstall sysroot package
34 uninstall_pkg()
36 pushd $1 > /dev/null
37 cut -d ' ' -f 2- var/adm/flists/$2 | tac | while read fn; do
38 if [ -d "$fn" ]; then rmdir "$fn"
39 else rm -f "$fn"; fi
40 done
41 popd > /dev/null
44 while [ "$1" ]; do
45 case "$1" in
46 -cfg)
47 config=$2 ; shift; shift ;;
49 -repstat)
50 repstat=1 ; shift ;;
52 -showerr)
53 showerr=1 ; shift ;;
55 -showtree)
56 showtree=1 ; shift ;;
58 -showdepc)
59 showdepc=1 ; shift ;;
61 -repository)
62 if [ $2 != '!' ]; then
63 repository=" $2 "; shift; shift
64 while [ "$1" -a -d "package/$1" ]; do
65 repository="$repository $1 "; shift
66 done
67 else
68 shift; shift; repository=""
69 for x in $( ls package/ ); do
70 [ -d "package/$x" ] &&
71 repository="$repository $x"
72 done
73 repository="$repository "
74 while [ "$1" -a -d "package/$1" ]; do
75 repository="${repository// $1 / }"; shift
76 done
80 -stage)
81 stages="[$2]" ; shift; shift ;;
83 -logdir)
84 logdir=$2 ; shift; shift ;;
86 -copydir)
87 copydir=$2 ; shift; shift ;;
89 -movedir)
90 movedir=$2 ; shift; shift ;;
92 -delete)
93 delete=1 ; shift ;;
95 -remove)
96 remove=1 ; shift ;;
98 -fulldelete)
99 fulldelete=1 ; shift ;;
101 -newdelete)
102 newdelete=1 ; shift ;;
104 -newremove)
105 newremove=1 ; shift ;;
107 -updated)
108 onlyupdated=1 ; shift ;;
110 -dry-run)
111 dryrun=1 ; shift ;;
114 x="${0//?/ }"; x="${x# }"
115 echo "Usage: $0 [ -cfg config ] [ -repository repository ] \\"
116 echo " $x [ -copydir copydir | -movedir movedir ] [ -repstat ] \\"
117 echo " $x [ -stage stage ] [ -logdir logdir ] [ -remove ] [ -[full]delete -new[remove|delete] \\"
118 echo " $x [ -updated ] [ -showerr ] [ -showtree ] [ -showdepc ] \\"
119 echo " $x [ -dry-run ] [ <package> ]"
120 exit 1 ;;
123 break ;;
124 esac
125 done
127 . scripts/parse-config
128 . scripts/functions.in
130 logdir="${logdir:-build/$SDECFG_ID/var/adm/logs}"
132 if [ "$newdelete" = 1 -o "$newremove" = 1 ]; then
133 while read pkg cksum1
135 cksum2=$( pkgchksum package/*/$pkg/ )
136 if [ "$cksum1" != "$cksum2" ]; then
137 if [ "$newdelete" = 1 ]; then
138 echo "Removing package '$pkg' ..."
139 [ "$dryrun" = "1" ] || uninstall_pkg build/$SDECFG_ID $pkg
140 [ "$dryrun" = "1" ] || rm -f build/$SDECFG_ID/var/adm/*/?-$pkg.*
141 else
142 echo "Scheduling package '$pkg' for rebuild ..."
143 [ "$dryrun" = "1" ] || rm -f build/$SDECFG_ID/var/adm/*/?-$pkg.*
146 done < <(
147 grep -R '^\(ROCK Linux\|T2\) Package Source Checksum: ' \
148 build/$SDECFG_ID/var/adm/packages/ |
149 sed 's,.*/\([^:]*\):.*:,\1,'
151 exit 0
154 if [ "$repstat" = 1 ]; then
156 echo
157 echo -e "Repository\tPkg Total\tPkg OK\tPkg Error"
158 echo
159 total_pkgt=0; total_pkgo=0; total_pkge=0
160 for x in $( cd package; echo [a-z0-9]* ); do
161 pkgt=0; pkgo=0; pkge=0
162 for y in $( cd package/$x; echo [a-z0-9]* ); do
163 if [ "$( ls $logdir/$stages-$y.err 2> /dev/null )" ]
164 then (( pkge++ )); (( total_pkge++ ))
165 elif [ "$( ls $logdir/$stages-$y.log 2> /dev/null )" ]
166 then (( pkgo++ )); (( total_pkgo++ ))
168 done
169 (( pkgt = pkgo + pkge )); (( total_pkgt += pkgt ))
170 [ $pkgt != 0 ] && echo -e "$x\t$pkgt\t$pkgo\t$pkge"
171 done
172 echo
173 echo -e "total\t$total_pkgt\t$total_pkgo\t$total_pkge"
174 echo
175 } | {
176 expand -t20,35,50 | sed 's,^, ,'
178 exit 0
181 if [ "$1" ]; then
182 if [ "$fulldelete" = 1 ]; then
183 for x; do
184 rm -vf "$logdir"/$stages-$x.{err,log,out}
185 rm -vf "$logdir"/../*/$x
186 done
187 elif [ "$remove" = 1 ]; then
188 for x; do
189 echo "Scheduling package '$x' for rebuild ..."
190 uninstall_pkg build/$SDECFG_ID $x
191 rm -f build/$SDECFG_ID/var/adm/*/$stages-$x.{err,log,out}
192 done
193 elif [ "$delete" = 1 ]; then
194 for x; do rm -vf "$logdir"/$stages-$x.{err,log,out}; done
195 else
196 for x; do less "$logdir"/$stages-$x.err; done
198 exit 0
201 echo
202 echo "Error logs from $SDECFG_ID:"
203 [ $showerr = 0 ] && echo
205 count_pkg=0
206 count_err=0
207 count_log=0
209 for stagelevel in $( echo "$stages" | sed 's,[][],,g; s,.,& ,g' ); do
210 while read x x x tree pkg x; do
211 [ "$repository" -a \
212 "${repository/ $tree /}" = "$repository" ] && continue
214 this_is_error=0
215 if [ $onlyupdated != 0 ]; then
216 [ "$( bash scripts/xfind.sh package/*/$pkg -newer "$logdir/$stagelevel-$pkg.err" -o -newer "$logdir/$stagelevel-$pkg.log" )" ] && this_is_error=1
217 elif [ -f "$logdir/$stagelevel-$pkg.err" ]; then
218 this_is_error=1
221 if [ $this_is_error = 1 ]; then
222 if [ $showerr = 0 ]; then
223 if [ $showdepc != 0 ]; then
224 d=$( scripts/Check-Deps-3 $stagelevel \
225 $pkg config/$config/packages | \
226 cut -f3 -d' ' | sort -u | wc -l )
227 d="$( printf " %3d" $d )"
228 else
229 d=""
231 echo "[$stagelevel]$d ${tree:0:13}/${pkg:0:18}"
232 else
233 echo; echo "== $stagelevel-$pkg.* =="
234 tail -n 20 "$logdir/$stagelevel-$pkg".* | \
235 tac | perl -e '
236 my @lines;
237 my $counter;
238 while (<>) {
239 chomp;
240 $lines[$#lines+1] = $_;
242 for ($counter=0; $counter <= $#lines; $counter++) {
243 $_=$lines[$counter];
244 if ( /^checking for .*\.\.\. *Package / ||
245 /configure: error:/ ) {
246 for ($_=1; $_ <= $counter; $_++) {
247 print "$lines[$_]\n";
249 exit 0;
252 for ($counter=0; $counter <= $#lines; $counter++) {
253 $_=$lines[$counter];
254 if ( /^(make\S*): / ) {
255 my $makeprefix=$1;
256 my $output="$_\n";
257 while ( defined
258 ($_=$lines[$counter++]) ) {
259 last unless /^(make\S*): /;
260 $output="" if $1 ne $makeprefix;
261 $makeprefix=$1;
262 $output.="$_\n";
264 print $output; exit 0;
267 foreach (@lines) {
268 print "$_\n";
270 ' | tac | fold -s -w79
271 depcheck() {
272 echo "${1}\`---> $3"
273 for x in `grep -lwi $3 $logdir/*.err | \
274 sed 's,.*/.-,,; s,\.err,,' | sort -u`
276 [ "$x" = "$3" ] && continue
277 [ "${2/ $x /}" != "$2" ] && continue
278 depcheck "${1} " "$2 $3 " $x
279 done
281 [ $showtree = 1 ] && depcheck "" "" $pkg
283 if [ "$copydir" ]; then
284 mkdir -p "$copydir"
285 cp "$logdir/$stagelevel-$pkg.err" "$copydir"
287 if [ "$movedir" ]; then
288 mkdir -p "$movedir"
289 mv "$logdir/$stagelevel-$pkg.err" "$movedir"
291 if [ "$fulldelete" -eq 1 ]; then
292 rm -f "$logdir"/$stages-$pkg.{err,log,out}
293 rm -f "$logdir"/../*/$pkg
294 elif [ "$delete" -eq 1 ]; then
295 rm -f "$logdir/$stagelevel-$pkg.err"
297 (( count_err++ ))
298 elif [ -f "$logdir/$stagelevel-$pkg.log" ]; then
299 (( count_log++ ))
301 (( count_pkg++ ))
302 done < <( grep "^X [0-9-]*$stagelevel" config/$config/packages )
303 done > >(
304 if [ $showerr = 0 ]; then
305 paste - - | expand -t40 | sed 's,^, ,'
306 else cat; fi
309 sleep 1
310 echo
311 echo "$count_pkg builds total, $count_log completed fine," \
312 "$count_err with errors, $(( count_pkg - count_log - count_err )) to go."
313 echo