summaryrefslogtreecommitdiff
path: root/liste-verfuegbare-Versionen
blob: 400110812a479ec15ee37b90d6ae6a6ef4f9d437 (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
#!/bin/bash

provided=$(mktemp)

find /var/lib/pacman/sync/ -name '*.db' \
  -not -exec tar -Oxzf {} --wildcards '*/desc' \; \
  -not -exec tar -OxJf {} --wildcards '*/desc' \; \
  -not -exec tar -Oxjf {} --wildcards '*/desc' \; \
  -not -exec tar -Oxf {} --wildcards '*/desc' \; \
2>/dev/null \
| sed -n '
  /^%\(NAME\|VERSION\)%$/ {
    N
    s/\n/ /
    p
  }
  /^%PROVIDES%$/,/^$/ {
    /^[^%]/ p
  }
' \
| sed -n '
  s/=/ /
  T no_provides
  p
  d
  :no_provides
  /^%NAME%/ {
    N
    s/^%NAME% \(\S\+\)\n%VERSION% \(\S\+\)-\S\+$/\2 \1/
    T
    p
  }
' \
| sort -k2,2 -k1Vr,1 \
| uniq -f1 \
>"${provided}"

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