2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: scripts/Create-ErrList
6 # Copyright (C) 2006 - 2008 The OpenSDE Project
7 # Copyright (C) 2004 - 2006 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 Clifford Wolf
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- SDE-COPYRIGHT-NOTE-END ---
38 config
=$2 ; shift ; shift ;;
53 if [ $2 != '!' ] ; then
54 repository
=" $2 " ; shift ; shift
55 while [ "$1" -a -d "package/$1" ] ; do
56 repository
="$repository $1 " ; shift
59 shift ; shift ; repository
=
60 for x
in $
( ls package
/ ) ; do
61 [ -d "package/$x" ] &&
62 repository
="$repository $x"
64 repository
="$repository "
65 while [ "$1" -a -d "package/$1" ] ; do
66 repository
="${repository// $1 / }" ; shift
72 stages
="[$2]" ; shift ; shift ;;
75 logdir
=$2 ; shift ; shift ;;
78 copydir
=$2 ; shift ; shift ;;
81 movedir
=$2 ; shift ; shift ;;
90 fulldelete
=1 ; shift ;;
93 newdelete
=1 ; shift ;;
96 onlyupdated
=1 ; shift ;;
102 x
="${0//?/ }" ; x
="${x# }"
103 echo "Usage: $0 [ -cfg config ] [ -repository repository ] \\"
104 echo " $x [ -copydir copydir | -movedir movedir ] [ -repstat ] \\"
105 echo " $x [ -stage stage ] [ -logdir logdir ] [ -[full|new]delete ] \\"
106 echo " $x [ -updated ] [ -showerr ] [ -showtree ] [ -showdepc ] \\"
107 echo " $x [ -dry-run ] [-remove] [ <package> ]"
118 logdir
="${logdir:-build/$SDECFG_ID/var/adm/logs}"
119 pkgdir
="${logdir%/*}/packages"
121 if [ "$newdelete" = 1 ]; then
122 while read pkg cksum1
124 cksum2
=$
( pkgchksum package
/*/$pkg/ )
125 if [ "$cksum1" != "$cksum2" ]; then
126 echo "Scheduling package '$pkg' for rebuild ..."
127 if [ ! "$dryrun" = "1" ]; then
128 mine
-rf -R build
/$SDECFG_ID $pkg
129 rm -f build
/$SDECFG_ID/var
/adm
/*/?
-$pkg.
*
133 grep -R '^\(ROCK Linux\|T2\|OpenSDE\) Package Source Checksum: ' \
134 build
/$SDECFG_ID/var
/adm
/packages
/ |
135 sed 's,.*/\([^:]*\):.*:,\1,'
140 if [ "$repstat" = 1 ] ; then
143 echo -e "Repository\tPkg Total\tPkg OK\tPkg Error"
145 total_pkgt
=0 ; total_pkgo
=0 ; total_pkge
=0
146 for x
in $
( cd package
; echo [a-z0-9
]* ) ; do
147 pkgt
=0 ; pkgo
=0 ; pkge
=0
148 for y
in $
( cd package
/$x ; echo [a-z0-9
]* ) ; do
149 if [ "$( ls $logdir/$stages-$y.err 2> /dev/null )" ]
150 then (( pkge
++ )) ; (( total_pkge
++ ))
151 elif [ "$( ls $logdir/$stages-$y.log 2> /dev/null )" ]
152 then (( pkgo
++ )) ; (( total_pkgo
++ ))
155 (( pkgt
= pkgo
+ pkge
)) ; (( total_pkgt
+= pkgt
))
156 [ $pkgt != 0 ] && echo -e "$x\t$pkgt\t$pkgo\t$pkge"
159 echo -e "total\t$total_pkgt\t$total_pkgo\t$total_pkge"
162 expand -t20,35,50 |
sed 's,^, ,'
168 if [ "$fulldelete" = 1 ] ; then
170 rm -vf "$logdir"/$stages-$x.
{err
,log
,out
}
171 rm -vf "$logdir"/..
/*/$x
173 elif [ "$remove" = 1 ] ; then
175 echo "Scheduling package '$x' for rebuild ..."
176 mine
-rf -R build
/$SDECFG_ID $x
177 rm -f build
/$SDECFG_ID/var
/adm
/*/?
-$x.
*
179 elif [ "$delete" = 1 ] ; then
180 for x
; do rm -vf "$logdir"/$stages-$x.err
; done
182 for x
; do less "$logdir"/$stages-$x.err
; done
188 echo "Error logs from $SDECFG_ID:"
189 [ $showerr = 0 ] && echo
195 for stagelevel
in $
( echo "$stages" |
tr -d '[]' |
sed 's,.,& ,g' ) ; do
196 while read x x x tree pkg x
; do
198 "${repository/ $tree /}" = "$repository" ] && continue
201 if [ $onlyupdated != 0 ] ; then
202 [ "$( bin/find package/*/$pkg -newer "$logdir/$stagelevel-$pkg.err
" -o -newer "$logdir/$stagelevel-$pkg.log
" )" ] && this_is_error
=1
203 elif [ -f "$logdir/$stagelevel-$pkg.err" ] ; then
207 if [ $this_is_error = 1 ] ; then
208 if [ $showerr = 0 ] ; then
209 if [ $showdepc != 0 ]; then
210 d
=$
( .
/scripts
/Check-Deps-3
$stagelevel \
211 $pkg config
/$config/packages | \
212 cut
-f3 -d' ' |
sort -u |
wc -l )
213 d
="$( printf " %3d
" $d )"
217 echo "[$stagelevel]$d ${tree:0:13}/${pkg:0:18}"
219 echo ; echo "== $stagelevel-$pkg.* =="
220 tail -n 20 "$logdir/$stagelevel-$pkg".
* | \
226 $lines[$#lines+1] = $_;
228 for ($counter=0; $counter <= $#lines; $counter++) {
230 if ( /^checking for .*\.\.\. *Package / ||
231 /configure: error:/ ) {
232 for ($_=1; $_ <= $counter; $_++) {
233 print "$lines[$_]\n";
238 for ($counter=0; $counter <= $#lines; $counter++) {
240 if ( /^(make\S*): / ) {
244 ($_=$lines[$counter++]) ) {
245 last unless /^(make\S*): /;
246 $output="" if $1 ne $makeprefix;
250 print $output; exit 0;
256 ' |
tac |
fold -s -w79
259 for x
in `grep -lwi $3 $logdir/*.err | \
260 sed 's,.*/.-,,; s,\.err,,' | sort -u`
262 [ "$x" = "$3" ] && continue
263 [ "${2/ $x /}" != "$2" ] && continue
264 depcheck
"${1} " "$2 $3 " $x
267 [ $showtree = 1 ] && depcheck
"" "" $pkg
269 if [ "$copydir" ] ; then
271 cp "$logdir/$stagelevel-$pkg.err" "$copydir"
273 if [ "$movedir" ] ; then
275 mv "$logdir/$stagelevel-$pkg.err" "$movedir"
277 if [ "$fulldelete" -eq 1 ] ; then
278 rm -f "$logdir"/$stages-$pkg.
{err
,log
,out
}
279 rm -f "$logdir"/..
/*/$pkg
280 elif [ "$delete" -eq 1 ] ; then
281 rm -f "$logdir/$stagelevel-$pkg.err"
283 count_err
=$
(( $count_err + 1 ))
284 elif [ -f "$logdir/$stagelevel-$pkg.log" ] ; then
285 count_log
=$
(( $count_log + 1 ))
287 count_pkg
=$
(( $count_pkg + 1 ))
288 done < <( grep "^X [0-9-]*$stagelevel" config
/$config/packages
)
290 if [ $showerr = 0 ] ; then
291 paste - - |
expand -t40 |
sed 's,^, ,'
297 echo "$count_pkg builds total, $count_log completed fine," \
298 "$count_err with errors."