From 9c33fa11b5ce4a54fdef681321d192d0cce96251 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Dec 2019 11:50:42 +0100 Subject: [PATCH 1/4] Fix handling of buildRequiredPackageLists output --- install-php-extensions | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index 813be75..76fa701 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -180,10 +180,6 @@ sortModulesToInstall() { # Set: # PACKAGES_PERSISTENT # PACKAGES_VOLATILE -# -# Return: -# 0 (true): if we to install some package -# 1 (false): if no package is required buildRequiredPackageLists() { buildRequiredPackageLists_persistent='' buildRequiredPackageLists_volatile='' @@ -555,7 +551,7 @@ buildRequiredPackageLists() { PACKAGES_PERSISTENT='' PACKAGES_VOLATILE='' if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then - return 0 + return fi case "$buildRequiredPackageLists_distro" in alpine) @@ -1159,7 +1155,8 @@ fi sortModulesToInstall -if buildRequiredPackageLists $PHP_MAJMIN_VERSION $PHP_MODULES_TO_INSTALL; then +buildRequiredPackageLists $PHP_MAJMIN_VERSION $PHP_MODULES_TO_INSTALL +if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then installRequiredPackages fi docker-php-source extract From d21ab4af58c0b51acb2916ae02667330578eedbf Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Dec 2019 11:51:19 +0100 Subject: [PATCH 2/4] Simplify handling of available docker images Test: amqp+zip --- scripts/travisci-test-extensions | 127 +++++-------------------------- 1 file changed, 18 insertions(+), 109 deletions(-) diff --git a/scripts/travisci-test-extensions b/scripts/travisci-test-extensions index 34d3eba..23ea899 100755 --- a/scripts/travisci-test-extensions +++ b/scripts/travisci-test-extensions @@ -28,123 +28,29 @@ getDockerImageName() { getDockerImageName_version="$2" ;; esac - getDockerImageName_suffix='-cli' + getDockerImageName_suffix='cli' getDockerImageName_reqs="$TRAVIS_BUILD_DIR/data/special-requirements" if test -f "$getDockerImageName_reqs"; then IFS=' ' for getDockerImageName_testExtension in $1; do if test -n "$(cat "$getDockerImageName_reqs" | grep -E "^$getDockerImageName_testExtension[ \t]+zts[ \t]*$")"; then - getDockerImageName_suffix="-zts" + getDockerImageName_suffix='zts' fi done fi - getDockerImageName_distro="-$DOCKER_DISTRO" - case "$DOCKER_DISTRO" in - alpine3.4) - # available for PHP from version 5.6 to version 7.1 - case "$2" in - 5.* | 7.0 | 7.1) ;; - *) - return - ;; - esac - ;; - alpine3.6) - # available for PHP 7.2 - case "$2" in - 7.2) ;; - *) - return - ;; - esac - ;; - alpine3.7) - # available for PHP from version 5.6 to version 7.2 - # default Alpine one for PHP 7.0 - case "$2" in - 7.0) - #getDockerImageName_distro='-alpine' - ;; - 5.* | 7.1 | 7.2) ;; - *) - return - ;; - esac - ;; - alpine3.8) - # available for PHP from version 5.6 to version 7.3 (except PHP 7.0) - # default Alpine one for PHP 5.6 - case "$2" in - 5.6) - #getDockerImageName_distro='-alpine' - ;; - 5.* | 7.1 | 7.2 | 7.3) ;; - *) - return - ;; - esac - ;; - alpine3.9) - # available for PHP from version 7.1 to version 7.3 - case "$2" in - 7.1 | 7.2 | 7.3) ;; - *) - return - ;; - esac - ;; - alpine3.10) - # available for PHP from version 7.1 - # default Alpine one for PHP 7.1 -> 7.4 - case "$2" in - 7.1 | 7.2 | 7.3 | 7.4) - #getDockerImageName_distro='-alpine' - ;; - 5.* | 7.0) - return - ;; - esac - ;; - jessie) # Debian 8 - # available for PHP up to version 7.1 - case "$2" in - 5.* | 7.0 | 7.1) ;; - *) - return - ;; - esac - ;; - stretch) # Debian 9 - # available for PHP up to version 7.3 - # default one for PHP 5.6 -> 7.0 - case "$2" in - 5.* | 7.0) - #getDockerImageName_distro='' - ;; - 7.1 | 7.2 | 7.3) ;; - *) - return - ;; - esac - ;; - buster) # Debian 10 - # available for PHP from version 7.1 - # default one for PHP 7.1 -> 7.4 - case "$2" in - 7.1 | 7.2 | 7.3 | 7.4) - #getDockerImageName_distro='' - ;; - 5.* | 7.0) - return - ;; - esac - ;; - *) - printf 'Unrecognized value of DOCKER_DISTRO environment variable (%s)\n' "$DOCKER_DISTRO" >&2 - return 1 - ;; - esac - printf 'php:%s%s%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$getDockerImageName_distro" + getDockerImageName_imageName="$(printf 'php:%s-%s-%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$DOCKER_DISTRO")" + if test -z "$(docker images -q "$getDockerImageName_imageName" 2>/dev/null)"; then + getDockerImageName_log="$(docker pull "$getDockerImageName_imageName" 2>&1 || true)" + if test -z "$(docker images -q "$getDockerImageName_imageName" 2>/dev/null)"; then + if test "${getDockerImageName_log#*manifest unknown}" != "$getDockerImageName_log" || test "${getDockerImageName_log#*manifest for * not found}" != "$getDockerImageName_log"; then + true + return + fi + printf '%s\n' "$getDockerImageName_log" >&2 + exit 1 + fi + fi + printf '%s' "$getDockerImageName_imageName" } # Test an extension @@ -163,6 +69,9 @@ testExtension() { return 1 fi testExtension_Image="$(getDockerImageName "$1" "$2")" + if test $? -ne 0; then + exit 1 + fi if test -z "$testExtension_Image"; then printf ' - Docker image not available\n' return 0 From f3c663103a4661f189ab9b4b147411d625e9418a Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Dec 2019 12:40:28 +0100 Subject: [PATCH 3/4] Improve package install errors handling --- install-php-extensions | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index 76fa701..63134d8 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -564,15 +564,13 @@ buildRequiredPackageLists() { esac if test -n "$buildRequiredPackageLists_persistent"; then PACKAGES_PERSISTENT="$(expandPackagesToBeInstalled $buildRequiredPackageLists_persistent)" - if test -s "$IPE_ERRFILE"; then - cat "$IPE_ERRFILE" >&2 + if test -s "$IPE_ERRFLAG_FILE"; then exit 1 fi fi if test -n "$buildRequiredPackageLists_volatile"; then buildRequiredPackageLists_packages="$(expandPackagesToBeInstalled $buildRequiredPackageLists_volatile)" - if test -s "$IPE_ERRFILE"; then - cat "$IPE_ERRFILE" >&2 + if test -s "$IPE_ERRFLAG_FILE"; then exit 1 fi resetIFS @@ -598,9 +596,10 @@ expandPackagesToBeInstalled() { alpine) expandPackagesToBeInstalled_log="$(apk add --simulate $@ 2>&1 || printf '\nERROR: apk failed\n')" if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^ERROR:')"; then - printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >"$IPE_ERRFILE" - printf '%s ' "$@" >>"$IPE_ERRFILE" - printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >>"$IPE_ERRFILE" + printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2 + printf '%s ' "$@" >&2 + printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2 + echo 'y' >"$IPE_ERRFLAG_FILE" exit 1 fi IFS=' @@ -615,9 +614,10 @@ expandPackagesToBeInstalled() { debian) expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy $@ 2>&1 || printf '\nE: apt-get failed\n')" if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^E:')"; then - printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >"$IPE_ERRFILE" - printf '%s ' "$@" >"$IPE_ERRFILE" - printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >"$IPE_ERRFILE" + printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2 + printf '%s ' "$@" >&2 + printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2 + echo 'y' >"$IPE_ERRFLAG_FILE" exit 1 fi expandPackagesToBeInstalled_inNewPackages=0 @@ -1138,7 +1138,7 @@ cleanup() { resetIFS mkdir -p /tmp/src -IPE_ERRFILE="$(mktemp -p /tmp/src)" +IPE_ERRFLAG_FILE="$(mktemp -p /tmp/src)" PHP_MAJMIN_VERSION=$(getPHPMajorMinor) case "$PHP_MAJMIN_VERSION" in 506 | 700 | 701 | 702 | 703 | 704) ;; From 5314a59565796d0579362d8aa1753aeeb55d3175 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Dec 2019 12:45:53 +0100 Subject: [PATCH 4/4] Fix SSL dependencies on Debian 9 (stretch) Test: mongo, mongodb, amqp+zip --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index 63134d8..ba16d4e 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -198,7 +198,7 @@ buildRequiredPackageLists() { fi ;; debian@9) - buildRequiredPackageLists_libssldev='libssl-dev' + buildRequiredPackageLists_libssldev='libssl1.0-dev' ;; debian@*) buildRequiredPackageLists_libssldev='libssl([0-9]+(\.[0-9]+)*)?-dev$'