aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/classes
diff options
context:
space:
mode:
authorAndreas Müller <schnitzeltony@googlemail.com>2012-02-16 02:02:56 +0000
committerKoen Kooi <koen@dominion.thruhere.net>2012-02-23 16:46:31 +0100
commit3502ef4afd1086fde15035a4a6ed0aab01d4a92c (patch)
tree9b8557bfebc25c05a67b0a23e0fb20750d79e69f /meta-oe/classes
parent6143fd76a1a6d3f7dded308528e9ea5d60225231 (diff)
downloadmeta-openembedded-3502ef4afd1086fde15035a4a6ed0aab01d4a92c.tar.gz
meta-openembedded-3502ef4afd1086fde15035a4a6ed0aab01d4a92c.tar.bz2
meta-openembedded-3502ef4afd1086fde15035a4a6ed0aab01d4a92c.zip
systemd.bbclass: enhance checks for SYSTEMD_PACKAGES and SYSTEMD_SERVICE
after recipe parsing the following plausibilities are checked: * ERROR if empty SYSTEMD_PACKAGES * ERROR if SYSTEMD_PACKAGES entry does not contain '-systemd' AND package_name != ${PN} * ERROR if SYSTEMD_PACKAGES entry contains '-systemd' but entry without '-systemd' (base pkg) does not exist * WARNING if SYSTEMD_PACKAGES containing ${PN} to force package maintainers to split out systemd-specific files into *-systemd * error if SYSTEMD_SERVICE(_<systemd-package>) is empty for one or more entries in SYSTEMD_PACKAGES The code in populate_packages_prepend to set SYSTEMD_PACKAGES to ${PN} as default was removed. Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> Acked-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r--meta-oe/classes/systemd.bbclass47
1 files changed, 39 insertions, 8 deletions
diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index 91faab957..a99036c01 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -27,9 +27,45 @@ systemctl disable ${SYSTEMD_SERVICE}
}
def systemd_after_parse(d):
- if bb.data.getVar('SYSTEMD_PACKAGES', d) == None:
- if bb.data.getVar('SYSTEMD_SERVICE', d) == None:
- raise bb.build.FuncFailed, "%s inherits systemd but doesn't set SYSTEMD_SERVICE" % bb.data.getVar('FILE', d)
+ def systemd_check_vars():
+ bpn = d.getVar('BPN', 1)
+ # not for native / only at parse time
+ if d.getVar('BB_WORKERCONTEXT', True) is None and \
+ bpn + "-native" != d.getVar('PN', 1) and \
+ bpn + "-cross" != d.getVar('PN', 1) and \
+ bpn + "-nativesdk" != d.getVar('PN', 1):
+ bb_filename = d.getVar('FILE')
+ packages = d.getVar('PACKAGES', 1)
+
+ # check SYSTEMD_PACKAGES
+ systemd_pkgs = d.getVar('SYSTEMD_PACKAGES', 1) or ""
+ if systemd_pkgs == "":
+ raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_PACKAGES" % bb_filename
+ for pkg_systemd in systemd_pkgs.split():
+ if pkg_systemd.find("-systemd") == -1:
+ if pkg_systemd != d.getVar('PN', 1):
+ raise bb.build.FuncFailed, \
+ "\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \
+ (bb_filename, pkg_systemd)
+ else:
+ bb.warn("%s: it is recommended to set SYSTEMD_PACKAGES as <existing-package>-systemd" % bb_filename)
+ else:
+ pkg_systemd_base = pkg_systemd.replace('-systemd', '')
+ if pkg_systemd_base not in packages:
+ raise bb.build.FuncFailed, \
+ "\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \
+ ( bb_filename, pkg_systemd)
+
+ # check SYSTEMD_SERVICE
+ 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)
+
+
+ systemd_check_vars()
+
python __anonymous() {
systemd_after_parse(d)
@@ -72,11 +108,6 @@ python populate_packages_prepend () {
pkgs = bb.data.getVar('SYSTEMD_PACKAGES', d, 1)
- if pkgs == None:
- pkgs = bb.data.getVar('PN', d, 1)
- packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
- if not pkgs in packages and packages != []:
- pkgs = packages[0]
for pkg in pkgs.split():
systemd_package(pkg)
}