From 310d89ade2326f2be5ca873d2bba37a2fd020e68 Mon Sep 17 00:00:00 2001 From: "Konstantin A. Lepikhov" Date: Wed, 26 Feb 2020 11:18:28 +0100 Subject: [PATCH 01/11] added snuffleupagus ext support --- data/supported-extensions | 1 + install-php-extensions | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/supported-extensions b/data/supported-extensions index 96f256a..6bacdfb 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -54,6 +54,7 @@ rdkafka 5.5 5.6 7.0 7.1 7.2 7.3 7.4 recode 5.5 5.6 7.0 7.1 7.2 7.3 redis 5.5 5.6 7.0 7.1 7.2 7.3 7.4 shmop 5.5 5.6 7.0 7.1 7.2 7.3 7.4 +snuffleupagus 7.0 7.1 7.2 7.3 7.4 snmp 5.5 5.6 7.0 7.1 7.2 7.3 7.4 soap 5.5 5.6 7.0 7.1 7.2 7.3 7.4 sockets 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 df0f156..eb0486a 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -55,7 +55,7 @@ getDistroVersion() { # Output: # The PHP numeric Major-Minor version getPHPMajorMinor() { - php -r '$v = explode(".", PHP_VERSION); echo $v[0] * 100 + $v[1];' + php-config --version | awk -F. '{print $1*100+$2}' } # Get the normalized list of already installed PHP modules @@ -553,6 +553,10 @@ buildRequiredPackageLists() { esac fi ;; + snuffleupagus@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent pcre" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev" + ;; snmp@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent net-snmp-libs" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile net-snmp-dev" @@ -1002,6 +1006,7 @@ installModuleFromSource() { printf '### INSTALLING MODULE %s FROM SOURCE CODE ###\n' "$1" installModuleFromSource_dir="$(getPackageSource "$2")" cd "$installModuleFromSource_dir" + [ -d "$installModuleFromSource_dir"/src ] && cd src phpize ./configure $3 CFLAGS="${4:-}" make -j$(nproc) install @@ -1413,6 +1418,12 @@ for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do MODULE_SOURCE_CONFIGOPTIONS=--enable-igbinary MODULE_SOURCE_CFLAGS='-O2 -g' ;; + snuffleupagus) + MODULE_SOURCE="https://github.com/jvoisin/snuffleupagus/archive/v0.5.0.tar.gz" + MODULE_SOURCE_CONFIGOPTIONS=--enable-snuffleupagus + cd "$(getPackageSource https://github.com/jvoisin/snuffleupagus/archive/v0.5.0.tar.gz)" + cp -a config/default.rules /usr/local/etc/php/conf.d/snuffleupagus.rules + ;; esac if test -n "$MODULE_SOURCE"; then installModuleFromSource "$PHP_MODULE_TO_INSTALL" "$MODULE_SOURCE" "$MODULE_SOURCE_CONFIGOPTIONS" "$MODULE_SOURCE_CFLAGS" From 796d55607212bfd37bb67beb4c0283d4819c4c6a Mon Sep 17 00:00:00 2001 From: "Konstantin A. Lepikhov" Date: Thu, 27 Feb 2020 20:59:35 +0100 Subject: [PATCH 02/11] snuffleupagus: enable .rules This module uses very strict defaults which block almost everything. --- install-php-extensions | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install-php-extensions b/install-php-extensions index eb0486a..e35b559 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1012,6 +1012,13 @@ installModuleFromSource() { make -j$(nproc) install cd - >/dev/null docker-php-ext-enable "$1" + case "$1" in + snuffleupagus) # otherwise php -m will be empty + printf '%s\n%s\n' 'extension=snuffleupagus.so' \ + 'sp.configuration_file=/usr/local/etc/php/conf.d/snuffleupagus.rules' \ + > /usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini + ;; + esac } # Install a PECL PHP module given its handle From f0b82f028bae47568cdbe02c03061bf06f318796 Mon Sep 17 00:00:00 2001 From: "Konstantin A. Lepikhov" Date: Thu, 27 Feb 2020 21:05:25 +0100 Subject: [PATCH 03/11] installModuleFromSource: fix formatting --- install-php-extensions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index e35b559..46dc2a7 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1016,8 +1016,8 @@ installModuleFromSource() { snuffleupagus) # otherwise php -m will be empty printf '%s\n%s\n' 'extension=snuffleupagus.so' \ 'sp.configuration_file=/usr/local/etc/php/conf.d/snuffleupagus.rules' \ - > /usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini - ;; + > /usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini + ;; esac } From 6000437aac920e77cd71b6670a32040390ea0351 Mon Sep 17 00:00:00 2001 From: "Konstantin A. Lepikhov" Date: Thu, 27 Feb 2020 21:08:14 +0100 Subject: [PATCH 04/11] installModuleFromSource: another formatting fix --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index 46dc2a7..a85c0d3 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1016,7 +1016,7 @@ installModuleFromSource() { snuffleupagus) # otherwise php -m will be empty printf '%s\n%s\n' 'extension=snuffleupagus.so' \ 'sp.configuration_file=/usr/local/etc/php/conf.d/snuffleupagus.rules' \ - > /usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini + >/usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini ;; esac } From ccd5dcbbb3d97caa0153bba2a5790a4dd799592f Mon Sep 17 00:00:00 2001 From: "Konstantin A. Lepikhov" Date: Thu, 27 Feb 2020 21:51:55 +0100 Subject: [PATCH 05/11] add debian support --- install-php-extensions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install-php-extensions b/install-php-extensions index a85c0d3..48ab562 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -557,6 +557,10 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent pcre" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev" ;; + snuffleupagus@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpcre3" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpcre3-dev" + ;; snmp@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent net-snmp-libs" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile net-snmp-dev" From 4b24eb6110465e0e0449849edc299487b4d857e3 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 22:32:45 +0100 Subject: [PATCH 06/11] Remove unneeded packages --- install-php-extensions | 1 - 1 file changed, 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index 48ab562..117620d 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -558,7 +558,6 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev" ;; snuffleupagus@debian) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpcre3" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpcre3-dev" ;; snmp@alpine) From 7306861194343a0bd77dc6f542d7c29b59bda2a4 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 23:06:48 +0100 Subject: [PATCH 07/11] Simplify configuration --- install-php-extensions | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index 117620d..0cfeb02 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1016,10 +1016,8 @@ installModuleFromSource() { cd - >/dev/null docker-php-ext-enable "$1" case "$1" in - snuffleupagus) # otherwise php -m will be empty - printf '%s\n%s\n' 'extension=snuffleupagus.so' \ - 'sp.configuration_file=/usr/local/etc/php/conf.d/snuffleupagus.rules' \ - >/usr/local/etc/php/conf.d/docker-php-ext-snuffleupagus.ini + snuffleupagus) + printf 'sp.configuration_file=%s\n' "$PHP_INI_DIR/conf.d/snuffleupagus.rules" >> "$PHP_INI_DIR/conf.d/docker-php-ext-snuffleupagus.ini" ;; esac } From 7ffbb142a4e5ac358d01aeddb20a96eb48585685 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 23:13:16 +0100 Subject: [PATCH 08/11] Switch to src only for snuffleupagus We can't assume that any other present or future package won't contain a "src" directory we shouldn't "cd" into. Also, we have to invoke "cd" just once, otherwise the next "cd -" will enter the wrong directory. --- install-php-extensions | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index 0cfeb02..3eb8ae1 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1008,8 +1008,14 @@ getPackageSource() { installModuleFromSource() { printf '### INSTALLING MODULE %s FROM SOURCE CODE ###\n' "$1" installModuleFromSource_dir="$(getPackageSource "$2")" - cd "$installModuleFromSource_dir" - [ -d "$installModuleFromSource_dir"/src ] && cd src + case "$1" in + snuffleupagus) + cd "$installModuleFromSource_dir/src" + ;; + *) + cd "$installModuleFromSource_dir" + ;; + esac phpize ./configure $3 CFLAGS="${4:-}" make -j$(nproc) install From a1ea13ff040718c27232bd0e49357c379247811b Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 23:40:15 +0100 Subject: [PATCH 09/11] Don't download snuffleupagus source code twice --- install-php-extensions | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index 3eb8ae1..24b6876 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1023,6 +1023,7 @@ installModuleFromSource() { docker-php-ext-enable "$1" case "$1" in snuffleupagus) + cp -a "$installModuleFromSource_dir/config/default.rules" "$PHP_INI_DIR/conf.d/snuffleupagus.rules" printf 'sp.configuration_file=%s\n' "$PHP_INI_DIR/conf.d/snuffleupagus.rules" >> "$PHP_INI_DIR/conf.d/docker-php-ext-snuffleupagus.ini" ;; esac @@ -1435,8 +1436,6 @@ for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do snuffleupagus) MODULE_SOURCE="https://github.com/jvoisin/snuffleupagus/archive/v0.5.0.tar.gz" MODULE_SOURCE_CONFIGOPTIONS=--enable-snuffleupagus - cd "$(getPackageSource https://github.com/jvoisin/snuffleupagus/archive/v0.5.0.tar.gz)" - cp -a config/default.rules /usr/local/etc/php/conf.d/snuffleupagus.rules ;; esac if test -n "$MODULE_SOURCE"; then From d4a9ef7b68d4008e1c643a7201d9dddfe7cb637e Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 23:41:21 +0100 Subject: [PATCH 10/11] Use codeload URL for snuffleupagus --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index 24b6876..2ac5c6b 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1434,7 +1434,7 @@ for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do MODULE_SOURCE_CFLAGS='-O2 -g' ;; snuffleupagus) - MODULE_SOURCE="https://github.com/jvoisin/snuffleupagus/archive/v0.5.0.tar.gz" + MODULE_SOURCE="https://codeload.github.com/jvoisin/snuffleupagus/tar.gz/v0.5.0" MODULE_SOURCE_CONFIGOPTIONS=--enable-snuffleupagus ;; esac From d15134f374a9069ba65b828b25daf0d637f7cb71 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 27 Feb 2020 23:44:16 +0100 Subject: [PATCH 11/11] Lint --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index 2ac5c6b..4a01ce9 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1024,7 +1024,7 @@ installModuleFromSource() { case "$1" in snuffleupagus) cp -a "$installModuleFromSource_dir/config/default.rules" "$PHP_INI_DIR/conf.d/snuffleupagus.rules" - printf 'sp.configuration_file=%s\n' "$PHP_INI_DIR/conf.d/snuffleupagus.rules" >> "$PHP_INI_DIR/conf.d/docker-php-ext-snuffleupagus.ini" + printf 'sp.configuration_file=%s\n' "$PHP_INI_DIR/conf.d/snuffleupagus.rules" >>"$PHP_INI_DIR/conf.d/docker-php-ext-snuffleupagus.ini" ;; esac }