From 0642c9f9a9ef8087e6fa7fe848ee7fe5cc9a13ca Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 9 Jun 2017 17:11:13 -0700 Subject: [PATCH] Add proper Architectures entries in "generate-stackbrew-library.sh" --- generate-stackbrew-library.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 6a8f21d..5de0ec2 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -26,6 +26,22 @@ dirCommit() { ) } +getArches() { + local repo="$1"; shift + local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' + + eval "declare -g -A parentRepoToArches=( $( + find -name 'Dockerfile' -exec awk ' + toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ { + print "'"$officialImagesUrl"'" $2 + } + ' '{}' + \ + | sort -u \ + | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' + ) )" +} +getArches 'memcached' + cat <<-EOH # this file is generated via https://github.com/docker-library/memcached/blob/$(fileCommit "$self")/$self @@ -63,9 +79,13 @@ for variant in debian alpine; do variantAliases=( "${versionAliases[@]}" ) fi + parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")" + arches="${parentRepoToArches[$parent]}" + echo cat <<-EOE Tags: $(join ', ' "${variantAliases[@]}") + Architectures: $(join ', ' $arches) GitCommit: $commit Directory: $variant EOE