Patchwork [meta-oe,V2,05/32] systemd.bbclass: add *-systemd packages to RRECOMMENDS

login
register
mail settings
Submitter Andreas Müller
Date July 13, 2012, 8:30 a.m.
Message ID <1342168240-7760-6-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/31849/
State Accepted
Commit 264e5a44e1111f939b43c11bb9514a0b435918db
Headers show

Comments

Andreas Müller - July 13, 2012, 8:30 a.m.
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-systemd/classes/systemd.bbclass |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

Patch

diff --git a/meta-systemd/classes/systemd.bbclass b/meta-systemd/classes/systemd.bbclass
index 2e585c3..fce314d 100644
--- a/meta-systemd/classes/systemd.bbclass
+++ b/meta-systemd/classes/systemd.bbclass
@@ -180,8 +180,21 @@  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):
+	"""     Setup rdepends / rrecommmends as:
+
+                -----------------------------
+                |  pkg_systemd_base: 'foo'  |
+                -----------------------------
+                           |    ^
+                           |    |                 --------------
+               rrecommends |    | rdepends        | 'systemd'  |
+                           |    |               ->--------------
+                           V    |              / rdepends
+                ------------------------------/
+                | pkg_systemd: 'foo-systemd' |
+                ------------------------------
+	"""
+	def systemd_add_rdepends_rrecommends(pkg_systemd):
 		# RDEPENDS_${pkg_systemd} += pkg_systemd_base systemd
 		rdepends = d.getVar('RDEPENDS_' + pkg_systemd, 1) or ""
 		rdepends_arr = rdepends.split()
@@ -195,13 +208,18 @@  python populate_packages_prepend () {
 		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)
-
+		# RRECOMMENDS_${pkg_systemd_base} += pkg_systemd systemd
+		rrecommends = d.getVar('RRECOMMENDS_' + pkg_systemd_base, 1) or ""
+		# not rrecommending myself AND avoid double entries
+		if pkg_systemd != pkg_systemd_base and not pkg_systemd in rrecommends.split():
+			rrecommends = '%s %s' % (rrecommends, pkg_systemd)
+		d.setVar('RRECOMMENDS_' + pkg_systemd_base, rrecommends)
 
 	# run all modifications once when creating package
 	if os.path.exists('${D}'):
 		for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
 			if get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd) != "":
 				systemd_generate_package_scripts(pkg_systemd)
-				systemd_add_rdepends(pkg_systemd)
+				systemd_add_rdepends_rrecommends(pkg_systemd)
 		systemd_check_services()
 }