dtneeded*: More parallel.
[massrebuild.git] / debugsourcesize
1 #! /bin/bash
2 url=http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/rawhide/Everything/x86_64/debug/tree/Packages/
3 debuginfos=0
4 debuginfosize=0
5 debugsources=0
6 debugsourcesize=0
7 function parse
8 {
9   # <tr class="odd"><td class="indexcolicon"><img src="/Tango/24x24/mimetypes/tgz.png" alt="[GZ]" /></td><td class="indexcolname"><a href="lasem-debugsource-0.4.3-13.fc32.i686.rpm">lasem-debugsource-0.4.3-13.fc32.i686.rpm</a></td><td class="indexcollastmod">2020-02-15 22:43  </td><td class="indexcolsize">237K</td><td>&nbsp;</td></tr>
10   wget -q -O - $1|sed -n 's#^.*<td class="indexcolname"><a href="\([^/"]*\)/\?".*$#\1#p'
11 }
12 ls=$(parse $url)
13 echo >&2 $ls
14 for l in $ls;do
15 #for l in 0;do
16   echo >&2 -n $l
17   for n in $(parse $url/$l/);do
18     echo >&2 -n .
19     size=$(curl -sI $url/$l/$n|tr A-Z a-z|sed -n 's/^content-length: *\([0-9]\+\)\r$/\1/p')
20     if [ -z "$size" ];then
21       echo "error size: $n"
22       continue
23     fi
24     c=0
25     if echo $n|grep -q -- '-debuginfo-';then
26       debuginfos=$[$debuginfos+1]
27       debuginfosize=$[debuginfosize+$size]
28       c=$[$c+1]
29     elif echo $n|grep -q -- '-debugsource-';then
30       debugsources=$[$debugsources+1]
31       debugsourcesize=$[debugsourcesize+$size]
32       c=$[$c+1]
33     fi
34     if [ $c -ne 1 ];then
35       echo "unparseable: $n"
36       continue
37     fi
38   done
39   echo >&2
40 done
41 echo "debuginfosize=$debuginfosize"
42 echo "debugsourcesize=$debugsourcesize"
43 echo "debuginfos=$debuginfos"
44 echo "debugsources=$debugsources"