Skip to content

Commit 692333a

Browse files
committed
Update generate-stackbrew-library.sh from upstream build pack
To reduce further diffs when it will be updated to use versions.json if this happens Ref: https://github.com/docker-library/buildpack-deps/blob/master/generate-stackbrew-library.sh
1 parent 8674356 commit 692333a

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

generate-stackbrew-library.sh

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
#!/bin/bash
2-
set -e
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
33

44
self="$(basename "$BASH_SOURCE")"
55
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
66

7-
# Get the most recent commit which modified any of "$@".
7+
# get the most recent commit which modified any of "$@"
88
fileCommit() {
99
git log -1 --format='format:%H' HEAD -- "$@"
1010
}
1111

12-
# Get the most recent commit which modified "$1/Dockerfile" or any file that
13-
# the Dockerfile copies into the rootfs (with COPY).
14-
dockerfileCommit() {
12+
# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile"
13+
dirCommit() {
1514
local dir="$1"; shift
1615
(
17-
cd "$dir";
18-
fileCommit Dockerfile \
16+
cd "$dir"
17+
fileCommit \
18+
Dockerfile \
1919
$(git show HEAD:./Dockerfile | awk '
2020
toupper($1) == "COPY" {
21-
for (i = 2; i < NF; i++)
22-
print $i;
21+
for (i = 2; i < NF; i++) {
22+
print $i
23+
}
2324
}
2425
')
2526
)
@@ -29,16 +30,17 @@ getArches() {
2930
local repo="$1"; shift
3031
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
3132

32-
eval "declare -g -A parentRepoToArches=( $(
33+
eval "declare -A -g parentRepoToArches=( $(
3334
find -name 'Dockerfile' -exec awk '
34-
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
35+
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
3536
print "'"$officialImagesUrl"'" $2
3637
}
3738
' '{}' + \
3839
| sort -u \
3940
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
4041
) )"
4142
}
43+
getArches 'phpmyadmin'
4244

4345
if ! command -v bashbrew --version &> /dev/null
4446
then
@@ -47,9 +49,6 @@ then
4749
exit 1
4850
fi
4951

50-
getArches 'phpmyadmin'
51-
52-
# Header.
5352
cat <<-EOH
5453
# This file is generated via https://github.com/phpmyadmin/docker/blob/$(fileCommit "$self")/$self
5554
Maintainers: Isaac Bennetch <[email protected]> (@ibennetch),
@@ -67,7 +66,7 @@ join() {
6766
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
6867

6968
for variant in apache fpm fpm-alpine; do
70-
commit="$(dockerfileCommit "$variant")"
69+
commit="$(dirCommit "$variant")"
7170
fullversion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "VERSION" { print $3; exit }')"
7271

7372
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )

0 commit comments

Comments
 (0)