From 154d0bb399ce6a0bdc2bf756d1a8a9c77dd0a755 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Tue, 24 Apr 2012 15:11:44 +0200 Subject: systemd.bbclass: allow recipe to inherit systemd with empty SYSTEMD_SERVICE * I have use case where common recipe does inherit systemd and only some BSP's are bbappending some SERVICEs to it * install was moved intentionaly, so that /lib/systemd/system is not created if there is no .service file (causing QA Warning about unpackaged dir) Signed-off-by: Martin Jansa --- meta-oe/classes/systemd.bbclass | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass index d8e30f4..db35717 100644 --- a/meta-oe/classes/systemd.bbclass +++ b/meta-oe/classes/systemd.bbclass @@ -58,8 +58,6 @@ def systemd_after_parse(d): for pkg_systemd in systemd_pkgs.split(): service_pkg = 'SYSTEMD_SERVICE' + "_" + pkg_systemd systemd_services = d.getVar(service_pkg, 1) or d.getVar('SYSTEMD_SERVICE', 1) or "" - if systemd_services == "": - raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_SERVICE / %s" % (bb_filename, service_pkg) # prepend systemd-packages not already included def systemd_create_package(pkg_systemd): @@ -84,11 +82,11 @@ python __anonymous() { # automatically install all *.service and *.socket supplied in recipe's SRC_URI do_install_append() { - install -d ${D}${systemd_unitdir}/system for service in `find ${WORKDIR} -maxdepth 1 -name '*.service' -o -name '*.socket'` ; do # ensure installing systemd-files only (e.g not avahi *.service) if grep -q '\[Unit\]' $service ; then - install -m 644 $service ${D}${systemd_unitdir}/system + install -d ${D}${systemd_unitdir}/system + install -m 644 $service ${D}${systemd_unitdir}/system fi done } @@ -203,7 +201,8 @@ python populate_packages_prepend () { # run all modifications once when creating package if os.path.exists('${D}'): for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split(): - systemd_generate_package_scripts(pkg_systemd) - systemd_add_rdepends(pkg_systemd) + if d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) and d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1).strip(): + systemd_generate_package_scripts(pkg_systemd) + systemd_add_rdepends(pkg_systemd) systemd_check_services() } -- cgit v1.2.3-18-g5258