summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}
27} 27}
28 28
29def systemd_after_parse(d): 29def 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
34python __anonymous() { 70python __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}