From 7ce97ab6ed5b19c11932161186fc4b38090a047c Mon Sep 17 00:00:00 2001 From: Fred Cox Date: Fri, 18 Sep 2020 14:05:53 +0300 Subject: [PATCH 1/4] Support for using pickle as drop in for pecl on php 8 --- data/supported-extensions | 84 +++++++++++++++++++------------------- install-php-extensions | 33 ++++++++++++--- scripts/ci-test-extensions | 3 ++ 3 files changed, 73 insertions(+), 47 deletions(-) diff --git a/data/supported-extensions b/data/supported-extensions index fedce51..62e4c16 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -1,81 +1,81 @@ amqp 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -apcu 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -apcu_bc 7.0 7.1 7.2 7.3 7.4 -bcmath 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -bz2 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -calendar 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +apcu 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 +apcu_bc 7.0 7.1 7.2 7.3 7.4 8.0 +bcmath 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 +bz2 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 +calendar 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 cmark 7.0 7.1 7.2 7.3 7.4 -dba 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +dba 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 decimal 7.0 7.1 7.2 7.3 7.4 -enchant 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -exif 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -ffi 7.4 +enchant 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 +exif 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 +ffi 7.4 8.0 gd 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -gettext 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +gettext 5.5 5.6 7.0 7.1 7.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2 7.3 7.4 -xsl 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +xsl 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 yaml 5.5 5.6 7.0 7.1 7.2 7.3 7.4 -zip 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +zip 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 zookeeper 5.5 5.6 7.0 7.1 7.2 7.3 7.4 diff --git a/install-php-extensions b/install-php-extensions index 8da564e..3f128e2 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1355,8 +1355,7 @@ installPECLModule() { if test "$1" != "$installPECLModule_actual"; then printf ' (installing version %s)\n' "$installPECLModule_actual" fi - pecl channel-update pecl.php.net || true - printf "$installPECLModule_stdin" | MAKE="make -j$(getCompilationProcessorCount $1)" pecl install "$installPECLModule_actual" + printf "$installPECLModule_stdin" | MAKE="make -j$(getCompilationProcessorCount $1)" $PECL_COMMAND "$installPECLModule_actual" fi case "$1" in apcu_bc) @@ -1377,6 +1376,27 @@ installPECLModule() { esac } +# Installs pickle to use instead of pecl +# and add the zip extension that it requires, making sure its installed first +installPickle() { + for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do + if ! stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then + if test $PHP_MAJMIN_VERSION -lt 800; then + pecl channel-update pecl.php.net || true + PECL_COMMAND="pecl install" + return + fi + curl -L -f https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o /tmp/pickle + chmod +x /tmp/pickle + if ! stringInList 'zip' "$(getPHPInstalledModules)"; then + PHP_MODULES_TO_INSTALL="zip $(removeStringFromList 'zip' "$PHP_MODULES_TO_INSTALL")" + fi + PECL_COMMAND="/tmp/pickle install --defaults" + return + fi + done +} + # Check if a string is in a list of space-separated string # # Arguments: @@ -1457,6 +1477,7 @@ cleanup() { docker-php-source delete rm -rf /tmp/pear rm -rf /tmp/src + rm -rf /tmp/pickle } resetIFS @@ -1465,7 +1486,7 @@ IPE_ERRFLAG_FILE="$(mktemp -p /tmp/src)" setDistro setPHPMajorMinor case "$PHP_MAJMIN_VERSION" in - 505 | 506 | 700 | 701 | 702 | 703 | 704) ;; + 505 | 506 | 700 | 701 | 702 | 703 | 704 | 800) ;; *) printf "### ERROR: Unsupported PHP version: %s.%s ###\n" $((PHP_MAJMIN_VERSION / 100)) $((PHP_MAJMIN_VERSION % 100)) ;; @@ -1479,12 +1500,14 @@ fi sortModulesToInstall +docker-php-source extract +BUNDLED_MODULES="$(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | xargs -n1 dirname | xargs -n1 basename | xargs)" +installPickle + buildRequiredPackageLists $PHP_MODULES_TO_INSTALL if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then installRequiredPackages fi -docker-php-source extract -BUNDLED_MODULES="$(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | xargs -n1 dirname | xargs -n1 basename | xargs)" for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do if stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then installBundledModule "$PHP_MODULE_TO_INSTALL" diff --git a/scripts/ci-test-extensions b/scripts/ci-test-extensions index 47ba0e6..01f0ebb 100755 --- a/scripts/ci-test-extensions +++ b/scripts/ci-test-extensions @@ -109,6 +109,9 @@ filterUnsupportedExensionsForDistro() { # the full docker image ID getDockerImageName() { case "$2" in + 8.0) + getDockerImageName_version="$2-rc" + ;; *) getDockerImageName_version="$2" ;; From 01c511fbebe5947a54fcc1e0b17fa4faae8d6e08 Mon Sep 17 00:00:00 2001 From: Fred Cox Date: Fri, 18 Sep 2020 21:22:23 +0300 Subject: [PATCH 2/4] Fix gd test --- data/supported-extensions | 2 +- scripts/tests/gd.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/supported-extensions b/data/supported-extensions index 62e4c16..0337d06 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -10,7 +10,7 @@ decimal 7.0 7.1 7.2 7.3 7.4 enchant 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 exif 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 ffi 7.4 8.0 -gd 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +gd 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 gettext 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 gmagick 5.5 5.6 7.0 7.1 7.2 7.3 7.4 gmp 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 diff --git a/scripts/tests/gd.php b/scripts/tests/gd.php index f7b562b..e9406a0 100644 --- a/scripts/tests/gd.php +++ b/scripts/tests/gd.php @@ -55,7 +55,7 @@ try { $image2 = $loadFuntion($tempFile); unlink($tempFile); $tempFile = null; - if (!is_resource($image2) || imagesx($image2) !== $imageWidth || imagesy($image2) !== $imageHeight) { + if (!(is_resource($image2) || is_object($image2)) || imagesx($image2) !== $imageWidth || imagesy($image2) !== $imageHeight) { throw new Exception("{$loadFuntion}() failed"); } imagedestroy($image2); From f15031994ba229a46147a4b328de7588997cee2e Mon Sep 17 00:00:00 2001 From: Fred Cox Date: Fri, 18 Sep 2020 21:02:07 +0300 Subject: [PATCH 3/4] fixes for enchant extension on alpine3.12 disable enchant on some version/distro combos --- .github/workflows/test-extensions.yml | 1 + data/special-requirements | 1 + install-php-extensions | 13 ++++++++++--- scripts/ci-test-extensions | 17 ++++++++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-extensions.yml b/.github/workflows/test-extensions.yml index 06662fb..2533327 100644 --- a/.github/workflows/test-extensions.yml +++ b/.github/workflows/test-extensions.yml @@ -51,6 +51,7 @@ jobs: - alpine3.9 - alpine3.10 - alpine3.11 + - alpine3.12 - jessie - stretch - buster diff --git a/data/special-requirements b/data/special-requirements index 9b5a884..a7666b6 100644 --- a/data/special-requirements +++ b/data/special-requirements @@ -1,3 +1,4 @@ parallel zts pthreads zts tdlib !alpine3.7 !jessie +enchant !7.2-alpine3.12 !7.3-alpine3.12 !7.4-alpine3.12 diff --git a/install-php-extensions b/install-php-extensions index 3f128e2..35989bf 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -27,7 +27,9 @@ setDistro() { exit 1 fi DISTRO="$(cat /etc/os-release | grep -E ^ID= | cut -d = -f 2)" - DISTRO_VERSION="$(printf '%s@%s' $DISTRO $(cat /etc/os-release | grep -E ^VERSION_ID= | cut -d = -f 2 | cut -d '"' -f 2 | cut -d . -f 1,2))" + DISTRO_VERSION_NUMBER="$(cat /etc/os-release | grep -E ^VERSION_ID= | cut -d = -f 2 | cut -d '"' -f 2 | cut -d . -f 1,2)" + DISTRO_VERSION="$(printf '%s@%s' $DISTRO $DISTRO_VERSION_NUMBER)" + DISTRO_MAJMIN_VERSION="$(echo "$DISTRO_VERSION_NUMBER" | awk -F. '{print $1*100+$2}')" } # Set the PHP_MAJMIN_VERSION variable containing the PHP Major-Minor version as an integer value, in format MMmm (example: 506 for PHP 5.6.15) @@ -241,8 +243,13 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmpdec-dev" ;; enchant@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev" + if test $DISTRO_MAJMIN_VERSION -ge 312; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant2" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant2-dev" + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev" + fi ;; enchant@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a" diff --git a/scripts/ci-test-extensions b/scripts/ci-test-extensions index 01f0ebb..af11872 100755 --- a/scripts/ci-test-extensions +++ b/scripts/ci-test-extensions @@ -211,7 +211,22 @@ getAllPHPVersionsForExtension() { fi done done <"$CI_BUILD_DIR/data/supported-extensions" - printf '%s' "$getAllPHPVersionsForExtension_result" + + filterUnsupportedExensionsForDistro_reqs="$CI_BUILD_DIR/data/special-requirements" + if test -f "$filterUnsupportedExensionsForDistro_reqs"; then + getAllPHPVersionsForExtension_filtered_result='' + for getAllPHPVersionsForExtension_result_filter in $getAllPHPVersionsForExtension_result; do + if stringInList "!$getAllPHPVersionsForExtension_result_filter-$DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$1[ \t]")"; then + printf 'Note: extension "%s" is not supported for distro "%s" using php "%s"\n' "$1" "$DOCKER_DISTRO" "$getAllPHPVersionsForExtension_result_filter" >/dev/stderr + else + getAllPHPVersionsForExtension_filtered_result="$getAllPHPVersionsForExtension_filtered_result $getAllPHPVersionsForExtension_result_filter" + fi + done + else + getAllPHPVersionsForExtension_filtered_result="$getAllPHPVersionsForExtension_result" + fi + + printf '%s' "${getAllPHPVersionsForExtension_filtered_result# }" } # Test extensions From efeada0806cb421e817f243cf6346002ed01198d Mon Sep 17 00:00:00 2001 From: Fred Cox Date: Fri, 18 Sep 2020 21:22:39 +0300 Subject: [PATCH 4/4] Make the test script easy to use locally --- scripts/ci-test-extensions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ci-test-extensions b/scripts/ci-test-extensions index af11872..a0d17cf 100755 --- a/scripts/ci-test-extensions +++ b/scripts/ci-test-extensions @@ -157,6 +157,10 @@ getDockerImageName() { # Outputs: # the space-separated list of supported PHP versions getAllPHPVersionsForExtensions() { + if test -n "${PHP_VERSION_TO_TEST:-}"; then + echo "$PHP_VERSION_TO_TEST" + return + fi getAllPHPVersionsForExtensions_result='' IFS=' ' for getAllPHPVersionsForExtensions_extension in $1; do