summaryrefslogtreecommitdiff
path: root/manualPorts/alpine/lastVersion.sh
blob: 4055339cd1b60491549546ba0e834814d4a0ff56 (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 -C /usr/src/sonstiges/alpine fetch --all -p >/dev/null 2>&1

release_version=$(
  sed -n '
    /^\s*VERSION\s*=/!d
    s/^.*=\s*//
    s/['"'"'"]//g
    /^\$/d
    p
  ' /usr/src/sonstiges/alpine/configure
)
line=$(
  sed -n '
    /^\s*VERSION\s*=\s*['"'"'"]*\$/d
    /^\s*VERSION\s*=/ =
  ' /usr/src/sonstiges/alpine/configure
)
release_commit=$(
  git -C /usr/src/sonstiges/alpine blame -L${line},${line} -- configure | \
    awk '{print $1}'
)
head_rev=$(
  git -C /usr/src/sonstiges/alpine rev-parse --short upstream/master
)
post_release_commits=$(
  git -C /usr/src/sonstiges/alpine rev-list --count "${head_rev}" "^${release_commit}"
)

printf '%s.r%s.%s\n' \
  "${release_version}" \
  "${post_release_commits}" \
  "${head_rev}"