summaryrefslogtreecommitdiff
path: root/manualPorts/alpine/lastVersion.sh
blob: 29d58b2896aab9d9bcec160989333345c2afe334 (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
#!/bin/bash

GIT='git -C /usr/src/sonstiges/alpine'

${GIT} fetch --all -p >/dev/null 2>&1

revision=$(
  ${GIT} rev-parse --short upstream/master
)
version=$(
  ${GIT} archive "${revision}" -- configure | \
    tar -Ox | \
    sed -n '
      /^\s*VERSION\s*=/!d
      =
      s/^.*=\s*//
      s/['"'"'"]//g
      p
      q
    ' | \
    sed '
      N
      s/\n/ /
    '
)
line=${version% *}
pkgver=${version#* }
rev_count=$(
  ${GIT} rev-list "${revision}" ^$(${GIT} blame -L${line},${line} "${revision}" -- configure | cut -d' ' -f1) --count
)
printf '%s.r%s.%s\n' \
  "${pkgver}" \
  "${rev_count}" \
  "${revision}"