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

login
register
mail settings
Submitter Andreas Müller
Date Feb. 16, 2012, 2:03 a.m.
Message ID <1329357796-27398-8-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/21331/
State Superseded, archived
Headers show

Comments

Andreas Müller - Feb. 16, 2012, 2:03 a.m.
* append systemd:  functionalty moved into systemd_add_rdepends
* append base-pgk: create warning if *-systemd package already rdepends
                   it's base package

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-oe/classes/systemd.bbclass |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
Otavio Salvador - Feb. 16, 2012, 10:05 a.m.
Acked-by: Otavio Salvador <otavio@ossystems.com.br>

On Thu, Feb 16, 2012 at 00:03, Andreas Müller
<schnitzeltony@googlemail.com>wrote:

> * append systemd:  functionalty moved into systemd_add_rdepends
> * append base-pgk: create warning if *-systemd package already rdepends
>                   it's base package
>
> Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
>

Patch

diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index 1e0f3e0..ecd3b8d 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -187,8 +187,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):
+		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
+		if pkg_systemd != pn_pkg:
+			#  avoid double entries
+			if not pkg_systemd_base in rdepends:
+				rdepends.append(pkg_systemd_base)
+			else:
+				bb.warn("%s: it is recommended to remove %s from RDEPENDS_%s since systemd.bbclass takes care" % \
+					(d.getVar('FILE'), pkg_systemd_base, pkg_systemd))
+		d.setVar('RDEPENDS_' + pkg_systemd, " " + " ".join(rdepends))
+
 
 	for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
 		systemd_generate_package_scripts(pkg_systemd)
+		systemd_add_rdepends(pkg_systemd)
 	systemd_check_services()
 }