summaryrefslogtreecommitdiff
path: root/liste-verfuegbare-Versionen
blob: 1c645e4a88d83c87a07234dfe5be063a8c6cdba3 (plain)
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
#!/bin/bash

export LC_ALL=C

if [ $# -eq 2 ]; then
  dist="$1"
  arch="$2"
else
  dist='arch'
  arch='x86_64'
fi

provided=$(mktemp --suffix=".${dist}.${arch}")

sources=(
  "http://pkgcache.eckner.net/${dist}/${arch}/${dist}linuxewe/${dist}linuxewe.db.tar.gz"
)
if [ "${dist}" = 'arch' ]; then
  sources+=(
    "http://pkgcache.eckner.net/${dist}/${arch}/core/core.db.tar.gz"
    "http://pkgcache.eckner.net/${dist}/${arch}/extra/extra.db.tar.gz"
  )
else
  sources+=(
    "http://pkgcache.eckner.net/${dist}/${arch}/system/system.db.tar.gz"
    "http://pkgcache.eckner.net/${dist}/${arch}/world/world.db.tar.gz"
    "http://pkgcache.eckner.net/${dist}/${arch}/galaxy/galaxy.db.tar.gz"
  )
fi

for i in "${!sources[@]}"; do
  source="${sources["${i}"]}"
  if [ -z "${source##*://*}" ]; then
    curl -Ss "${source}" \
    | bsdtar -Oxz
  else
    find "${sources["${i}"]}" -name '*.db' \
      -exec bsdtar -Oxzf {} \; \
    2>/dev/null
  fi \
  | sed -n '
    /^%\(NAME\|VERSION\)%$/ {
      N
      s/\n/ /
      p
    }
    /^%PROVIDES%$/,/^$/ {
      /^[^%]/ p
    }
  ' \
  | sed -n '
    s/^\(\S\+\)=\(\S\+\)-\(64\|32\)$/\2 \1/
    T no_provides
    p
    d
    :no_provides
    /^%NAME%/ {
      N
      s/^%NAME% \(\S\+\)\n%VERSION% \(\S\+\)-\S\+$/\2 \1/
      T
      p
    }
  ' \
  | sed '
    /^\(\S\+\) \1$/d
    s/^/'"${i}"' /
  '
done \
| sort -k3,3 -k1n,1 -k2Vr,2 \
| uniq -f2 \
| cut -d' ' -f2,3 \
>"${provided}"

printf '%s\n' "${provided}"