Merge pull request #420 from mlocati/keep-system-packages-cache

Let users keep the system packages cache
This commit is contained in:
Michele Locati 2021-08-13 17:21:25 +02:00 committed by GitHub
commit 71d7134de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 19 deletions

View File

@ -59,7 +59,7 @@ For example:
install-php-extensions xdebug-2.9.7 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: For example:
```sh ```sh
@ -69,7 +69,7 @@ install-php-extensions xdebug-^2
install-php-extensions xdebug-^2.8 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: For example:
```sh ```sh
@ -273,12 +273,13 @@ zlib
## Configuration ## 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 | | 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 | | | `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 |
| 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 | | 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 ## Special requirements
@ -335,7 +336,7 @@ The error will be something like this:
good line of code #6 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? ### Adding support to a new PHP extension?
@ -392,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. 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. 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 ## For the maintainers

View File

@ -2725,6 +2725,14 @@ cleanup() {
;; ;;
esac esac
fi fi
docker-php-source delete
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 case "$DISTRO" in
alpine) alpine)
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
@ -2733,12 +2741,9 @@ cleanup() {
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
;; ;;
esac esac
docker-php-source delete
rm -rf /tmp/pear rm -rf /tmp/pear
rm -rf /tmp/src ;;
rm -rf /tmp/pickle esac
rm -rf /tmp/pickle.tmp
rm -rf "$CONFIGURE_FILE"
} }
resetIFS resetIFS

View File

@ -11,7 +11,7 @@ echo '# Linting shell scripts'
if ! docker --version >/dev/null 2>/dev/null; then if ! docker --version >/dev/null 2>/dev/null; then
echo 'Docker is not installed, or it is not running.' >&2 echo 'Docker is not installed, or it is not running.' >&2
rc=1 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 echo 'ERROR!' >&2
rc=1 rc=1
fi fi

View File

@ -16,7 +16,7 @@ if errorlevel 1 (
echo Docker is not installed, or it's not running >&2 echo Docker is not installed, or it's not running >&2
set rc=1 set rc=1
) else ( ) 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 ( if errorlevel 1 (
echo ERROR! >&2 echo ERROR! >&2
set rc=1 set rc=1