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

login
register
mail settings
Submitter Andreas Müller
Date Feb. 11, 2012, 2 a.m.
Message ID <1328925603-2967-7-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/21169/
State Superseded
Headers show

Comments

Andreas Müller - Feb. 11, 2012, 2 a.m.
* append systemd (functionalty moved into systemd_add_rdepends)
* append base-pgk

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-oe/classes/systemd.bbclass |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
Otavio Salvador - Feb. 11, 2012, 1:19 p.m.
On Sat, Feb 11, 2012 at 00:00, Andreas Müller
<schnitzeltony@googlemail.com>wrote:

> * append systemd (functionalty moved into systemd_add_rdepends)
> * append base-pgk
>

This patch is OK but I think it would be nice if the recipe has it included
in rdepends byhand we could do a warning saying it's use is deprecated so
we can know about it and cleanup the recipes.
Andreas Müller - Feb. 12, 2012, 10:16 p.m.
On Sat, Feb 11, 2012 at 2:19 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> On Sat, Feb 11, 2012 at 00:00, Andreas Müller
> <schnitzeltony@googlemail.com>wrote:
>
>> * append systemd (functionalty moved into systemd_add_rdepends)
>> * append base-pgk
>>
>
> This patch is OK but I think it would be nice if the recipe has it included
> in rdepends byhand we could do a warning saying it's use is deprecated so
> we can know about it and cleanup the recipes.
>
good suggestion - V2 will have it

Andreas

Patch

diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index 8927980..edc2872 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -116,10 +116,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 systemd files to FILES_*-systemd
 	def systemd_add_files(pkg_systemd):
 		systemd_services = d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) or d.getVar('SYSTEMD_SERVICE', 1)
@@ -136,7 +132,22 @@  python populate_packages_prepend () {
 		files = d.getVar(var_name, 0) or ""
 		d.setVar(var_name, "%s %s" % (files, files_append))
 
+	# *-systemd packages get RDEPENDS to systemd and their base package
+	def systemd_add_rdepends(pkg_systemd):
+		pn_pkg = d.getVar('PN', 1)
+		# RDEPENDS_${pkg_systemd} += pkg_systemd_base systemd
+		rdepends = explode_deps(d.getVar('RDEPENDS_' + pkg_systemd, 1) or "")
+		if not 'systemd' in rdepends:
+			rdepends.append('systemd')
+		pkg_systemd_base = pkg_systemd.replace('-systemd', '')
+		# not rdepending myself / avoid double entries
+		if pkg_systemd != pn_pkg and not pkg_systemd_base in rdepends:
+			rdepends.append(pkg_systemd_base)
+		d.setVar('RDEPENDS_' + pkg_systemd, " " + " ".join(rdepends))
+
+
 	for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
 		systemd_prepost_instrm(pkg_systemd)
 		systemd_add_files(pkg_systemd)
+		systemd_add_rdepends(pkg_systemd)
 }