Skip to contentSkip to conversation

package/php-pecl-dbus: new package

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

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/php-pecl-dbus: new package

The php-pecl-dbus package provides a PHP extension for interaction with D-Bus busses.

https://github.com/derickr/pecl-dbus

Based on initial work from Nicolas Carrier <[email protected]>

---
Changes v1 -> v2:
- Removed unneeded '--enable-dbus' configuration option
- Renamed package (pecl-dbus -> php-pecl-dbus)

Previous review can be read at
https://lore.kernel.org/buildroot/[email protected]/

Patches are still present. Even if my patch was accepted upstream, the upstream pull request will not be merge soon.
https://github.com/derickr/pecl-dbus/pull/8

 DEVELOPERS                                    |   6 +
 package/Config.in                             |   1 +
 package/php-pecl-dbus/0001-php8-compat.patch  | 161 ++++++++++++++++++
 ...lity-with-php8-call_user_function_ex.patch |  31 ++++
 package/php-pecl-dbus/Config.in               |  15 ++
 package/php-pecl-dbus/php-pecl-dbus.hash      |   3 +
 package/php-pecl-dbus/php-pecl-dbus.mk        |  24 +++
 .../tests/package/test_php_pecl_dbus.py       |  32 ++++
 8 files changed, 273 insertions(+)
 create mode 100644 package/php-pecl-dbus/0001-php8-compat.patch
 create mode 100644 package/php-pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch
 create mode 100644 package/php-pecl-dbus/Config.in
 create mode 100644 package/php-pecl-dbus/php-pecl-dbus.hash
 create mode 100644 package/php-pecl-dbus/php-pecl-dbus.mk
 create mode 100644 support/testing/tests/package/test_php_pecl_dbus.py
DEVELOPERS +6 -0
index 7ebfc9234b..06478b2a31 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-pecl-dbus/
+F:	support/testing/tests/package/test_php_pecl_dbus.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-pecl-dbus/
 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_pecl_dbus.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..85a2d73be4 100644
@@ -866,6 +866,7 @@ menu "External php extensions"
 	source "package/php-gnupg/Config.in"
 	source "package/php-imagick/Config.in"
 	source "package/php-memcached/Config.in"
+	source "package/php-pecl-dbus/Config.in"
 	source "package/php-ssh2/Config.in"
 	source "package/php-xdebug/Config.in"
 	source "package/php-yaml/Config.in"
package/php-pecl-dbus/0001-php8-compat.patch new file +161 -0

161 lines not on this page · raw message

package/php-pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +31 -0
new file mode 100644
index 0000000000..72ad1a313f
@@ -0,0 +1,31 @@
+From 8cf66c4b5dd657ca14552b27a42901db0a5e9280 Mon Sep 17 00:00:00 2001
+From: Herve Codina <[email protected]>
+Date: Mon, 4 Oct 2021 17:13:45 +0200
+Subject: [PATCH] Fix compatibility with php8 - call_user_function_ex
+
+This patch fixes compatibility with php8 replacing
+call_user_function_ex by call_user_function.
+
+Signed-off-by: Herve Codina <[email protected]>
+---
+ dbus.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/dbus.c b/dbus.c
+index a98e2ea..6fa9897 100644
+--- a/dbus.c
++++ b/dbus.c
+@@ -1015,8 +1015,8 @@ php_dbus_do_method_call(php_dbus_obj *dbus,
+ 		method_args = safe_emalloc(sizeof(zval *), num_elems, 0);
+ 	}
+ 
+-	if (call_user_function_ex(EG(function_table), object, &callback, &retval,
+-				              num_elems, method_args, 0, NULL) == SUCCESS) {
++	if (call_user_function(EG(function_table), object, &callback, &retval,
++				              num_elems, method_args) == SUCCESS) {
+ 		if (!Z_ISUNDEF(retval)) {
+ 			reply = dbus_message_new_method_return(msg);
+ 			php_dbus_append_parameters(reply, &retval, NULL,
+-- 
+2.31.1
+
package/php-pecl-dbus/Config.in new file +15 -0
new file mode 100644
index 0000000000..56c70143a5
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_PHP_PECL_DBUS
+	bool "php-pecl-dbus"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
+	depends on BR2_USE_MMU # dbus
+	select BR2_PACKAGE_DBUS
+	select BR2_PACKAGE_LIBXML2
+	select BR2_PACKAGE_PHP_EXT_LIBXML2 # Runtime dependency
+	help
+	  PHP extension for interaction with D-Bus busses.
+
+	  https://github.com/derickr/pecl-dbus
+
+comment "php-pecl-dbus needs a toolchain w/ threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/php-pecl-dbus/php-pecl-dbus.hash new file +3 -0
new file mode 100644
index 0000000000..f8c5aa5037
@@ -0,0 +1,3 @@
+# Locally calculated:
+sha256 c48761c645c6fa42b57af0e65d893217dc69bcd8d879ace74d6abbf1c5f73a8f  php-pecl-dbus-315d17558c7614d02e923d898231e51c86a25789.tar.gz
+sha256 ecc8b74820c32fb82ddee80446205408585d75d1632ac959fb3cdf8eaf3877b5  LICENSE
package/php-pecl-dbus/php-pecl-dbus.mk new file +24 -0
new file mode 100644
index 0000000000..456d662554
@@ -0,0 +1,24 @@
+################################################################################
+#
+# php-pecl-dbus
+#
+################################################################################
+
+PHP_PECL_DBUS_VERSION = 315d17558c7614d02e923d898231e51c86a25789
+PHP_PECL_DBUS_SITE = $(call github,derickr,pecl-dbus,$(PHP_PECL_DBUS_VERSION))
+PHP_PECL_DBUS_LICENSE = PHP-3.01
+PHP_PECL_DBUS_LICENSE_FILES = LICENSE
+PHP_PECL_DBUS_DEPENDENCIES = php dbus libxml2 host-autoconf host-pkgconf
+
+PHP_PECL_DBUS_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config
+
+define PHP_PECL_DBUS_PHPIZE
+	(cd $(@D); \
+		PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
+		PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
+		$(STAGING_DIR)/usr/bin/phpize)
+endef
+PHP_PECL_DBUS_PRE_CONFIGURE_HOOKS += PHP_PECL_DBUS_PHPIZE
+
+$(eval $(autotools-package))
support/testing/tests/package/test_php_pecl_dbus.py new file +32 -0
new file mode 100644
index 0000000000..65f34dfbb7
@@ -0,0 +1,32 @@
+import os
+
+import infra.basetest
+
+
+class TestPhpPeclDbus(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_PHP=y
+        BR2_PACKAGE_PHP_SAPI_CLI=y
+        BR2_PACKAGE_PHP_PECL_DBUS=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=dbus.so'> /etc/php.d/dbus.ini")
+
+        output, exit_code = self.emulator.run("php --ri dbus | sed '/^$/d'")
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], "dbus")
+        self.assertEqual(output[1], "Dbus support => enabled")
+        # Do not check the version value in order to avoid 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 8 lines · Herve Codina

The php-pecl-dbus package provides a PHP extension for interaction with D-Bus busses.

https://github.com/derickr/pecl-dbus

Based on initial work from Nicolas Carrier <[email protected]>

Applied to master, thanks.

[snip]

Quoted 6 lines
package/php-pecl-dbus/0001-php8-compat.patch new file +0 -0
new file mode 100644
index 0000000000..bef9a1fa05

package/php-pecl-dbus/0001-php8-compat.patch line 8

Quoted 8 lines
package/php-pecl-dbus/0001-php8-compat.patch new file +8 -0
@@ -0,0 +1,161 @@
+From 7fde4dd4d26d2a4b7957a1010c6ea9e4b940fc62 Mon Sep 17 00:00:00 2001
+From: Stefan Saraev <[email protected]>
+Date: Mon, 18 Jan 2021 23:22:52 +0200
+Subject: [PATCH] php8 compat
+
+This patch was retrieved from the pending upstream pull request
+done by Stefan Saraev.
+https://github.com/derickr/pecl-dbus/pull/8

That's a bit verbose, I replaced it with a simple:

Upstream: https://github.com/derickr/pecl-dbus/pull/8

I also added that upstream reference to the other patch.

Regards,
Arnout

[snip]
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot