diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-12-14 21:13:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-16 10:23:23 +0000 |
commit | c4e2c59088765d1f1de7ec57cde91980f887c2ff (patch) | |
tree | a2fda8ac5916fb59a711e9220c2177008cca9347 /meta/classes/systemd.bbclass | |
parent | d5e67725ac11e3296cad104470931ffa16824b90 (diff) | |
download | poky-c4e2c59088765d1f1de7ec57cde91980f887c2ff.tar.gz |
meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.
Search made with the following regex: getVar ?\(( ?[^,()]*), True\)
(From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f)
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/systemd.bbclass')
-rw-r--r-- | meta/classes/systemd.bbclass | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass index 99a08a09a4..34bfefad40 100644 --- a/meta/classes/systemd.bbclass +++ b/meta/classes/systemd.bbclass | |||
@@ -71,12 +71,12 @@ python systemd_populate_packages() { | |||
71 | def get_package_var(d, var, pkg): | 71 | def get_package_var(d, var, pkg): |
72 | val = (d.getVar('%s_%s' % (var, pkg), True) or "").strip() | 72 | val = (d.getVar('%s_%s' % (var, pkg), True) or "").strip() |
73 | if val == "": | 73 | if val == "": |
74 | val = (d.getVar(var, True) or "").strip() | 74 | val = (d.getVar(var) or "").strip() |
75 | return val | 75 | return val |
76 | 76 | ||
77 | # Check if systemd-packages already included in PACKAGES | 77 | # Check if systemd-packages already included in PACKAGES |
78 | def systemd_check_package(pkg_systemd): | 78 | def systemd_check_package(pkg_systemd): |
79 | packages = d.getVar('PACKAGES', True) | 79 | packages = d.getVar('PACKAGES') |
80 | if not pkg_systemd in packages.split(): | 80 | if not pkg_systemd in packages.split(): |
81 | bb.error('%s does not appear in package list, please add it' % pkg_systemd) | 81 | bb.error('%s does not appear in package list, please add it' % pkg_systemd) |
82 | 82 | ||
@@ -90,23 +90,23 @@ python systemd_populate_packages() { | |||
90 | localdata.prependVar("OVERRIDES", pkg + ":") | 90 | localdata.prependVar("OVERRIDES", pkg + ":") |
91 | bb.data.update_data(localdata) | 91 | bb.data.update_data(localdata) |
92 | 92 | ||
93 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) | 93 | postinst = d.getVar('pkg_postinst_%s' % pkg) |
94 | if not postinst: | 94 | if not postinst: |
95 | postinst = '#!/bin/sh\n' | 95 | postinst = '#!/bin/sh\n' |
96 | postinst += localdata.getVar('systemd_postinst', True) | 96 | postinst += localdata.getVar('systemd_postinst') |
97 | d.setVar('pkg_postinst_%s' % pkg, postinst) | 97 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
98 | 98 | ||
99 | prerm = d.getVar('pkg_prerm_%s' % pkg, True) | 99 | prerm = d.getVar('pkg_prerm_%s' % pkg) |
100 | if not prerm: | 100 | if not prerm: |
101 | prerm = '#!/bin/sh\n' | 101 | prerm = '#!/bin/sh\n' |
102 | prerm += localdata.getVar('systemd_prerm', True) | 102 | prerm += localdata.getVar('systemd_prerm') |
103 | d.setVar('pkg_prerm_%s' % pkg, prerm) | 103 | d.setVar('pkg_prerm_%s' % pkg, prerm) |
104 | 104 | ||
105 | 105 | ||
106 | # Add files to FILES_*-systemd if existent and not already done | 106 | # Add files to FILES_*-systemd if existent and not already done |
107 | def systemd_append_file(pkg_systemd, file_append): | 107 | def systemd_append_file(pkg_systemd, file_append): |
108 | appended = False | 108 | appended = False |
109 | if os.path.exists(oe.path.join(d.getVar("D", True), file_append)): | 109 | if os.path.exists(oe.path.join(d.getVar("D"), file_append)): |
110 | var_name = "FILES_" + pkg_systemd | 110 | var_name = "FILES_" + pkg_systemd |
111 | files = d.getVar(var_name, False) or "" | 111 | files = d.getVar(var_name, False) or "" |
112 | if file_append not in files.split(): | 112 | if file_append not in files.split(): |
@@ -118,7 +118,7 @@ python systemd_populate_packages() { | |||
118 | def systemd_add_files_and_parse(pkg_systemd, path, service, keys): | 118 | def systemd_add_files_and_parse(pkg_systemd, path, service, keys): |
119 | # avoid infinite recursion | 119 | # avoid infinite recursion |
120 | if systemd_append_file(pkg_systemd, oe.path.join(path, service)): | 120 | if systemd_append_file(pkg_systemd, oe.path.join(path, service)): |
121 | fullpath = oe.path.join(d.getVar("D", True), path, service) | 121 | fullpath = oe.path.join(d.getVar("D"), path, service) |
122 | if service.find('.service') != -1: | 122 | if service.find('.service') != -1: |
123 | # for *.service add *@.service | 123 | # for *.service add *@.service |
124 | service_base = service.replace('.service', '') | 124 | service_base = service.replace('.service', '') |
@@ -141,9 +141,9 @@ python systemd_populate_packages() { | |||
141 | 141 | ||
142 | # Check service-files and call systemd_add_files_and_parse for each entry | 142 | # Check service-files and call systemd_add_files_and_parse for each entry |
143 | def systemd_check_services(): | 143 | def systemd_check_services(): |
144 | searchpaths = [oe.path.join(d.getVar("sysconfdir", True), "systemd", "system"),] | 144 | searchpaths = [oe.path.join(d.getVar("sysconfdir"), "systemd", "system"),] |
145 | searchpaths.append(d.getVar("systemd_system_unitdir", True)) | 145 | searchpaths.append(d.getVar("systemd_system_unitdir")) |
146 | systemd_packages = d.getVar('SYSTEMD_PACKAGES', True) | 146 | systemd_packages = d.getVar('SYSTEMD_PACKAGES') |
147 | 147 | ||
148 | keys = 'Also' | 148 | keys = 'Also' |
149 | # scan for all in SYSTEMD_SERVICE[] | 149 | # scan for all in SYSTEMD_SERVICE[] |
@@ -158,11 +158,11 @@ python systemd_populate_packages() { | |||
158 | base = re.sub('@[^.]+.', '@.', service) | 158 | base = re.sub('@[^.]+.', '@.', service) |
159 | 159 | ||
160 | for path in searchpaths: | 160 | for path in searchpaths: |
161 | if os.path.exists(oe.path.join(d.getVar("D", True), path, service)): | 161 | if os.path.exists(oe.path.join(d.getVar("D"), path, service)): |
162 | path_found = path | 162 | path_found = path |
163 | break | 163 | break |
164 | elif base is not None: | 164 | elif base is not None: |
165 | if os.path.exists(oe.path.join(d.getVar("D", True), path, base)): | 165 | if os.path.exists(oe.path.join(d.getVar("D"), path, base)): |
166 | path_found = path | 166 | path_found = path |
167 | break | 167 | break |
168 | 168 | ||
@@ -172,10 +172,10 @@ python systemd_populate_packages() { | |||
172 | bb.fatal("SYSTEMD_SERVICE_%s value %s does not exist" % (pkg_systemd, service)) | 172 | bb.fatal("SYSTEMD_SERVICE_%s value %s does not exist" % (pkg_systemd, service)) |
173 | 173 | ||
174 | # Run all modifications once when creating package | 174 | # Run all modifications once when creating package |
175 | if os.path.exists(d.getVar("D", True)): | 175 | if os.path.exists(d.getVar("D")): |
176 | for pkg in d.getVar('SYSTEMD_PACKAGES', True).split(): | 176 | for pkg in d.getVar('SYSTEMD_PACKAGES').split(): |
177 | systemd_check_package(pkg) | 177 | systemd_check_package(pkg) |
178 | if d.getVar('SYSTEMD_SERVICE_' + pkg, True): | 178 | if d.getVar('SYSTEMD_SERVICE_' + pkg): |
179 | systemd_generate_package_scripts(pkg) | 179 | systemd_generate_package_scripts(pkg) |
180 | systemd_check_services() | 180 | systemd_check_services() |
181 | } | 181 | } |
@@ -185,7 +185,7 @@ PACKAGESPLITFUNCS_prepend = "systemd_populate_packages " | |||
185 | python rm_systemd_unitdir (){ | 185 | python rm_systemd_unitdir (){ |
186 | import shutil | 186 | import shutil |
187 | if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): | 187 | if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): |
188 | systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True)) | 188 | systemd_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_unitdir')) |
189 | if os.path.exists(systemd_unitdir): | 189 | if os.path.exists(systemd_unitdir): |
190 | shutil.rmtree(systemd_unitdir) | 190 | shutil.rmtree(systemd_unitdir) |
191 | systemd_libdir = os.path.dirname(systemd_unitdir) | 191 | systemd_libdir = os.path.dirname(systemd_unitdir) |
@@ -196,12 +196,12 @@ do_install[postfuncs] += "rm_systemd_unitdir " | |||
196 | 196 | ||
197 | python rm_sysvinit_initddir (){ | 197 | python rm_sysvinit_initddir (){ |
198 | import shutil | 198 | import shutil |
199 | sysv_initddir = oe.path.join(d.getVar("D", True), (d.getVar('INIT_D_DIR', True) or "/etc/init.d")) | 199 | sysv_initddir = oe.path.join(d.getVar("D"), (d.getVar('INIT_D_DIR') or "/etc/init.d")) |
200 | 200 | ||
201 | if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \ | 201 | if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \ |
202 | not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ | 202 | not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ |
203 | os.path.exists(sysv_initddir): | 203 | os.path.exists(sysv_initddir): |
204 | systemd_system_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_system_unitdir', True)) | 204 | systemd_system_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_system_unitdir')) |
205 | 205 | ||
206 | # If systemd_system_unitdir contains anything, delete sysv_initddir | 206 | # If systemd_system_unitdir contains anything, delete sysv_initddir |
207 | if (os.path.exists(systemd_system_unitdir) and os.listdir(systemd_system_unitdir)): | 207 | if (os.path.exists(systemd_system_unitdir) and os.listdir(systemd_system_unitdir)): |