Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/watch-versions
blob: 83c70dfb1b7be14774a8b76b7d844724f1f5b686 (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
#!/bin/sh

if [ $# -eq 0 ]; then
  git -C "$(dirname "$0")/../packages" pull --ff-only >/dev/null 2>&1
#  curl -Ss 'https://packages.archlinux32.org/?uses_upstream=Does+Not+Use+Upstream&fuzzy&tsv' 
  curl -Ss 'http://packages.archlinux32.local/?uses_upstream=Does+Not+Use+Upstream&fuzzy&tsv' | \
    {
      read -r headers
      pkgbase_column=$(
        printf '%s\n' "${headers}" | \
          tr '\t' '\n' | \
          grep -nxF 'pkgbase' | \
          cut -d: -f1
      )
      cut -f${pkgbase_column}
    } | \
    sort -u | \
    parallel -j0 "$0"
  exit $?
elif [ $# -gt 1 ]; then
  >&2 echo 'I need zero or one argument.'
  exit 1
fi

pkgbase="$1"
unset pkgver
unset epoch

eval "$(
  git -C "$(dirname "$0")/../packages" archive origin/master -- | \
    tar -Ox --wildcards '*/'"${pkgbase}"'/PKGBUILD' | \
    sed -n '
      /^epoch=/p
      /^pkgver=/p
    '
)"

oldver="${epoch}${epoch+:}${pkgver}"

case "${pkgbase}" in
  'linux-pae')
    url='https://www.kernel.org/pub/linux/kernel/v4.x/'
    regex='<a href="linux-\([0-9.]\+\)\.tar\.sign">'
  ;;
  'pcmciautils')
    url='https://kernel.org/pub/linux/utils/kernel/pcmcia/'
    regex='<a href="pcmciautils-\([0-9.]\+\)\.tar\.sign">'
  ;;
  'archlinux32-keyring'|'archlinux32-keyring-transition')
    url='https://sources.archlinux32.org/sources/'
    regex='<a href="archlinux32-keyring-v\([0-9.]\+\)\.tar\.gz">'
  ;;
esac

newver=$(
  curl -LSs "${url}" | \
    sed -n '
      s/^.*'"${regex}"'.*$/\1/
      T
      p
    ' | \
    sort -V | \
    tail -n1
)

if [ "${newver}" != "${oldver}" ]; then
  printf '%s: %s vs. %s\n' \
    "${pkgbase}" \
    "${newver}" \
    "${oldver}"
fi