File: sizeent

package info (click to toggle)
debian-reference 2.131
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 33,684 kB
  • sloc: python: 586; makefile: 574; sh: 528; sed: 80
file content (45 lines) | stat: -rwxr-xr-x 1,806 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# Copyright (C) 2007 Osamu Aoki <osamu@debian.org>
#
# This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms of
# the GNU General Public License version 2 or later.
#

set -e
#<xsl:variable name="uletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !#$%()=-~^|\/+*,.?;:@`&quot;&apos;&amp;&gt;&lt;</xsl:variable>
#<xsl:variable name="lletters">abcdefghijklmnopqrstuvwxyzabcdefghij</xsl:variable>
packages=$1
bkups=$2
stablepackages=$3
oldstablepackages=$4
while read -r X; do
  #echo "process: $X" >&2
  printf "%s" "." >&2
  PKG=$(echo "$X" | tr "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" "abcdefghijklmnopqrstuvwxyzabcdefghij" |
    tr -d " \!#\$%()=\-~^|\\/+*,.?;:@\`\"'&><")
  if SIZE=$(grep-dctrl -e -n --field=Package --show-field=Installed-Size \
    --pattern="^$(echo "$X" | sed -e 's/\+/\\+/g')\$" "$packages"); then
    echo "<!ENTITY size-${PKG} \"${SIZE}\">"
  elif SIZE=$(grep-dctrl -e -n --field=Package --show-field=Installed-Size \
    --pattern="^$(echo "$X" | sed -e 's/\+/\\+/g')\$" "$bkups"); then
    echo "<!ENTITY size-${PKG} \"${SIZE}(*)\">"
  elif SIZE=$(grep-dctrl -e -n --field=Package --show-field=Installed-Size \
    --pattern="^$(echo "$X" | sed -e 's/\+/\\+/g')\$" "$stablepackages"); then
    echo "<!ENTITY size-${PKG} \"${SIZE}\">"
  elif SIZE=$(grep-dctrl -e -n --field=Package --show-field=Installed-Size \
    --pattern="^$(echo "$X" | sed -e 's/\+/\\+/g')\$" "$oldstablepackages"); then
    echo "<!ENTITY size-${PKG} \"${SIZE}\">"
  else
    echo "<!ENTITY size-${PKG} \"NOT_FOUND\">"
    echo "" >&2
    echo "... ERROR ...: $X, probably a removed or non-amd64 package." >&2
    echo ".............:         See https://tracker.debian.org/" >&2
  fi
done

echo $0 done >&2
#
#
# vim: set sw=2 ai expandtab: