From e2331f5270734548c19c828089811a3c408b2141 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 25 Jun 2019 16:32:58 -0700 Subject: [PATCH] Add "--with-pear" in 7.4 This means that `pear` and `pecl` will be available for PHP 7.4+, but *will be removed* in PHP 8+ (see https://externals.io/message/103977 for upstream discussion around this deprecation). I tested the 8+ changes to this script by creating a few fake "8.0" bits in the script itself (fake `possibles` version, etc) and verified that the result is as expected. --- 7.4-rc/alpine3.10/cli/Dockerfile | 6 ++++++ 7.4-rc/alpine3.10/fpm/Dockerfile | 6 ++++++ 7.4-rc/alpine3.10/zts/Dockerfile | 6 ++++++ 7.4-rc/alpine3.9/cli/Dockerfile | 6 ++++++ 7.4-rc/alpine3.9/fpm/Dockerfile | 6 ++++++ 7.4-rc/alpine3.9/zts/Dockerfile | 6 ++++++ 7.4-rc/stretch/apache/Dockerfile | 6 ++++++ 7.4-rc/stretch/cli/Dockerfile | 6 ++++++ 7.4-rc/stretch/fpm/Dockerfile | 6 ++++++ 7.4-rc/stretch/zts/Dockerfile | 6 ++++++ Dockerfile-alpine.template | 3 +++ Dockerfile-debian.template | 3 +++ update.sh | 30 +++++++++++++++++++++++------- 13 files changed, 89 insertions(+), 7 deletions(-) diff --git a/7.4-rc/alpine3.10/cli/Dockerfile b/7.4-rc/alpine3.10/cli/Dockerfile index e34b13a2df..c120abab24 100644 --- a/7.4-rc/alpine3.10/cli/Dockerfile +++ b/7.4-rc/alpine3.10/cli/Dockerfile @@ -144,6 +144,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -172,6 +175,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/alpine3.10/fpm/Dockerfile b/7.4-rc/alpine3.10/fpm/Dockerfile index 44991455d0..c9244155d1 100644 --- a/7.4-rc/alpine3.10/fpm/Dockerfile +++ b/7.4-rc/alpine3.10/fpm/Dockerfile @@ -145,6 +145,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -173,6 +176,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/alpine3.10/zts/Dockerfile b/7.4-rc/alpine3.10/zts/Dockerfile index c012a2a0ab..0828e2c605 100644 --- a/7.4-rc/alpine3.10/zts/Dockerfile +++ b/7.4-rc/alpine3.10/zts/Dockerfile @@ -145,6 +145,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -173,6 +176,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/alpine3.9/cli/Dockerfile b/7.4-rc/alpine3.9/cli/Dockerfile index 5108eb6a13..4044a53e49 100644 --- a/7.4-rc/alpine3.9/cli/Dockerfile +++ b/7.4-rc/alpine3.9/cli/Dockerfile @@ -144,6 +144,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -172,6 +175,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/alpine3.9/fpm/Dockerfile b/7.4-rc/alpine3.9/fpm/Dockerfile index 4a32f8b905..d8851dcb17 100644 --- a/7.4-rc/alpine3.9/fpm/Dockerfile +++ b/7.4-rc/alpine3.9/fpm/Dockerfile @@ -145,6 +145,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -173,6 +176,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/alpine3.9/zts/Dockerfile b/7.4-rc/alpine3.9/zts/Dockerfile index b0cfe0d300..52497e824d 100644 --- a/7.4-rc/alpine3.9/zts/Dockerfile +++ b/7.4-rc/alpine3.9/zts/Dockerfile @@ -145,6 +145,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -173,6 +176,9 @@ RUN set -eux; \ \ apk del --no-network .build-deps; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/stretch/apache/Dockerfile b/7.4-rc/stretch/apache/Dockerfile index 6329a66240..4892415ec3 100644 --- a/7.4-rc/stretch/apache/Dockerfile +++ b/7.4-rc/stretch/apache/Dockerfile @@ -234,6 +234,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -266,6 +269,9 @@ RUN set -eux; \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/stretch/cli/Dockerfile b/7.4-rc/stretch/cli/Dockerfile index 9c9f9f243f..41e5a97a92 100644 --- a/7.4-rc/stretch/cli/Dockerfile +++ b/7.4-rc/stretch/cli/Dockerfile @@ -174,6 +174,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -206,6 +209,9 @@ RUN set -eux; \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/stretch/fpm/Dockerfile b/7.4-rc/stretch/fpm/Dockerfile index 70793c5cdd..0d91f78112 100644 --- a/7.4-rc/stretch/fpm/Dockerfile +++ b/7.4-rc/stretch/fpm/Dockerfile @@ -175,6 +175,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -207,6 +210,9 @@ RUN set -eux; \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/7.4-rc/stretch/zts/Dockerfile b/7.4-rc/stretch/zts/Dockerfile index 20c6c63c61..4e72f75b9b 100644 --- a/7.4-rc/stretch/zts/Dockerfile +++ b/7.4-rc/stretch/zts/Dockerfile @@ -175,6 +175,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ @@ -207,6 +210,9 @@ RUN set -eux; \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ # smoke test php --version diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 5fd1d9c6d3..5fedc4f575 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -138,6 +138,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 8c901b86f2..df37b04e60 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -168,6 +168,9 @@ RUN set -eux; \ --with-openssl \ --with-zlib \ \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ # bundled pcre does not support JIT on s390x # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ diff --git a/update.sh b/update.sh index dc55a4f5de..1d16e5c03b 100755 --- a/update.sh +++ b/update.sh @@ -165,10 +165,17 @@ for version in "${versions[@]}"; do sed -ri \ -e '/oniguruma-dev|libonig-dev/d' \ "$version/$suite/$variant/Dockerfile" - else - # 7.4 and above no longer include pecl/pear: https://github.com/php/php-src/pull/3781 + fi + if [ "$majorVersion" -ge '8' ]; then + # 8 and above no longer include pecl/pear (see https://github.com/docker-library/php/issues/846#issuecomment-505638494) + sed -ri \ + -e '/pear |pearrc|pecl.*channel/d' \ + "$version/$suite/$variant/Dockerfile" + fi + if [ "$majorVersion" != '7' ] || [ "$minorVersion" -lt '4' ]; then + # --with-pear is only relevant on PHP 7, and specifically only 7.4+ (see https://github.com/docker-library/php/issues/846#issuecomment-505638494) sed -ri \ - -e '\!pecl.*channel|/tmp/pear!d' \ + -e '/--with-pear/d' \ "$version/$suite/$variant/Dockerfile" fi if [ "$majorVersion" = '7' -a "$minorVersion" -lt '2' ]; then @@ -184,10 +191,19 @@ for version in "${versions[@]}"; do fi # remove any _extra_ blank lines created by the deletions above - awk ' - NF > 0 { blank = 0 } - NF == 0 { ++blank } - blank < 2 { print } + gawk ' + { + if (NF == 0 || (NF == 1 && $1 == "\\")) { + blank++ + } + else { + blank = 0 + } + + if (blank < 2) { + print + } + } ' "$version/$suite/$variant/Dockerfile" > "$version/$suite/$variant/Dockerfile.new" mv "$version/$suite/$variant/Dockerfile.new" "$version/$suite/$variant/Dockerfile"