1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#!/bin/sh
BDIR=$1
ADIR=$2
IN="$3"
OUT="$4"
echo "DONEDONE" > $BDIR/DONE
awk -v max_size=$MAX_PKG_SIZE '
/^Package:/ {
srcname=$2
srcs_done++
}
/^Version:/ {
version=$2
# Cannot cope with : in output
gsub(":", "%", version)
if (srcname in versions) {
versions[srcname]=sprintf("%s:%s", versions[srcname], version)
} else {
versions[srcname]=version
}
next
}
/^Section: non-free/ {
component[srcname]="non-free"
next
}
/^Section: non-free-firmware/ {
component[srcname]="non-free-firmware"
next
}
/^Section: contrib/ {
component[srcname]="contrib"
next
}
/^Section:/ {
component[srcname]="main"
next
}
/^DONEDONE/ {
parsed=1
next
}
/^Files:/ {
in_files = 1
next
}
/^ / {
if (in_files) {
size[srcname]+=$2
sizes[srcname, version]+=$2
next
}
}
/.*/ {
in_files = 0
if (parsed) {
if (size[$0] > max_size) {
printf("source:%s:%s-SRCTOOBIG\n", component[$0], $0)
} else {
num_versions = split(versions[$0], vers_this, ":")
for(i = 1; i <= num_versions; i++) {
printf("source:%s:%s:%s:%s\n", component[$0], $0, sizes[$0, vers_this[i]], vers_this[i])
}
}
}
}
' $ADIR/$CODENAME-source/apt-state/lists/*Sources $BDIR/DONE $IN > $BDIR/list.mid
if [ "$NONFREE"x = "1"x ] ; then
grep -v SRCTOOBIG $BDIR/list.mid > $OUT
else
grep -v \
-e :non-free: \
-e :non-free-firmware: \
-e SRCTOOBIG $BDIR/list.mid > $OUT
fi
if [ "$EXTRANONFREE"x = "1"x ] ; then
for COMPONENT in $NONFREE_COMPONENTS; do
grep :"$COMPONENT": $BDIR/list.mid | grep -v SRCTOOBIG >> $OUT
done
fi
awk -F : '
/SRCTOOBIG/ { print $3 }
' $BDIR/list.mid > $BDIR/sourcetoobig
|