Skip to content

Commit f045e71

Browse files
committed
Update "versions.sh" to be more forgiving about commit messages (and more strict about only updating once a week)
1 parent 3ff1fb5 commit f045e71

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

versions.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ allBaseVersions="$(
2323
| sort -V
2424
)"
2525

26+
tmp="$(mktemp -d)"
27+
trap "$(printf 'rm -rf %q' "$tmp")" EXIT
28+
2629
for version in "${versions[@]}"; do
2730
export version
2831

@@ -33,21 +36,23 @@ for version in "${versions[@]}"; do
3336
fi
3437

3538
if [ "$version" = 'devel' ]; then
36-
commit="$(git ls-remote https://git.savannah.gnu.org/git/bash.git refs/heads/devel | cut -d$'\t' -f1)"
39+
git clone --quiet --branch devel --depth 10 https://git.savannah.gnu.org/git/bash.git "$tmp/devel"
40+
snapshotDate="$(TZ=UTC date --date 'last monday 23:59:59' '+%Y-%m-%d %H:%M:%S %Z')" # https://github.com/docker-library/faq#can-i-use-a-bot-to-make-my-image-update-prs
41+
commit="$(git -C "$tmp/devel" log --before="$snapshotDate" --format='format:%H' --max-count=1)"
3742
if [ -z "$commit" ]; then
3843
echo >&2 "error: cannot determine commit for $version (from https://git.savannah.gnu.org/cgit/bash.git)"
3944
exit 1
4045
fi
41-
desc="$(
42-
curl -fsSL "https://git.savannah.gnu.org/cgit/bash.git/patch/?id=$commit" 2>/dev/null \
43-
| sed -ne '/^Subject: /{s///p;q}' \
44-
|| :
45-
)"
46+
desc="$(git -C "$tmp/devel" log --max-count=1 --format='format:%s' "$commit")"
4647
[ -n "$desc" ]
47-
timestamp="$(sed -rne '/.*[[:space:]]+bash-([0-9]+)[[:space:]]+.*/s//\1/p' <<<"$desc")"
48-
[ -n "$timestamp" ]
48+
if timestamp="$(sed -rne '/.*[[:space:]]+bash-([0-9]+)[[:space:]]+.*/s//\1/p' <<<"$desc")" && [ -n "$timestamp" ]; then
49+
: # "commit bash-20210305 snapshot"
50+
else
51+
timestamp="$(git -C "$tmp/devel" log --max-count=1 --format='format:%as' "$commit")"
52+
timestamp="${timestamp//-/}"
53+
fi
4954

50-
echo "$version: $commit ($timestamp)"
55+
echo "$version: $commit ($timestamp -- $desc)"
5156

5257
export commit timestamp
5358
json="$(jq <<<"$json" -c '.[env.version] = {

0 commit comments

Comments
 (0)