diff options
author | Andreas Müller <schnitzeltony@googlemail.com> | 2012-06-01 09:20:25 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-06-05 10:46:50 +0200 |
commit | b52a74b7a245a28dcdd91c3336e1cd86604befac (patch) | |
tree | 1c0146b567d1dd8d6b1da47e1e27af650619656f /meta-oe/classes | |
parent | 27e2e32869c705ac42f64ffc7073b63219778226 (diff) | |
download | meta-openembedded-b52a74b7a245a28dcdd91c3336e1cd86604befac.tar.gz |
systemd.bbclass: extract SYSTEMD_SERVICE properly
To set service files the following syntax is allowed:
SYSTEMD_SERVICE = <service_file>
or
SYSTEMD_SERVICE_{<systemd_package_name>} = <service_file>
A function get_package_var was introduced to handle all use-cases [1]
properly.
Build tested / buildhistory checks
[1] http://lists.linuxtogo.org/pipermail/openembedded-devel/2012-May/039870.html
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r-- | meta-oe/classes/systemd.bbclass | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass index 2881abff6..2e585c3ec 100644 --- a/meta-oe/classes/systemd.bbclass +++ b/meta-oe/classes/systemd.bbclass | |||
@@ -24,6 +24,12 @@ systemd_postrm() { | |||
24 | systemctl disable ${SYSTEMD_SERVICE} | 24 | systemctl disable ${SYSTEMD_SERVICE} |
25 | } | 25 | } |
26 | 26 | ||
27 | def get_package_var(d, var, pkg): | ||
28 | val = (d.getVar('%s_%s' % (var, pkg), d, 1) or "").strip() | ||
29 | if val == "": | ||
30 | val = (d.getVar(var, d, 1) or "").strip() | ||
31 | return val | ||
32 | |||
27 | def systemd_after_parse(d): | 33 | def systemd_after_parse(d): |
28 | def systemd_check_vars(): | 34 | def systemd_check_vars(): |
29 | if d.getVar('BB_WORKERCONTEXT', True) is not None: | 35 | if d.getVar('BB_WORKERCONTEXT', True) is not None: |
@@ -155,8 +161,7 @@ python populate_packages_prepend () { | |||
155 | systemd_packages = d.getVar('SYSTEMD_PACKAGES', 1) | 161 | systemd_packages = d.getVar('SYSTEMD_PACKAGES', 1) |
156 | has_exactly_one_service = len(systemd_packages.split()) == 1 | 162 | has_exactly_one_service = len(systemd_packages.split()) == 1 |
157 | if has_exactly_one_service: | 163 | if has_exactly_one_service: |
158 | systemd_services = d.getVar('SYSTEMD_SERVICE' + "_" + systemd_packages, 1) or d.getVar('SYSTEMD_SERVICE', 1) | 164 | has_exactly_one_service = len(get_package_var(d, 'SYSTEMD_SERVICE', systemd_packages).split()) == 1 |
159 | has_exactly_one_service = len(systemd_services.split()) == 1 | ||
160 | 165 | ||
161 | keys = 'Also' # Conflicts?? | 166 | keys = 'Also' # Conflicts?? |
162 | if has_exactly_one_service: | 167 | if has_exactly_one_service: |
@@ -164,8 +169,7 @@ python populate_packages_prepend () { | |||
164 | keys = 'Also Conflicts' | 169 | keys = 'Also Conflicts' |
165 | # scan for all in SYSTEMD_SERVICE[] | 170 | # scan for all in SYSTEMD_SERVICE[] |
166 | for pkg_systemd in systemd_packages.split(): | 171 | for pkg_systemd in systemd_packages.split(): |
167 | systemd_services = d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) or d.getVar('SYSTEMD_SERVICE', 1) | 172 | for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split(): |
168 | for service in systemd_services.split(): | ||
169 | path_found = '' | 173 | path_found = '' |
170 | for path in searchpaths.split(): | 174 | for path in searchpaths.split(): |
171 | if os.path.exists('${D}' + path + service): | 175 | if os.path.exists('${D}' + path + service): |
@@ -196,7 +200,7 @@ python populate_packages_prepend () { | |||
196 | # run all modifications once when creating package | 200 | # run all modifications once when creating package |
197 | if os.path.exists('${D}'): | 201 | if os.path.exists('${D}'): |
198 | for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split(): | 202 | for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split(): |
199 | if d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) and d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1).strip(): | 203 | if get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd) != "": |
200 | systemd_generate_package_scripts(pkg_systemd) | 204 | systemd_generate_package_scripts(pkg_systemd) |
201 | systemd_add_rdepends(pkg_systemd) | 205 | systemd_add_rdepends(pkg_systemd) |
202 | systemd_check_services() | 206 | systemd_check_services() |