Skip to contentSkip to conversation

connman: fix systemd support for connman-* packages.

PATCH In review Yevhen Kyriukha 3 participants 4 messages Aug 13, 2013 – Aug 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 connman: fix systemd support for connman-* packages.

This patch fixes systemd's postinst/postrm script generation.

---
 meta/recipes-connectivity/connman/connman.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/recipes-connectivity/connman/connman.inc +8 -0
index 6b5ea0b..37ce3ec 100644
@@ -56,6 +56,14 @@ PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls,"
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
+python __anonymous () {
+    systemd_packages = "${PN}"
+    pkgconfig = d.getVar('PACKAGECONFIG', True)
+    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_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 17 lines · Yevhen Kyriukha

This patch fixes systemd's postinst/postrm script generation.

---
  meta/recipes-connectivity/connman/connman.inc | 8 ++++++++
  1 file changed, 8 insertions(+)
meta/recipes-connectivity/connman/connman.inc +1 -0
index 6b5ea0b..37ce3ec 100644
@@ -56,6 +56,14 @@ PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls,"
  INITSCRIPT_NAME = "connman"
  INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
+python __anonymous () {

meta/recipes-connectivity/connman/connman.inc PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls," · line 69

Quoted 10 lines
meta/recipes-connectivity/connman/connman.inc +7 -0
+    systemd_packages = "${PN}"
+    pkgconfig = d.getVar('PACKAGECONFIG', True)
+    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_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"

Can't you use the base_contains style of anon python in the SYSTEMD_PACKAGES:

SYSTEMD_PACKAGES = "${PN} ${@base_contains('PACKAGECONFIG', 'vpn', '${PN}-vpn', '', d)}"

Or can any one of those in the list above trigger the vpn, it would be cleaner if we just trigger on just one item.

Sau!

#2 lore raw

2013/8/13 Saul Wold <[email protected]>:

Quoted 34 lines · Yevhen Kyriukha
Quoted 20 lines

This patch fixes systemd's postinst/postrm script generation.

---
  meta/recipes-connectivity/connman/connman.inc | 8 ++++++++
  1 file changed, 8 insertions(+)
meta/recipes-connectivity/connman/connman.inc +0 -0
index 6b5ea0b..37ce3ec 100644
@@ -56,6 +56,14 @@ PACKAGECONFIG[wispr] =

"--enable-wispr,--disable-wispr,gnutls,"
INITSCRIPT_NAME = "connman"
INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."

meta/recipes-connectivity/connman/connman.inc +1 -0
+python __anonymous () {

meta/recipes-connectivity/connman/connman.inc PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls," · line 69

Quoted 10 lines
meta/recipes-connectivity/connman/connman.inc +7 -0
+    systemd_packages = "${PN}"
+    pkgconfig = d.getVar('PACKAGECONFIG', True)
+    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_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"

Can't you use the base_contains style of anon python in the SYSTEMD_PACKAGES:

Quoted 7 lines

SYSTEMD_PACKAGES = "${PN} ${@base_contains('PACKAGECONFIG', 'vpn', '${PN}-vpn', '', d)}"

Or can any one of those in the list above trigger the vpn, it would be cleaner if we just trigger on just one item.

Sau!

Here is how connman detects (in configure.ac) whether to build connman-vpn or not:

AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
                        "${enable_openvpn}" != "no" -o \
                        "${enable_vpnc}" != "no" -o \
                        "${enable_l2tp}" != "no" -o \
                        "${enable_pptp}" != "no")

This patch is doing the same check: if at least one of VPN technologies were selected we should build connman-vpn.

base_contains is not an option in this case as it checks whether environment variable contains all strings that you provide in second parameter.

Regards,
Yevhen

#3 lore raw
In reply to Yevhen Kyriukha

meta/recipes-connectivity/connman/connman.inc PACKAGECONFIG[wispr] = "--enable-wispr,--disable-wispr,gnutls," · line 65

Quoted 7 lines · Yevhen Kyriukha
meta/recipes-connectivity/connman/connman.inc +7 -0
+python __anonymous () {
+    systemd_packages = "${PN}"
+    pkgconfig = d.getVar('PACKAGECONFIG', True)
+    if ('openvpn' or 'vpnc' or 'l2tp' or 'pptp') in pkgconfig.split():
+        systemd_packages += " ${PN}-vpn"
+    d.setVar('SYSTEMD_PACKAGES', systemd_packages)
+}

I'm not keen on this as its quite a lot of logic to put in the recipe when it would be good to handle this case of optional packages in the systemd class itself.

However I'm not sure how best to do this as the FILES_* manipulation needs to happen *before* the package split, and this check can only happen *after* the package split. I wonder if it's possible to split up the systemd class functionality like that.

So, we should probably merge this now, and try and fix the class so we can remove it again later.

Ross