Skip to content

Commit

Permalink
Merge pull request docker-library#475 from docker-library/jq-IN
Browse files Browse the repository at this point in the history
Use jq's `IN()` instead of `index()`
  • Loading branch information
yosifkit authored Oct 16, 2024
2 parents 4e09dcf + d49362d commit 7cb059d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN set -eux; \
{{ if is_alpine then ( -}}
apk add --no-cache --virtual .ruby-builddeps \
autoconf \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
{{ # https://github.com/docker-library/ruby/pull/438 -}}
bison \
{{ ) else "" end -}}
Expand All @@ -87,7 +87,7 @@ RUN set -eux; \
openssl-dev \
patch \
procps \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
readline-dev \
{{ ) else "" end -}}
ruby \
Expand All @@ -100,7 +100,7 @@ RUN set -eux; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
{{ # https://github.com/docker-library/ruby/pull/438 -}}
bison \
{{ ) else "" end -}}
Expand All @@ -115,7 +115,7 @@ RUN set -eux; \
libgdbm-compat-dev \
libglib2.0-dev \
libncurses-dev \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
libreadline-dev \
{{ ) else "" end -}}
libxml2-dev \
Expand Down
4 changes: 2 additions & 2 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ for version in "${versions[@]}"; do
*)
# YJIT
doc="$(jq <<<"$doc" -sc '
.[1][].arches? |= if . then with_entries(select(.key as $arch | [
.[1][].arches? |= if . then with_entries(select(.key | IN(
# https://github.com/ruby/ruby/blob/v3_2_0/doc/yjit/yjit.md ("currently supported for macOS and Linux on x86-64 and arm64/aarch64 CPUs")
# https://github.com/ruby/ruby/blob/v3_2_0/configure.ac#L3757-L3761
"amd64",
"arm64v8",
empty # trailing comma
] | index($arch))) else empty end
))) else empty end
| add
' - rust.json)"
;;
Expand Down

0 comments on commit 7cb059d

Please sign in to comment.