Patchwork [meta-oe,V3,09/23] systemd.bbclass: automatically extend RDEPENDS for *-systemd packages

login
register
mail settings
Submitter Andreas Müller
Date Feb. 23, 2012, 12:10 p.m.
Message ID <1329999054-23112-10-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/21659/
State Accepted
Commit 114cefffb9879b9e52c3323872a7dfac03d626a9
Headers show

Comments

Andreas Müller - Feb. 23, 2012, 12:10 p.m.
* append systemd functionalty moved into systemd_add_rdepends
* append base-pgk in case receipe does not set RDEPENDS for *-systemd package

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-oe/classes/systemd.bbclass |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

Patch

diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index c712e17..dd423b5 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -122,10 +122,6 @@  python populate_packages_prepend () {
 		postrm += bb.data.getVar('systemd_postrm', localdata, 1)
 		bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
 
-		rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
-		rdepends.append("systemd")
-		bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
-
 	# add files to FILES_*-systemd if existent and not already done
 	def systemd_append_file(pkg_systemd, file_append):
 		appended = False
@@ -185,10 +181,27 @@  python populate_packages_prepend () {
 					raise bb.build.FuncFailed, "\n\nFor package %s SYSTEMD_SERVICE-entry %s does not exist" % \
 						(pkg_systemd, service)
 
+	# *-systemd packages get RDEPENDS to systemd and their base package
+	def systemd_add_rdepends(pkg_systemd):
+		# RDEPENDS_${pkg_systemd} += pkg_systemd_base systemd
+		rdepends = d.getVar('RDEPENDS_' + pkg_systemd, 1) or ""
+		rdepends_arr = rdepends.split()
+		if not 'systemd' in rdepends_arr:
+			rdepends = '%s %s' % (rdepends, 'systemd')
+		pkg_systemd_base = pkg_systemd.replace('-systemd', '')
+		# no automatism for:
+		# recipes setting rdepends themselves AND
+		# not rdepending myself AND
+		# avoid double entries
+		if len(rdepends_arr) == 0 and pkg_systemd != '${PN}' and not pkg_systemd_base in rdepends:
+			rdepends = '%s %s' % (rdepends, pkg_systemd_base)
+		d.setVar('RDEPENDS_' + pkg_systemd, rdepends)
+
 
 	# 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)
 		systemd_check_services()
 }