Patchwork [[meta-oe,meta-efl] 04/15] systemd.bbclass: allow recipe to inherit systemd with empty SYSTEMD_SERVICE

login
register
mail settings
Submitter Martin Jansa
Date April 26, 2012, 12:50 p.m.
Message ID <154d0bb399ce6a0bdc2bf756d1a8a9c77dd0a755.1335444528.git.Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/26431/
State Accepted
Commit 154d0bb399ce6a0bdc2bf756d1a8a9c77dd0a755
Headers show

Comments

Martin Jansa - April 26, 2012, 12:50 p.m.
* 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 <Martin.Jansa@gmail.com>
---
 meta-oe/classes/systemd.bbclass |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

Patch

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()
 }