diff options
author | Andreas Müller <schnitzeltony@googlemail.com> | 2012-02-16 02:02:56 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-02-23 16:46:31 +0100 |
commit | 3502ef4afd1086fde15035a4a6ed0aab01d4a92c (patch) | |
tree | 9b8557bfebc25c05a67b0a23e0fb20750d79e69f /meta-oe | |
parent | 6143fd76a1a6d3f7dded308528e9ea5d60225231 (diff) | |
download | meta-openembedded-3502ef4afd1086fde15035a4a6ed0aab01d4a92c.tar.gz |
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')
-rw-r--r-- | meta-oe/classes/systemd.bbclass | 47 |
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} | |||
27 | } | 27 | } |
28 | 28 | ||
29 | def systemd_after_parse(d): | 29 | def systemd_after_parse(d): |
30 | if bb.data.getVar('SYSTEMD_PACKAGES', d) == None: | 30 | def systemd_check_vars(): |
31 | if bb.data.getVar('SYSTEMD_SERVICE', d) == None: | 31 | bpn = d.getVar('BPN', 1) |
32 | raise bb.build.FuncFailed, "%s inherits systemd but doesn't set SYSTEMD_SERVICE" % bb.data.getVar('FILE', d) | 32 | # not for native / only at parse time |
33 | if d.getVar('BB_WORKERCONTEXT', True) is None and \ | ||
34 | bpn + "-native" != d.getVar('PN', 1) and \ | ||
35 | bpn + "-cross" != d.getVar('PN', 1) and \ | ||
36 | bpn + "-nativesdk" != d.getVar('PN', 1): | ||
37 | bb_filename = d.getVar('FILE') | ||
38 | packages = d.getVar('PACKAGES', 1) | ||
39 | |||
40 | # check SYSTEMD_PACKAGES | ||
41 | systemd_pkgs = d.getVar('SYSTEMD_PACKAGES', 1) or "" | ||
42 | if systemd_pkgs == "": | ||
43 | raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_PACKAGES" % bb_filename | ||
44 | for pkg_systemd in systemd_pkgs.split(): | ||
45 | if pkg_systemd.find("-systemd") == -1: | ||
46 | if pkg_systemd != d.getVar('PN', 1): | ||
47 | raise bb.build.FuncFailed, \ | ||
48 | "\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \ | ||
49 | (bb_filename, pkg_systemd) | ||
50 | else: | ||
51 | bb.warn("%s: it is recommended to set SYSTEMD_PACKAGES as <existing-package>-systemd" % bb_filename) | ||
52 | else: | ||
53 | pkg_systemd_base = pkg_systemd.replace('-systemd', '') | ||
54 | if pkg_systemd_base not in packages: | ||
55 | raise bb.build.FuncFailed, \ | ||
56 | "\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \ | ||
57 | ( bb_filename, pkg_systemd) | ||
58 | |||
59 | # check SYSTEMD_SERVICE | ||
60 | for pkg_systemd in systemd_pkgs.split(): | ||
61 | service_pkg = 'SYSTEMD_SERVICE' + "_" + pkg_systemd | ||
62 | systemd_services = d.getVar(service_pkg, 1) or d.getVar('SYSTEMD_SERVICE', 1) or "" | ||
63 | if systemd_services == "": | ||
64 | raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_SERVICE / %s" % (bb_filename, service_pkg) | ||
65 | |||
66 | |||
67 | systemd_check_vars() | ||
68 | |||
33 | 69 | ||
34 | python __anonymous() { | 70 | python __anonymous() { |
35 | systemd_after_parse(d) | 71 | systemd_after_parse(d) |
@@ -72,11 +108,6 @@ python populate_packages_prepend () { | |||
72 | 108 | ||
73 | 109 | ||
74 | pkgs = bb.data.getVar('SYSTEMD_PACKAGES', d, 1) | 110 | pkgs = bb.data.getVar('SYSTEMD_PACKAGES', d, 1) |
75 | if pkgs == None: | ||
76 | pkgs = bb.data.getVar('PN', d, 1) | ||
77 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | ||
78 | if not pkgs in packages and packages != []: | ||
79 | pkgs = packages[0] | ||
80 | for pkg in pkgs.split(): | 111 | for pkg in pkgs.split(): |
81 | systemd_package(pkg) | 112 | systemd_package(pkg) |
82 | } | 113 | } |