From 7eabdbf791a68feebdb76f262608163389309003 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Fri, 13 Aug 2021 08:54:09 +0200 Subject: [PATCH 1/3] Let users keep the system packages cache --- README.md | 7 ++++--- install-php-extensions | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4a85148..84e1275 100644 --- a/README.md +++ b/README.md @@ -273,12 +273,13 @@ zlib ## Configuration -The compilation of some extensions may be fine-tuned to better fit your needs by using environment variables: +You can configure the behavior of the script, as well as fine-tune some extensions in order fit your needs, by using environment variables: | Extension | Environment variable | Description | |---|---|---| -| lzf | IPE_LZF_BETTERCOMPRESSION=1 | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | -| event | IPE_EVENT_NAMESPACE=... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | +| | `IPE_KEEP_SYSPKG_CACHE=1` | By default the script will clear the apt/apk/pear cache in order to save disk space. You can disable it by setting this environment variable | +| lzf | `IPE_LZF_BETTERCOMPRESSION=1` | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | +| event | `IPE_EVENT_NAMESPACE=`... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | ## Special requirements diff --git a/install-php-extensions b/install-php-extensions index e41e655..9f4e474 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -2725,20 +2725,25 @@ cleanup() { ;; esac fi - case "$DISTRO" in - alpine) - rm -rf /var/cache/apk/* - ;; - debian) - rm -rf /var/lib/apt/lists/* - ;; - esac docker-php-source delete - rm -rf /tmp/pear rm -rf /tmp/src rm -rf /tmp/pickle rm -rf /tmp/pickle.tmp rm -rf "$CONFIGURE_FILE" + case "${IPE_KEEP_SYSPKG_CACHE:-}" in + 1 | y* | Y*) ;; + *) + case "$DISTRO" in + alpine) + rm -rf /var/cache/apk/* + ;; + debian) + rm -rf /var/lib/apt/lists/* + ;; + esac + rm -rf /tmp/pear + ;; + esac } resetIFS From f9195cda3daa478e57372af26c997a69ab440b32 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Fri, 13 Aug 2021 09:17:19 +0200 Subject: [PATCH 2/3] Fix typos in README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 84e1275..4baa9aa 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ RUN install-php-extensions gd xdebug #### *Beware* -*When building locally, be sure you have the latest version of the `mlocati/php-extension-installer` image by running :* +*When building locally, be sure you have the latest version of the `mlocati/php-extension-installer` image by running:* ```sh docker pull mlocati/php-extension-installer @@ -59,7 +59,7 @@ For example: install-php-extensions xdebug-2.9.7 ``` -The script also support resolving *compatible* versions by prefixing the version with a caret (`^`). +The script also supports resolving *compatible* versions by prefixing the version with a caret (`^`). For example: ```sh @@ -69,7 +69,7 @@ install-php-extensions xdebug-^2 install-php-extensions xdebug-^2.8 ``` -Pre-release versions extensions available on `PECL` can be setup by suffixing the extension's name with its state i.e `alpha`, `beta`, `rc`, `preview`, `devel` or `snapshot`. +Pre-release versions extensions available on `PECL` can be setup by suffixing the extension's name with its state i.e. `alpha`, `beta`, `rc`, `preview`, `devel` or `snapshot`. For example: ```sh @@ -336,7 +336,7 @@ The error will be something like this: good line of code #6 ``` -So, you should fix highlighed line (the one(s) at `line number`) by replacing what you see after the `-` with what you see after the `+` +So, you should fix highlighted line (the one(s) at `line number`) by replacing what you see after the `-` with what you see after the `+` ### Adding support to a new PHP extension? @@ -393,7 +393,7 @@ See [this pull request](https://github.com/mlocati/docker-php-extension-installe PHP extensions published on the PECL archive contain a `package.xml` (or `package2.xml`) file describing the supported PHP versions and the options that can be used to compile it. When we add support for a new PHP extension, and when a new version of a PHP extension is released, we have to check those constraints. -It's a rather tedious taks, so I developed a project that lets you easily check those constraints: you can find it at https://mlocati.github.io/pecl-info ([here](https://github.com/mlocati/pecl-info) you can find its source code). +It's a rather tedious task, so I developed a project that lets you easily check those constraints: you can find it at https://mlocati.github.io/pecl-info ([here](https://github.com/mlocati/pecl-info) you can find its source code). ## For the maintainers From 6393e6819c1052655cc9c1e1e17e4c7608fef3aa Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Fri, 13 Aug 2021 09:34:43 +0200 Subject: [PATCH 3/3] Fix shfmt invocation --- scripts/lint | 2 +- scripts/lint.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lint b/scripts/lint index ed1c230..3d074d2 100755 --- a/scripts/lint +++ b/scripts/lint @@ -11,7 +11,7 @@ echo '# Linting shell scripts' if ! docker --version >/dev/null 2>/dev/null; then echo 'Docker is not installed, or it is not running.' >&2 rc=1 -elif ! docker run --rm -v "$SRC_DIR:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.3.1 fix; then +elif ! docker run --rm -v "$SRC_DIR:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.3.1-alpine fix; then echo 'ERROR!' >&2 rc=1 fi diff --git a/scripts/lint.bat b/scripts/lint.bat index c93520a..7f5165a 100644 --- a/scripts/lint.bat +++ b/scripts/lint.bat @@ -16,7 +16,7 @@ if errorlevel 1 ( echo Docker is not installed, or it's not running >&2 set rc=1 ) else ( - docker run --rm -v "%SRC_DIR%:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.3.1 fix + docker run --rm -v "%SRC_DIR%:/src" -w /src --entrypoint /src/scripts/invoke-shfmt mvdan/shfmt:v3.3.1-alpine fix if errorlevel 1 ( echo ERROR! >&2 set rc=1