package/php-apcu: new package

APCu is an in-memory key-value store for PHP.
Keys are of type string and values can be any PHP variables.
APCu only supports userland caching of variables

https://pecl.php.net/package/APCU

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Herve Codina 2021-10-11 13:07:56 +02:00 committed by Thomas Petazzoni
parent 26642e4cc0
commit 8ddeeffa18
6 changed files with 73 additions and 0 deletions

View File

@ -1161,8 +1161,10 @@ F: package/libdbi/
F: package/libdbi-drivers/
F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
F: support/testing/tests/package/test_dtbocfg.py
F: support/testing/tests/package/test_lua_augeas.py
F: support/testing/tests/package/test_php_apcu.py
N: Hervé Codina <herve.codina@bootlin.com>
F: package/php-pecl-dbus/
@ -2021,6 +2023,7 @@ F: package/libdbi/
F: package/libdbi-drivers/
F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
F: package/php-pecl-dbus/
F: package/php-xdebug/
F: package/python-augeas/
@ -2034,6 +2037,7 @@ F: support/testing/tests/package/sample_python_flask_expects_json.py
F: support/testing/tests/package/sample_python_git.py
F: support/testing/tests/package/sample_python_unittest_xml_reporting.py
F: support/testing/tests/package/test_bmap_tools.py
F: support/testing/tests/package/test_php_apcu.py
F: support/testing/tests/package/test_php_pecl_dbus.py
F: support/testing/tests/package/test_python_augeas.py
F: support/testing/tests/package/test_python_flask_expects_json.py

View File

@ -866,6 +866,7 @@ if BR2_PACKAGE_PHP
if !BR2_STATIC_LIBS
menu "External php extensions"
source "package/php-amqp/Config.in"
source "package/php-apcu/Config.in"
source "package/php-geoip/Config.in"
source "package/php-gnupg/Config.in"
source "package/php-imagick/Config.in"

View File

@ -0,0 +1,6 @@
config BR2_PACKAGE_PHP_APCU
bool "php-apcu"
help
APCu is an in-memory key-value store for PHP.
https://pecl.php.net/package/APCu

View File

@ -0,0 +1,2 @@
sha256 b99d40fafec06f4d132fcee53e7526ddbfc1d041ea6e04e17389dfad28f9c390 apcu-5.1.20.tgz
sha256 c48761c645c6fa42b57af0e65d893217dc69bcd8d879ace74d6abbf1c5f73a8f LICENSE

View File

@ -0,0 +1,25 @@
################################################################################
#
# php-apcu
#
################################################################################
PHP_APCU_VERSION = 5.1.20
PHP_APCU_SITE = http://pecl.php.net/get
PHP_APCU_SOURCE = apcu-$(PHP_APCU_VERSION).tgz
PHP_APCU_LICENSE = PHP-3.01
PHP_APCU_LICENSE_FILES = LICENSE
PHP_APCU_DEPENDENCIES = php host-autoconf
PHP_APCU_CONF_OPTS = \
--with-php-config=$(STAGING_DIR)/usr/bin/php-config
define PHP_APCU_PHPIZE
(cd $(@D); \
PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
$(STAGING_DIR)/usr/bin/phpize)
endef
PHP_APCU_PRE_CONFIGURE_HOOKS += PHP_APCU_PHPIZE
$(eval $(autotools-package))

View File

@ -0,0 +1,35 @@
import os
import infra.basetest
class TestPhpApcu(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PACKAGE_PHP=y
BR2_PACKAGE_PHP_SAPI_CLI=y
BR2_PACKAGE_PHP_APCU=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
self.assertRunOk("mkdir /etc/php.d")
self.assertRunOk("echo 'extension=apcu.so' > /etc/php.d/apcu.ini")
# enable_cli enables APC for the CLI version of PHP, which is what we
# use in this test case.
self.assertRunOk("echo 'apc.enable_cli=1' >> /etc/php.d/apcu.ini")
output, exit_code = self.emulator.run("php --ri apcu | sed '/^$/d'")
self.assertEqual(exit_code, 0)
self.assertEqual(output[0], "apcu")
self.assertEqual(output[1], "APCu Support => Enabled")
# Do not check the version value in order to avoid a test failure when
# bumping package version.
self.assertEqual(output[2][0:11], "Version => ")