summaryrefslogtreecommitdiff
path: root/alpine/update-patch
blob: c6df38d2cddca4aefd4132467ed2d33e23d65f47 (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
#!/bin/bash

cd "$(dirname "$0")"
eval "$(
  sed -n '
    /^source=(/,/)/ p
  ' PKGBUILD
)"

makepkg --verifysource
git -C /usr/src/sonstiges/alpine/ fetch --all -p

sums=$(
  {
    printf '%s\n' "${source[@]}" \
      | sed '
        s/\.patch$//
        t
        s/^.*$/SKIP/
        w /dev/stderr
        d
      ' \
      | while read -r patch; do
        git -C /usr/src/sonstiges/alpine/ diff $(git -C /usr/src/sonstiges/alpine/ merge-base "${patch}" master) "${patch}" -- \
          > "${patch}.patch"
        sha512sum "${patch}.patch" | \
          awk '{print $1}'
      done
  } 2>&1 \
    | sed '
      s/^/'"'"'/
      s/$/'"'"'/
      1  s/^/sha512sums=(/
      1! s/^/            /
      $  s/$/)/
    ' \
    | sed '
      :a
        N
        $! ba
      s/\n/\\n/g
    '
)

sed -i '
  /^sha512sums=(/,/^[^#]*)$/ {
    s/^sha512sums=(.*$/'"${sums}"'/
    t
    d
  }
' PKGBUILD