-
Notifications
You must be signed in to change notification settings - Fork 73
Add initial jq-based templating engine #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`versions.sh` Diff:$ git log -p -1 --find-copies-harder --follow -- versions.sh
commit aa3300462176c6ccaff3334d03af59ddc43caea2 (HEAD -> jq-template, infosiftr/jq-template)
Author: Tianon Gravi <admwiggin@gmail.com>
Date: Fri Apr 9 16:41:16 2021 -0700
Add initial jq-based templating engine
diff --git a/update.sh b/versions.sh
similarity index 82%
copy from update.sh
copy to versions.sh
index 927bb08..ff07159 100755
--- a/update.sh
+++ b/versions.sh
@@ -11,6 +11,9 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
+ json='{}'
+else
+ json="$(< versions.json)"
fi
versions=( "${versions[@]%/}" )
@@ -34,8 +37,9 @@ for version in "${versions[@]}"; do
lastModified="$(grep -Em1 '<a href="(gcc-)?'"$fullVersion"'/"' <<<"$packages" | awk -F ' +' '{ print $2 }')"
lastModified="$(date -d "$lastModified" +"$dateFormat")"
- releaseAge="$(( $today - $(date +'%s' -d "$lastModified") ))"
- if [ $releaseAge -gt $eolAge ]; then
+ lastModifiedTime="$(date +'%s' -d "$lastModified")"
+ releaseAge="$(( today - lastModifiedTime ))"
+ if [ "$releaseAge" -gt "$eolAge" ]; then
eols+=( "$version ($fullVersion)" )
fi
eolDate="$(date -d "$lastModified + $eolPeriod" +"$dateFormat")"
@@ -59,14 +63,16 @@ for version in "${versions[@]}"; do
echo "$version: $fullVersion ($lastModified vs $eolDate); $debianSuite, $compression"
- sed -r \
- -e 's!%%SUITE%%!'"$debianSuite"'!g' \
- -e 's!^(ENV GCC_VERSION) .*!\1 '"$fullVersion"'!' \
- -e 's!^(# Last Modified:) .*!\1 '"$lastModified"'!' \
- -e 's!^(# Docker EOL:) .*!\1 '"$eolDate"'!' \
- -e 's!%%TARBALL-COMPRESSION%%!'"$compression"'!g' \
- Dockerfile.template \
- > "$version/Dockerfile"
+ export version fullVersion lastModified eolDate debianSuite compression
+ json="$(jq <<<"$json" -c '
+ .[env.version] = {
+ version: env.fullVersion,
+ lastModified: env.lastModified,
+ eol: env.eolDate,
+ debian: env.debianSuite,
+ compression: env.compression,
+ }
+ ')"
done
if [ ${#eols[@]} -gt 0 ]; then
@@ -84,3 +90,5 @@ if [ ${#eols[@]} -gt 0 ]; then
echo
} >&2
fi
+
+jq <<<"$json" -S . > versions.json `generate-stackbrew-library.sh` Diff:$ diff -u <(bashbrew cat gcc) <(bashbrew cat <(./generate-stackbrew-library.sh))
--- /dev/fd/63 2021-04-09 16:44:22.238402544 -0700
+++ /dev/fd/62 2021-04-09 16:44:22.238402544 -0700
@@ -3,15 +3,15 @@
Tags: 10.3.0, 10.3, 10, latest
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 15b89bbc6190e30a0dd657473e0cc9bfbd13610d
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 10
Tags: 9.3.0, 9.3, 9
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 9
Tags: 8.4.0, 8.4, 8
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 8 Again With Comments Diff:$ diff -u <(wget -qO- 'https://github.com/docker-library/official-images/raw/master/library/gcc') <(./generate-stackbrew-library.sh)
--- /dev/fd/63 2021-04-09 16:45:22.404751777 -0700
+++ /dev/fd/62 2021-04-09 16:45:22.404751777 -0700
@@ -1,4 +1,4 @@
-# this file is generated via https://github.com/docker-library/gcc/blob/7f1fc5e8be598446b2546b808572db546e959643/generate-stackbrew-library.sh
+# this file is generated via https://github.com/docker-library/gcc/blob/aa3300462176c6ccaff3334d03af59ddc43caea2/generate-stackbrew-library.sh
Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),
Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
@@ -7,20 +7,20 @@
# Last Modified: 2021-04-08
Tags: 10.3.0, 10.3, 10, latest
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 15b89bbc6190e30a0dd657473e0cc9bfbd13610d
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 10
# Docker EOL: 2022-10-08
# Last Modified: 2020-03-12
Tags: 9.3.0, 9.3, 9
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 9
# Docker EOL: 2021-09-12
# Last Modified: 2020-03-04
Tags: 8.4.0, 8.4, 8
Architectures: amd64, arm32v5, arm32v7, arm64v8, ppc64le, s390x
-GitCommit: 05aef2fc627328e12bbf77aca44fd399a22c7fc4
+GitCommit: aa3300462176c6ccaff3334d03af59ddc43caea2
Directory: 8
# Docker EOL: 2021-09-04 |
yosifkit
approved these changes
Apr 12, 2021
docker-library-bot
added a commit
to docker-library-bot/official-images
that referenced
this pull request
Apr 12, 2021
Changes: - docker-library/gcc@05ff5c9: Merge pull request docker-library/gcc#72 from infosiftr/jq-template - docker-library/gcc@aa33004: Add initial jq-based templating engine
docker-library-bot
added a commit
to docker-library-bot/official-images
that referenced
this pull request
Apr 29, 2021
Changes: - docker-library/gcc@9c37e98: Merge pull request docker-library/gcc#74 from infosiftr/11 - docker-library/gcc@bb63178: Add 11.1 - docker-library/gcc@05ff5c9: Merge pull request docker-library/gcc#72 from infosiftr/jq-template - docker-library/gcc@aa33004: Add initial jq-based templating engine
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See also docker-library/php#1052 (and linked PRs).
(This will make test builds a lot less taxing on our poor overworked @docker-library-bot ❤️)