Use jq's IN() instead of index()

The end result is the same, but the construction is more ergonomic.
This commit is contained in:
Tianon Gravi
2024-10-16 14:54:36 -07:00
parent 39c19b7c18
commit cde742a8d3

View File

@ -103,7 +103,7 @@ RUN set -eux; \
"$APACHE_LOCK_DIR" \
"$APACHE_RUN_DIR" \
"$APACHE_LOG_DIR" \
{{ if [ "bullseye" ] | index(env.suite) then "" else ( -}}
{{ if env.suite == "bullseye" then "" else ( -}}
# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205
"$APACHE_RUN_DIR/socks" \
{{ ) end -}}
@ -326,7 +326,7 @@ RUN set -eux; \
# https://github.com/docker-library/php/issues/822
--with-pic \
\
{{ if [ "8.1" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") == "8.1" then ( -}}
# --enable-ftp is included here for compatibility with existing versions. ftp_ssl_connect() needed ftp to be compiled statically before PHP 7.0 (see https://github.com/docker-library/php/issues/236).
--enable-ftp \
{{ ) else "" end -}}
@ -348,7 +348,7 @@ RUN set -eux; \
--with-readline \
--with-zlib \
\
{{ if [ "cli", "zts" ] | index(env.variant) then ( -}}
{{ if env.variant | IN("cli", "zts") then ( -}}
# https://github.com/docker-library/php/pull/1259
--enable-phpdbg \
--enable-phpdbg-readline \
@ -360,7 +360,7 @@ RUN set -eux; \
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
--with-pear \
\
{{ if [ "8.1", "8.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+)
# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c
# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib
@ -374,7 +374,7 @@ RUN set -eux; \
--with-libdir="lib/$debMultiarch" \
{{ ) end -}}
{{ # https://github.com/docker-library/php/issues/280 -}}
{{ if [ "cli", "zts" ] | index(env.variant) then "" else ( -}}
{{ if env.variant | IN("cli", "zts") then "" else ( -}}
\
--disable-cgi \
{{ ) end -}}
@ -397,7 +397,7 @@ RUN set -eux; \
--enable-zts \
# https://externals.io/message/118859
--disable-zend-signals \
{{ if [ "8.1", "8.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
--enable-zend-max-execution-timers \
{{ ) else "" end -}}
{{ ) else "" end -}}