Skip to contentSkip to conversation

package/php-apcu: new package

PATCH Applied Herve Codina 2 participants 2 messages Oct 11, 2021 – Dec 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>

---
 DEVELOPERS                                    |  6 ++++
 package/Config.in                             |  1 +
 package/php-apcu/Config.in                    |  6 ++++
 package/php-apcu/php-apcu.hash                |  2 ++
 package/php-apcu/php-apcu.mk                  | 25 +++++++++++++
 .../testing/tests/package/test_php_apcu.py    | 35 +++++++++++++++++++
 6 files changed, 75 insertions(+)
 create mode 100644 package/php-apcu/Config.in
 create mode 100644 package/php-apcu/php-apcu.hash
 create mode 100644 package/php-apcu/php-apcu.mk
 create mode 100644 support/testing/tests/package/test_php_apcu.py
DEVELOPERS +6 -0
index 7ebfc9234b..6a16dcc824 100644
@@ -1149,6 +1149,10 @@ F:	package/sysrepo/
 N:	Henrique Camargo <[email protected]>
 F:	package/json-glib/
 
+N:	Hervé Codina <[email protected]>
+F:	package/php-apcu/
+F:	support/testing/tests/package/test_php_apcu.py
+
 N:	Hiroshi Kawashima <[email protected]>
 F:	package/gauche/
 F:	package/gmrender-resurrect/
@@ -1982,6 +1986,7 @@ F:	configs/galileo_defconfig
 
 N:	Nicolas Carrier <[email protected]>
 F:	package/bmap-tools/
+F:	package/php-apcu/
 F:	package/php-xdebug/
 F:	package/python-augeas/
 F:	package/python-flask-expects-json/
@@ -1991,6 +1996,7 @@ F:	support/testing/tests/package/sample_python_augeas.py
 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/test_bmap_tools.py
+F:	support/testing/tests/package/test_php_apcu.py
 F:	support/testing/tests/package/test_python_augeas.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
package/Config.in +1 -0
index 9fed0ab4cb..f041fe43bf 100644
@@ -862,6 +862,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"
package/php-apcu/Config.in new file +6 -0
new file mode 100644
index 0000000000..6338980222
@@ -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
package/php-apcu/php-apcu.hash new file +2 -0
new file mode 100644
index 0000000000..8b286d5ae3
@@ -0,0 +1,2 @@
+sha256 b99d40fafec06f4d132fcee53e7526ddbfc1d041ea6e04e17389dfad28f9c390  apcu-5.1.20.tgz
+sha256 c48761c645c6fa42b57af0e65d893217dc69bcd8d879ace74d6abbf1c5f73a8f  LICENSE
package/php-apcu/php-apcu.mk new file +25 -0
new file mode 100644
index 0000000000..ce59611d8f
@@ -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))
support/testing/tests/package/test_php_apcu.py new file +35 -0
new file mode 100644
index 0000000000..7c149a5e47
@@ -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 => ")
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 9 lines · On Mon, 11 Oct 2021 13:07:56 +0200 Herve Codina <[email protected]>…

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 <[email protected]>

Quoted 12 lines
---
 DEVELOPERS                                    |  6 ++++
 package/Config.in                             |  1 +
 package/php-apcu/Config.in                    |  6 ++++
 package/php-apcu/php-apcu.hash                |  2 ++
 package/php-apcu/php-apcu.mk                  | 25 +++++++++++++
 .../testing/tests/package/test_php_apcu.py    | 35 +++++++++++++++++++
 6 files changed, 75 insertions(+)
 create mode 100644 package/php-apcu/Config.in
 create mode 100644 package/php-apcu/php-apcu.hash
 create mode 100644 package/php-apcu/php-apcu.mk
 create mode 100644 support/testing/tests/package/test_php_apcu.py

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot