Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alex Kiernan <alex.kiernan@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alex Kiernan <alex.kiernan@gmail.com>
Subject: [PATCH OE-Core 5/5] connman: Rework to avoid splitting into many single binary packages
Date: Wed, 02 Apr 2025 16:02:17 +0000	[thread overview]
Message-ID: <20250402-connman-v1-5-2e4fbbb7caf9@gmail.com> (raw)
In-Reply-To: <20250402-connman-v1-0-2e4fbbb7caf9@gmail.com>

This recipe predates PACKAGECONFIG (or maybe widespread usage?) and so to use
the VPN options they had to be both enabled at the PACKAGECONFIG level and then
included as a separate package. In addition the list of VPN packages has
drifted so (for example) wireguard was not delivered this way.

Remove most of the subordinate packages and just populate the main connman
package based on PACKAGECONFIG. Keep connman-client separate as `connmanctl`
has a dependency on readline (which is GPLv3 licensed) and separate out
connman-tools for `stats-tool` and connman-tests for all the test binaries
(which possibly in the future could be used as the basis of a ptest package).

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
 meta/recipes-connectivity/connman/connman_1.44.bb | 159 +++++-----------------
 1 file changed, 34 insertions(+), 125 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman_1.44.bb b/meta/recipes-connectivity/connman/connman_1.44.bb
index 2622a8ebfed0ceec7ac39fcf3ffad76291de5797..b1616351b5c2b1a7d4f2ac577db19ab566ceac0e 100644
--- a/meta/recipes-connectivity/connman/connman_1.44.bb
+++ b/meta/recipes-connectivity/connman/connman_1.44.bb
@@ -90,17 +90,11 @@ PACKAGECONFIG[wireguard] = "--enable-wireguard,--disable-wireguard,libmnl"
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
-python __anonymous () {
-    systemd_packages = "${PN} ${PN}-wait-online"
-    pkgconfig = d.getVar('PACKAGECONFIG')
-    if ('openvpn' or 'vpnc' or 'l2tp' or 'pptp') in pkgconfig.split():
-        systemd_packages += " ${PN}-vpn"
-    d.setVar('SYSTEMD_PACKAGES', systemd_packages)
-}
-
-SYSTEMD_SERVICE:${PN} = "connman.service"
-SYSTEMD_SERVICE:${PN}-vpn = "connman-vpn.service"
-SYSTEMD_SERVICE:${PN}-wait-online = "connman-wait-online.service"
+SYSTEMD_SERVICE:${PN} = "\
+    connman.service \
+    connman-wait-online.service \
+    ${@bb.utils.contains_any('PACKAGECONFIG', ['openconnect', 'openvpn', 'vpnc', 'l2tp', 'pptp', 'wireguard'], 'connman-vpn.service', '', d)} \
+"
 
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}"
@@ -114,18 +108,15 @@ do_install:append() {
 		sed -i s%@DATADIR@%${datadir}% ${D}${sysconfdir}/init.d/connman
 	fi
 
-	install -d ${D}${bindir}
-	install -m 0755 ${B}/tools/*-test ${D}${bindir}
-	if [ -e ${B}/tools/wispr ]; then
-		install -m 0755 ${B}/tools/wispr ${D}${bindir}
-	fi
+	for noinst_program in ${NOINST_TESTS} ${NOINST_TOOLS}; do
+		if [ -r "${B}/$noinst_program" ]; then
+			install -d ${D}${bindir}
+			install -m 0755 "${B}/$noinst_program" ${D}${bindir}
+		fi
+	done
 
 	# We don't need to package an empty directory
-	rmdir --ignore-fail-on-non-empty ${D}${libdir}/connman/scripts
-
-	# Automake 1.12 won't install empty directories, but we need the
-	# plugins directory to be present for ownership
-	mkdir -p ${D}${libdir}/connman/plugins
+	rmdir --ignore-fail-on-non-empty ${D}${libdir}/connman/scripts ${D}${libdir}/connman
 
 	# For read-only filesystem, do not create links during bootup
 	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
@@ -134,113 +125,31 @@ do_install:append() {
 	fi
 }
 
-# These used to be plugins, but now they are core
-RPROVIDES:${PN} = "\
-	connman-plugin-loopback \
-	connman-plugin-ethernet \
-	${@bb.utils.contains('PACKAGECONFIG', 'bluetooth','connman-plugin-bluetooth', '', d)} \
-	${@bb.utils.contains('PACKAGECONFIG', 'wifi','connman-plugin-wifi', '', d)} \
-	${@bb.utils.contains('PACKAGECONFIG', '3g','connman-plugin-ofono', '', d)} \
-	"
-
-PACKAGES_DYNAMIC += "^${PN}-plugin-.*"
-
-def add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, add_insane_skip):
-    plugintype = pkg.split( '-' )[-1]
-    if plugintype in depmap:
-        rdepends = map(lambda x: multilib_prefix + x, \
-                       depmap[plugintype].split())
-        d.setVar("RDEPENDS:%s" % pkg, " ".join(rdepends))
-    if add_insane_skip:
-        d.appendVar("INSANE_SKIP:%s" % pkg, "dev-so")
-
-python populate_packages:prepend() {
-    depmap = dict(pppd="ppp")
-    multilib_prefix = (d.getVar("MLPREFIX") or "")
-
-    hook = lambda file,pkg,x,y,z: \
-        add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, False)
-    plugin_dir = d.expand('${libdir}/connman/plugins/')
-    plugin_name = d.expand('${PN}-plugin-%s')
-    do_split_packages(d, plugin_dir, r'^(.*).so$', plugin_name, \
-        '${PN} plugin for %s', extra_depends='', hook=hook, prepend=True )
-
-    hook = lambda file,pkg,x,y,z: \
-        add_rdepends(bb, d, file, pkg, depmap, multilib_prefix, True)
-    plugin_dir = d.expand('${libdir}/connman/plugins-vpn/')
-    plugin_name = d.expand('${PN}-plugin-vpn-%s')
-    do_split_packages(d, plugin_dir, r'^(.*).so$', plugin_name, \
-        '${PN} VPN plugin for %s', extra_depends='', hook=hook, prepend=True )
-}
-
-PACKAGES =+ "${PN}-tools ${PN}-tests ${PN}-client"
+NOINST_TESTS = "tools/supplicant-test tools/dhcp-test tools/dhcp-server-test \
+		tools/addr-test tools/web-test tools/resolv-test tools/dbus-test \
+		tools/polkit-test tools/wpad-test tools/private-network-test \
+		tools/session-test tools/dnsproxy-test tools/iptables-test tools/ip6tables-test \
+		tools/iptables-unit tools/dnsproxy-standalone \
+		unit/test-ippool unit/test-iptables \
+"
+NOINST_TOOLS = "tools/stats-tool tools/wispr"
 
-FILES:${PN}-tools = "${bindir}/wispr"
-RDEPENDS:${PN}-tools = "${PN}"
+PACKAGE_BEFORE_PN = "${PN}-client ${PN}-tests ${PN}-tools"
 
-FILES:${PN}-tests = "${bindir}/*-test"
+FILES:${PN} += " \
+    ${datadir}/dbus-1/system-services \
+    ${datadir}/dbus-1/system.d \
+    ${datadir}/polkit-1 \
+    ${nonarch_libdir}/tmpfiles.d/*.conf \
+"
 
 FILES:${PN}-client = "${bindir}/connmanctl"
 RDEPENDS:${PN}-client = "${PN}"
 
-FILES:${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
-            ${libdir}/connman/plugins \
-            ${sysconfdir} ${sharedstatedir} ${localstatedir} ${datadir} \
-            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
-            ${datadir}/dbus-1/system-services/* \
-            ${sysconfdir}/tmpfiles.d/connman_resolvconf.conf"
-
-FILES:${PN}-dev += "${libdir}/connman/*/*.la"
-
-PACKAGES =+ "${PN}-vpn ${PN}-wait-online"
-
-SUMMARY:${PN}-vpn = "A daemon for managing VPN connections within embedded devices"
-DESCRIPTION:${PN}-vpn = "The ConnMan VPN provides a daemon for \
-managing VPN connections within embedded devices running the Linux \
-operating system.  The connman-vpnd handles all the VPN connections \
-and starts/stops VPN client processes when necessary. The connman-vpnd \
-provides a DBus API for managing VPN connections. All the different \
-VPN technogies are implemented using plug-ins."
-FILES:${PN}-vpn += "${sbindir}/connman-vpnd \
-                    ${sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf \
-                    ${datadir}/dbus-1/system-services/net.connman.vpn.service \
-                    ${systemd_system_unitdir}/connman-vpn.service"
-
-SUMMARY:${PN}-wait-online = "A program that will return once ConnMan has connected to a network"
-DESCRIPTION:${PN}-wait-online = "A service that can be enabled so that \
-the system waits until a network connection is established."
-FILES:${PN}-wait-online += "${sbindir}/connmand-wait-online \
-                            ${systemd_system_unitdir}/connman-wait-online.service"
-
-SUMMARY:${PN}-plugin-vpn-openvpn = "An OpenVPN plugin for ConnMan VPN"
-DESCRIPTION:${PN}-plugin-vpn-openvpn = "The ConnMan OpenVPN plugin uses openvpn client \
-to create a VPN connection to OpenVPN server."
-FILES:${PN}-plugin-vpn-openvpn += "${libdir}/connman/scripts/openvpn-script \
-                                   ${libdir}/connman/plugins-vpn/openvpn.so"
-RDEPENDS:${PN}-plugin-vpn-openvpn += "${PN}-vpn"
-RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','openvpn','${PN}-plugin-vpn-openvpn', '', d)}"
-
-SUMMARY:${PN}-plugin-vpn-vpnc = "A vpnc plugin for ConnMan VPN"
-DESCRIPTION:${PN}-plugin-vpn-vpnc = "The ConnMan vpnc plugin uses vpnc client \
-to create a VPN connection to Cisco3000 VPN Concentrator."
-FILES:${PN}-plugin-vpn-vpnc += "${libdir}/connman/scripts/openconnect-script \
-                                ${libdir}/connman/plugins-vpn/vpnc.so \
-                                ${libdir}/connman/scripts/vpn-script"
-RDEPENDS:${PN}-plugin-vpn-vpnc += "${PN}-vpn"
-RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','vpnc','${PN}-plugin-vpn-vpnc', '', d)}"
-
-SUMMARY:${PN}-plugin-vpn-l2tp = "A L2TP plugin for ConnMan VPN"
-DESCRIPTION:${PN}-plugin-vpn-l2tp = "The ConnMan L2TP plugin uses xl2tpd daemon \
-to create a VPN connection to L2TP server."
-FILES:${PN}-plugin-vpn-l2tp += "${libdir}/connman/scripts/libppp-plugin.so* \
-                                ${libdir}/connman/plugins-vpn/l2tp.so"
-RDEPENDS:${PN}-plugin-vpn-l2tp += "${PN}-vpn"
-RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','l2tp','${PN}-plugin-vpn-l2tp', '', d)}"
-
-SUMMARY:${PN}-plugin-vpn-pptp = "A PPTP plugin for ConnMan VPN"
-DESCRIPTION:${PN}-plugin-vpn-pptp = "The ConnMan PPTP plugin uses pptp-linux client \
-to create a VPN connection to PPTP server."
-FILES:${PN}-plugin-vpn-pptp += "${libdir}/connman/scripts/libppp-plugin.so* \
-                                ${libdir}/connman/plugins-vpn/pptp.so"
-RDEPENDS:${PN}-plugin-vpn-pptp += "${PN}-vpn"
-RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG','pptp','${PN}-plugin-vpn-pptp', '', d)}"
+FILES:${PN}-tests = "${@ ' '.join([os.path.join('${bindir}', os.path.basename(noinst_program)) for noinst_program in NOINST_TESTS.split()]) }"
+RDEPENDS:${PN}-tests = "${PN}"
+ALLOW_EMPTY:${PN}-tests = "1"
+
+FILES:${PN}-tools = "${@ ' '.join([os.path.join('${bindir}', os.path.basename(noinst_program)) for noinst_program in NOINST_TOOLS.split()]) }"
+RDEPENDS:${PN}-tools = "${PN}"
+ALLOW_EMPTY:${PN}-tools = "1"

-- 
2.25.1



  parent reply	other threads:[~2025-04-02 16:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 16:02 [PATCH OE-Core 0/5] connman: Update for all PACKAGECONFIG options, clean up legacy Alex Kiernan
2025-04-02 16:02 ` [PATCH OE-Core 1/5] connman: Merge .inc into .bb Alex Kiernan
2025-04-02 16:02 ` [PATCH OE-Core 2/5] connman: Delete patches for gold and MIPS binutils fix Alex Kiernan
2025-04-02 16:02 ` [PATCH OE-Core 3/5] connman: Move ppp from DEPENDS to PACKAGECONFIG Alex Kiernan
2025-04-02 16:02 ` [PATCH OE-Core 4/5] connman: Add all build options as PACKAGECONFIG Alex Kiernan
2025-04-02 19:41   ` [OE-core] " Richard Purdie
2025-04-02 20:08     ` Alex Kiernan
2025-04-04 12:02       ` Ross Burton
2025-04-04 12:29         ` Alexander Kanavin
2025-04-08  9:38         ` Alex Kiernan
2025-04-02 16:02 ` Alex Kiernan [this message]
2025-04-02 19:33 ` [OE-core] [PATCH OE-Core 0/5] connman: Update for all PACKAGECONFIG options, clean up legacy Richard Purdie
2025-04-03  6:42   ` Alex Kiernan
2025-04-03  7:36     ` Richard Purdie
2025-04-03 16:46       ` Scott Murray
2025-04-03 16:52         ` Richard Purdie
2025-04-07 16:44           ` Adrian Freihofer
2025-04-08  9:33             ` Alex Kiernan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250402-connman-v1-5-2e4fbbb7caf9@gmail.com \
    --to=alex.kiernan@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox