Skip to contentSkip to conversation

networkd-dispatcher: use distro_features_check to check for systemd

PATCH New Bartosz Golaszewski 1 participant 3 messages Oct 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 networkd-dispatcher: use distro_features_check to check for systemd

From: Bartosz Golaszewski <[email protected]>

Use distro_features_check to check for systemd in DISTRO_FEATURES instead of a hand-crafted python function.

---
 .../networkd-dispatcher/networkd-dispatcher_2.0.1.bb     | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
meta-networking/recipes-daemons/networkd-dispatcher/networkd-dispatcher_2.0.1.bb +3 -6
index 008a7ac9a..c700bd17c 100644
@@ -1,9 +1,3 @@
-python __anonymous() {
-    features = d.getVar('DISTRO_FEATURES')
-    if not features or 'systemd' not in features:
-        raise bb.parse.SkipPackage('networkd-dispatcher needs systemd in DISTRO_FEATURES')
-}
-
 SUMMARY = "Dispatcher service for systemd-networkd connection status changes"
 DESCRIPTION = "This daemon is similar to NetworkManager-dispatcher, but is much \
 more limited in the types of events it supports due to the limited nature of \
@@ -13,7 +7,10 @@ AUTHOR = "Clayton Craft and others"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d"
 
+inherit distro_features_check
+
 RDEPENDS_${PN} = "systemd python3 python3-pygobject python3-dbus"
+REQUIRED_DISTRO_FEATURES = "systemd"
 
 SRC_URI = "https://gitlab.com/craftyguy/networkd-dispatcher/-/archive/${PV}/networkd-dispatcher-${PV}.tar.bz2"
 SRC_URI[md5sum] = "304d7dcc21331ea295e207f8493cb8d8"
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/3 networkd-dispatcher: remove unneeded RDEPENDS

From: Bartosz Golaszewski <[email protected]>

We already depend on systemd in DISTRO_FEATURES so adding it to RDEPENDS is redundant. We also rdepend on two python packages, so there's no need to explicitly depend on python3.

---
 .../networkd-dispatcher/networkd-dispatcher_2.0.1.bb            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-networking/recipes-daemons/networkd-dispatcher/networkd-dispatcher_2.0.1.bb +1 -1
index c700bd17c..06c83e9d8 100644
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d"
 
 inherit distro_features_check
 
-RDEPENDS_${PN} = "systemd python3 python3-pygobject python3-dbus"
+RDEPENDS_${PN} = "python3-pygobject python3-dbus"
 REQUIRED_DISTRO_FEATURES = "systemd"
 
 SRC_URI = "https://gitlab.com/craftyguy/networkd-dispatcher/-/archive/${PV}/networkd-dispatcher-${PV}.tar.bz2"
Signature · 1 line
2.23.0
#2 lore raw

PATCH 3/3 networkd-dispatcher: inherit systemd class

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Use the systemd class to correctly plug the package into the systemd infrastructure.

---
 .../networkd-dispatcher/networkd-dispatcher_2.0.1.bb      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta-networking/recipes-daemons/networkd-dispatcher/networkd-dispatcher_2.0.1.bb +5 -3
index 06c83e9d8..8523ae8c0 100644
@@ -7,7 +7,7 @@ AUTHOR = "Clayton Craft and others"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d"
 
-inherit distro_features_check
+inherit distro_features_check systemd
 
 RDEPENDS_${PN} = "python3-pygobject python3-dbus"
 REQUIRED_DISTRO_FEATURES = "systemd"
@@ -16,6 +16,10 @@ SRC_URI = "https://gitlab.com/craftyguy/networkd-dispatcher/-/archive/${PV}/netw
 SRC_URI[md5sum] = "304d7dcc21331ea295e207f8493cb8d8"
 SRC_URI[sha256sum] = "21f84c3646a043329dc64787e4e58dfce592b2559b0e3069af82c469805660c2"
 
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "networkd-dispatcher.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
 # Nothing to build, just a python script to install
 do_configure[noexec] = "1"
 do_compile[noexec] = "1"
@@ -25,5 +29,3 @@ do_install() {
     install -D -m 0644 ${S}/networkd-dispatcher.service ${D}/${systemd_system_unitdir}/networkd-dispatcher.service
     install -D -m 0644 ${S}/networkd-dispatcher.conf ${D}/${sysconfdir}/conf.d/networkd-dispatcher.conf
 }
-
-FILES_${PN} += "${systemd_system_unitdir}/networkd-dispatcher.service"
Signature · 1 line
2.23.0