diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-28 23:28:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-02 15:44:10 +0100 |
commit | bb6ddc3691ab04162ec5fd69a2d5e7876713fd15 (patch) | |
tree | 76e376b01253c3aace1a98a5021bcaad3c92e861 /meta/classes/systemd.bbclass | |
parent | fcc456ee4b8f619134abb4649db53c638074082c (diff) | |
download | poky-bb6ddc3691ab04162ec5fd69a2d5e7876713fd15.tar.gz |
Convert to new override syntax
This is the result of automated script conversion:
scripts/contrib/convert-overrides.py <oe-core directory>
converting the metadata to use ":" as the override character instead of "_".
(From OE-Core rev: 42344347be29f0997cc2f7636d9603b1fe1875ae)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/systemd.bbclass')
-rw-r--r-- | meta/classes/systemd.bbclass | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass index db5d109545..2a272a245f 100644 --- a/meta/classes/systemd.bbclass +++ b/meta/classes/systemd.bbclass | |||
@@ -1,9 +1,9 @@ | |||
1 | # The list of packages that should have systemd packaging scripts added. For | 1 | # The list of packages that should have systemd packaging scripts added. For |
2 | # each entry, optionally have a SYSTEMD_SERVICE_[package] that lists the service | 2 | # each entry, optionally have a SYSTEMD_SERVICE:[package] that lists the service |
3 | # files in this package. If this variable isn't set, [package].service is used. | 3 | # files in this package. If this variable isn't set, [package].service is used. |
4 | SYSTEMD_PACKAGES ?= "${PN}" | 4 | SYSTEMD_PACKAGES ?= "${PN}" |
5 | SYSTEMD_PACKAGES_class-native ?= "" | 5 | SYSTEMD_PACKAGES:class-native ?= "" |
6 | SYSTEMD_PACKAGES_class-nativesdk ?= "" | 6 | SYSTEMD_PACKAGES:class-nativesdk ?= "" |
7 | 7 | ||
8 | # Whether to enable or disable the services on installation. | 8 | # Whether to enable or disable the services on installation. |
9 | SYSTEMD_AUTO_ENABLE ??= "enable" | 9 | SYSTEMD_AUTO_ENABLE ??= "enable" |
@@ -85,39 +85,39 @@ python systemd_populate_packages() { | |||
85 | def systemd_generate_package_scripts(pkg): | 85 | def systemd_generate_package_scripts(pkg): |
86 | bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg) | 86 | bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg) |
87 | 87 | ||
88 | paths_escaped = ' '.join(shlex.quote(s) for s in d.getVar('SYSTEMD_SERVICE_' + pkg).split()) | 88 | paths_escaped = ' '.join(shlex.quote(s) for s in d.getVar('SYSTEMD_SERVICE:' + pkg).split()) |
89 | d.setVar('SYSTEMD_SERVICE_ESCAPED_' + pkg, paths_escaped) | 89 | d.setVar('SYSTEMD_SERVICE_ESCAPED:' + pkg, paths_escaped) |
90 | 90 | ||
91 | # Add pkg to the overrides so that it finds the SYSTEMD_SERVICE_pkg | 91 | # Add pkg to the overrides so that it finds the SYSTEMD_SERVICE:pkg |
92 | # variable. | 92 | # variable. |
93 | localdata = d.createCopy() | 93 | localdata = d.createCopy() |
94 | localdata.prependVar("OVERRIDES", pkg + ":") | 94 | localdata.prependVar("OVERRIDES", pkg + ":") |
95 | 95 | ||
96 | postinst = d.getVar('pkg_postinst_%s' % pkg) | 96 | postinst = d.getVar('pkg_postinst:%s' % pkg) |
97 | if not postinst: | 97 | if not postinst: |
98 | postinst = '#!/bin/sh\n' | 98 | postinst = '#!/bin/sh\n' |
99 | postinst += localdata.getVar('systemd_postinst') | 99 | postinst += localdata.getVar('systemd_postinst') |
100 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 100 | d.setVar('pkg_postinst:%s' % pkg, postinst) |
101 | 101 | ||
102 | prerm = d.getVar('pkg_prerm_%s' % pkg) | 102 | prerm = d.getVar('pkg_prerm:%s' % pkg) |
103 | if not prerm: | 103 | if not prerm: |
104 | prerm = '#!/bin/sh\n' | 104 | prerm = '#!/bin/sh\n' |
105 | prerm += localdata.getVar('systemd_prerm') | 105 | prerm += localdata.getVar('systemd_prerm') |
106 | d.setVar('pkg_prerm_%s' % pkg, prerm) | 106 | d.setVar('pkg_prerm:%s' % pkg, prerm) |
107 | 107 | ||
108 | 108 | ||
109 | # Add files to FILES_*-systemd if existent and not already done | 109 | # Add files to FILES:*-systemd if existent and not already done |
110 | def systemd_append_file(pkg_systemd, file_append): | 110 | def systemd_append_file(pkg_systemd, file_append): |
111 | appended = False | 111 | appended = False |
112 | if os.path.exists(oe.path.join(d.getVar("D"), file_append)): | 112 | if os.path.exists(oe.path.join(d.getVar("D"), file_append)): |
113 | var_name = "FILES_" + pkg_systemd | 113 | var_name = "FILES:" + pkg_systemd |
114 | files = d.getVar(var_name, False) or "" | 114 | files = d.getVar(var_name, False) or "" |
115 | if file_append not in files.split(): | 115 | if file_append not in files.split(): |
116 | d.appendVar(var_name, " " + file_append) | 116 | d.appendVar(var_name, " " + file_append) |
117 | appended = True | 117 | appended = True |
118 | return appended | 118 | return appended |
119 | 119 | ||
120 | # Add systemd files to FILES_*-systemd, parse for Also= and follow recursive | 120 | # Add systemd files to FILES:*-systemd, parse for Also= and follow recursive |
121 | def systemd_add_files_and_parse(pkg_systemd, path, service, keys): | 121 | def systemd_add_files_and_parse(pkg_systemd, path, service, keys): |
122 | # avoid infinite recursion | 122 | # avoid infinite recursion |
123 | if systemd_append_file(pkg_systemd, oe.path.join(path, service)): | 123 | if systemd_append_file(pkg_systemd, oe.path.join(path, service)): |
@@ -174,32 +174,32 @@ python systemd_populate_packages() { | |||
174 | if path_found != '': | 174 | if path_found != '': |
175 | systemd_add_files_and_parse(pkg_systemd, path_found, service, keys) | 175 | systemd_add_files_and_parse(pkg_systemd, path_found, service, keys) |
176 | else: | 176 | else: |
177 | bb.fatal("Didn't find service unit '{0}', specified in SYSTEMD_SERVICE_{1}. {2}".format( | 177 | bb.fatal("Didn't find service unit '{0}', specified in SYSTEMD_SERVICE:{1}. {2}".format( |
178 | service, pkg_systemd, "Also looked for service unit '{0}'.".format(base) if base is not None else "")) | 178 | service, pkg_systemd, "Also looked for service unit '{0}'.".format(base) if base is not None else "")) |
179 | 179 | ||
180 | def systemd_create_presets(pkg, action): | 180 | def systemd_create_presets(pkg, action): |
181 | presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg) | 181 | presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg) |
182 | bb.utils.mkdirhier(os.path.dirname(presetf)) | 182 | bb.utils.mkdirhier(os.path.dirname(presetf)) |
183 | with open(presetf, 'a') as fd: | 183 | with open(presetf, 'a') as fd: |
184 | for service in d.getVar('SYSTEMD_SERVICE_%s' % pkg).split(): | 184 | for service in d.getVar('SYSTEMD_SERVICE:%s' % pkg).split(): |
185 | fd.write("%s %s\n" % (action,service)) | 185 | fd.write("%s %s\n" % (action,service)) |
186 | d.appendVar("FILES_%s" % pkg, ' ' + oe.path.join(d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg)) | 186 | d.appendVar("FILES:%s" % pkg, ' ' + oe.path.join(d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg)) |
187 | 187 | ||
188 | # Run all modifications once when creating package | 188 | # Run all modifications once when creating package |
189 | if os.path.exists(d.getVar("D")): | 189 | if os.path.exists(d.getVar("D")): |
190 | for pkg in d.getVar('SYSTEMD_PACKAGES').split(): | 190 | for pkg in d.getVar('SYSTEMD_PACKAGES').split(): |
191 | systemd_check_package(pkg) | 191 | systemd_check_package(pkg) |
192 | if d.getVar('SYSTEMD_SERVICE_' + pkg): | 192 | if d.getVar('SYSTEMD_SERVICE:' + pkg): |
193 | systemd_generate_package_scripts(pkg) | 193 | systemd_generate_package_scripts(pkg) |
194 | action = get_package_var(d, 'SYSTEMD_AUTO_ENABLE', pkg) | 194 | action = get_package_var(d, 'SYSTEMD_AUTO_ENABLE', pkg) |
195 | if action in ("enable", "disable"): | 195 | if action in ("enable", "disable"): |
196 | systemd_create_presets(pkg, action) | 196 | systemd_create_presets(pkg, action) |
197 | elif action not in ("mask", "preset"): | 197 | elif action not in ("mask", "preset"): |
198 | bb.fatal("SYSTEMD_AUTO_ENABLE_%s '%s' is not 'enable', 'disable', 'mask' or 'preset'" % (pkg, action)) | 198 | bb.fatal("SYSTEMD_AUTO_ENABLE:%s '%s' is not 'enable', 'disable', 'mask' or 'preset'" % (pkg, action)) |
199 | systemd_check_services() | 199 | systemd_check_services() |
200 | } | 200 | } |
201 | 201 | ||
202 | PACKAGESPLITFUNCS_prepend = "systemd_populate_packages " | 202 | PACKAGESPLITFUNCS:prepend = "systemd_populate_packages " |
203 | 203 | ||
204 | python rm_systemd_unitdir (){ | 204 | python rm_systemd_unitdir (){ |
205 | import shutil | 205 | import shutil |
@@ -227,7 +227,7 @@ python rm_sysvinit_initddir (){ | |||
227 | } | 227 | } |
228 | 228 | ||
229 | do_install[postfuncs] += "${RMINITDIR} " | 229 | do_install[postfuncs] += "${RMINITDIR} " |
230 | RMINITDIR_class-target = " rm_sysvinit_initddir rm_systemd_unitdir " | 230 | RMINITDIR:class-target = " rm_sysvinit_initddir rm_systemd_unitdir " |
231 | RMINITDIR_class-nativesdk = " rm_sysvinit_initddir rm_systemd_unitdir " | 231 | RMINITDIR:class-nativesdk = " rm_sysvinit_initddir rm_systemd_unitdir " |
232 | RMINITDIR = "" | 232 | RMINITDIR = "" |
233 | 233 | ||