Skip to contentSkip to conversation

package/pecl-dbus: new package

PATCH Superseded Herve Codina 2 participants 4 messages Oct 5, 2021 – Oct 8, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

The 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]>

---
 DEVELOPERS                                    |   6 +
 package/Config.in                             |   1 +
 package/pecl-dbus/0001-php8-compat.patch      | 161 ++++++++++++++++++
 ...lity-with-php8-call_user_function_ex.patch |  31 ++++
 package/pecl-dbus/Config.in                   |  15 ++
 package/pecl-dbus/pecl-dbus.hash              |   3 +
 package/pecl-dbus/pecl-dbus.mk                |  25 +++
 .../testing/tests/package/test_pecl_dbus.py   |  32 ++++
 8 files changed, 274 insertions(+)
 create mode 100644 package/pecl-dbus/0001-php8-compat.patch
 create mode 100644 package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch
 create mode 100644 package/pecl-dbus/Config.in
 create mode 100644 package/pecl-dbus/pecl-dbus.hash
 create mode 100644 package/pecl-dbus/pecl-dbus.mk
 create mode 100644 support/testing/tests/package/test_pecl_dbus.py
DEVELOPERS +6 -0
index 1f977190ab..30120b2eeb 100644
@@ -1148,6 +1148,10 @@ F:	package/sysrepo/
 N:	Henrique Camargo <[email protected]>
 F:	package/json-glib/
 
+N:	Hervé Codina <[email protected]>
+F:	package/pecl-dbus/
+F:	support/testing/tests/package/test_pecl_dbus.py
+
 N:	Hiroshi Kawashima <[email protected]>
 F:	package/gauche/
 F:	package/gmrender-resurrect/
@@ -1980,6 +1984,7 @@ F:	configs/galileo_defconfig
 
 N:	Nicolas Carrier <[email protected]>
 F:	package/bmap-tools/
+F:	package/pecl-dbus/
 F:	package/php-xdebug/
 F:	package/python-augeas/
 F:	package/python-flask-expects-json/
@@ -1989,6 +1994,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_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 2f83c87582..0ca1c39a64 100644
@@ -861,6 +861,7 @@ endif
 if BR2_PACKAGE_PHP
 if !BR2_STATIC_LIBS
 menu "External php extensions"
+	source "package/pecl-dbus/Config.in"
 	source "package/php-amqp/Config.in"
 	source "package/php-geoip/Config.in"
 	source "package/php-gnupg/Config.in"
package/pecl-dbus/0001-php8-compat.patch new file +161 -0

161 lines not on this page · raw message

package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +31 -0
new file mode 100644
index 0000000000..1e579e4272
@@ -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 fix 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/pecl-dbus/Config.in new file +15 -0
new file mode 100644
index 0000000000..a531397754
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_PECL_DBUS
+	bool "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 "pecl-dbus needs a toolchain w/ threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/pecl-dbus/pecl-dbus.hash new file +3 -0
new file mode 100644
index 0000000000..5fe656ba40
@@ -0,0 +1,3 @@
+# Locally calculated:
+sha256 c48761c645c6fa42b57af0e65d893217dc69bcd8d879ace74d6abbf1c5f73a8f  pecl-dbus-315d17558c7614d02e923d898231e51c86a25789.tar.gz
+sha256 ecc8b74820c32fb82ddee80446205408585d75d1632ac959fb3cdf8eaf3877b5  LICENSE
package/pecl-dbus/pecl-dbus.mk new file +25 -0
new file mode 100644
index 0000000000..704ced911e
@@ -0,0 +1,25 @@
+################################################################################
+#
+# pecl-dbus
+#
+################################################################################
+
+PECL_DBUS_VERSION = 315d17558c7614d02e923d898231e51c86a25789
+PECL_DBUS_SITE = $(call github,derickr,pecl-dbus,$(PECL_DBUS_VERSION))
+PECL_DBUS_LICENSE = PHP-3.01
+PECL_DBUS_LICENSE_FILES = LICENSE
+PECL_DBUS_DEPENDENCIES = php dbus libxml2 host-autoconf host-pkgconf
+
+PECL_DBUS_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
+	--enable-dbus
+
+define 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
+PECL_DBUS_PRE_CONFIGURE_HOOKS += PECL_DBUS_PHPIZE
+
+$(eval $(autotools-package))
support/testing/tests/package/test_pecl_dbus.py new file +32 -0
new file mode 100644
index 0000000000..a9570658b7
@@ -0,0 +1,32 @@
+import os
+
+import infra.basetest
+
+
+class TestPeclDbus(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_PHP=y
+        BR2_PACKAGE_PHP_SAPI_CLI=y
+        BR2_PACKAGE_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

Hello Hervé,

Thanks for this contribution!

Quoted 8 lines · On Tue, 5 Oct 2021 15:11:21 +0200 Herve Codina <[email protected]>…

The 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]>

Quoted 10 lines
---
 DEVELOPERS                                    |   6 +
 package/Config.in                             |   1 +
 package/pecl-dbus/0001-php8-compat.patch      | 161 ++++++++++++++++++
 ...lity-with-php8-call_user_function_ex.patch |  31 ++++
 package/pecl-dbus/Config.in                   |  15 ++
 package/pecl-dbus/pecl-dbus.hash              |   3 +
 package/pecl-dbus/pecl-dbus.mk                |  25 +++
 .../testing/tests/package/test_pecl_dbus.py   |  32 ++++
 8 files changed, 274 insertions(+)

Thanks for this new package. I'm just wondering about the package name. The upstream project is indeed named pecl-dbus, where pecl stands for "PHP Extension Community Library". But all our other PHP packages are named "php-<something>". Should we name this package "php-dbus" ? "php-pecl-dbus" ?

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

package/pecl-dbus/0001-php8-compat.patch line 10

Quoted 10 lines
package/pecl-dbus/0001-php8-compat.patch new file +10 -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
+
+Signed-off-by: Herve Codina <[email protected]>

Perhaps you could just ping on this pull request, to say that it also solved the problem for you?

Quoted 6 lines
package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +0 -0
new file mode 100644
index 0000000000..1e579e4272

package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch line 9

Quoted 9 lines
package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +9 -0
@@ -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 fix compatibility with php8 replacing
+call_user_function_ex by call_user_function.
+
+Signed-off-by: Herve Codina <[email protected]>

And submit this upstream ?

package/pecl-dbus/Config.in line 7

Quoted 13 lines
package/pecl-dbus/Config.in new file +7 -0
new file mode 100644
index 0000000000..a531397754
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_PECL_DBUS
+	bool "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

I was wondering if you need both BR2_PACKAGE_LIBXML2 and BR2_PACKAGE_PHP_EXT_LIBXML2, i.e does pecl-dbus link directly with the libxml2 native library ?

package/pecl-dbus/Config.in

Quoted 9 lines
package/pecl-dbus/Config.in new file +9 -0
+PECL_DBUS_VERSION = 315d17558c7614d02e923d898231e51c86a25789
+PECL_DBUS_SITE = $(call github,derickr,pecl-dbus,$(PECL_DBUS_VERSION))
+PECL_DBUS_LICENSE = PHP-3.01
+PECL_DBUS_LICENSE_FILES = LICENSE
+PECL_DBUS_DEPENDENCIES = php dbus libxml2 host-autoconf host-pkgconf
+
+PECL_DBUS_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
+	--enable-dbus

pecl-dbus can build without dbus ?!?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi,

Quoted 26 lines · On Tue, 5 Oct 2021 15:53:10 +0200 Thomas Petazzoni…

Hello Hervé,

Thanks for this contribution!

Quoted 8 lines · On Tue, 5 Oct 2021 15:11:21 +0200 Herve Codina <[email protected]>…

The 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]>

Quoted 10 lines
---
 DEVELOPERS                                    |   6 +
 package/Config.in                             |   1 +
 package/pecl-dbus/0001-php8-compat.patch      | 161 ++++++++++++++++++
 ...lity-with-php8-call_user_function_ex.patch |  31 ++++
 package/pecl-dbus/Config.in                   |  15 ++
 package/pecl-dbus/pecl-dbus.hash              |   3 +
 package/pecl-dbus/pecl-dbus.mk                |  25 +++
 .../testing/tests/package/test_pecl_dbus.py   |  32 ++++
 8 files changed, 274 insertions(+)  
Quoted 5 lines

Thanks for this new package. I'm just wondering about the package name. The upstream project is indeed named pecl-dbus, where pecl stands for "PHP Extension Community Library". But all our other PHP packages are named "php-<something>". Should we name this package "php-dbus" ? "php-pecl-dbus" ?

"php-pecl-dbus" sounds good.
If it's ok for everyone, I will change in v2.

Quoted 13 lines
Quoted 13 lines
package/pecl-dbus/0001-php8-compat.patch new file +5 -0
new file mode 100644
index 0000000000..bef9a1fa05
@@ -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
+
Quoted 8 lines

package/pecl-dbus/0001-php8-compat.patch line 10

Quoted 5 lines
package/pecl-dbus/0001-php8-compat.patch new file +5 -0
+This patch was retrieved from the pending upstream pull request
+done by Stefan Saraev.
+https://github.com/derickr/pecl-dbus/pull/8
+
+Signed-off-by: Herve Codina <[email protected]>  

Perhaps you could just ping on this pull request, to say that it also solved the problem for you?

I did.

Quoted 10 lines
Quoted 10 lines
package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +3 -0
new file mode 100644
index 0000000000..1e579e4272
@@ -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
Quoted 8 lines

package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch line 9

Quoted 6 lines
package/pecl-dbus/0002-Fix-compatibility-with-php8-call_user_function_ex.patch new file +6 -0
+Subject: [PATCH] Fix compatibility with php8 - call_user_function_ex
+
+This patch fix compatibility with php8 replacing
+call_user_function_ex by call_user_function.
+
+Signed-off-by: Herve Codina <[email protected]>  

And submit this upstream ?

I did too.

Quoted 10 lines
Quoted 10 lines
package/pecl-dbus/Config.in new file +3 -0
new file mode 100644
index 0000000000..a531397754
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_PECL_DBUS
+	bool "pecl-dbus"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
Quoted 8 lines

package/pecl-dbus/Config.in line 7

Quoted 4 lines
package/pecl-dbus/Config.in new file +4 -0
+	depends on BR2_USE_MMU # dbus
+	select BR2_PACKAGE_DBUS
+	select BR2_PACKAGE_LIBXML2
+	select BR2_PACKAGE_PHP_EXT_LIBXML2 # Runtime dependency  

I was wondering if you need both BR2_PACKAGE_LIBXML2 and BR2_PACKAGE_PHP_EXT_LIBXML2, i.e does pecl-dbus link directly with the libxml2 native library ?

libxml2 is needed. In dbus.c source file, we have
#include "libxml/parser.h"
#include "libxml/parserInternals.h"
and calls to libxml2 functions such as 'xmlParseMemory()'

Quoted 13 lines

package/pecl-dbus/Config.in

Quoted 11 lines
package/pecl-dbus/Config.in new file +9 -0
+PECL_DBUS_VERSION = 315d17558c7614d02e923d898231e51c86a25789
+PECL_DBUS_SITE = $(call github,derickr,pecl-dbus,$(PECL_DBUS_VERSION))
+PECL_DBUS_LICENSE = PHP-3.01
+PECL_DBUS_LICENSE_FILES = LICENSE
+PECL_DBUS_DEPENDENCIES = php dbus libxml2 host-autoconf host-pkgconf
+
+PECL_DBUS_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
+	--enable-dbus  

pecl-dbus can build without dbus ?!?

Indeed, '--enable-dbus' is not needed and will be removed in v2.

Thanks for the review,

Hervé

Signature · 7 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hello,

Quoted 8 lines · On Tue, 5 Oct 2021 18:15:23 +0200 Herve Codina <[email protected]> wrote:
Quoted 5 lines

Thanks for this new package. I'm just wondering about the package name. The upstream project is indeed named pecl-dbus, where pecl stands for "PHP Extension Community Library". But all our other PHP packages are named "php-<something>". Should we name this package "php-dbus" ? "php-pecl-dbus" ?

"php-pecl-dbus" sounds good.
If it's ok for everyone, I will change in v2.

Fine with me. As said, I'm fine with either php-dbus or php-pecl-dbus.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+Signed-off-by: Herve Codina <[email protected]>

And submit this upstream ?

I did too.

👍

Quoted 8 lines
Quoted 3 lines

I was wondering if you need both BR2_PACKAGE_LIBXML2 and BR2_PACKAGE_PHP_EXT_LIBXML2, i.e does pecl-dbus link directly with the libxml2 native library ?

libxml2 is needed. In dbus.c source file, we have
#include "libxml/parser.h"
#include "libxml/parserInternals.h"
and calls to libxml2 functions such as 'xmlParseMemory()'

So, confirms that it links with libxml2 directly, indeed!

Quoted 3 lines
Quoted 1 line

pecl-dbus can build without dbus ?!?

Indeed, '--enable-dbus' is not needed and will be removed in v2.

ACK, perfect.

Thanks!

Thomas

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