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/useradd-staticids.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/useradd-staticids.bbclass')
-rw-r--r-- | meta/classes/useradd-staticids.bbclass | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass index 4162774e9c..94bcbaa3d7 100644 --- a/meta/classes/useradd-staticids.bbclass +++ b/meta/classes/useradd-staticids.bbclass | |||
@@ -8,11 +8,11 @@ def update_useradd_static_config(d): | |||
8 | 8 | ||
9 | class myArgumentParser( argparse.ArgumentParser ): | 9 | class myArgumentParser( argparse.ArgumentParser ): |
10 | def _print_message(self, message, file=None): | 10 | def _print_message(self, message, file=None): |
11 | bb.warn("%s - %s: %s" % (d.getVar('PN', True), pkg, message)) | 11 | bb.warn("%s - %s: %s" % (d.getVar('PN'), pkg, message)) |
12 | 12 | ||
13 | # This should never be called... | 13 | # This should never be called... |
14 | def exit(self, status=0, message=None): | 14 | def exit(self, status=0, message=None): |
15 | message = message or ("%s - %s: useradd.bbclass: Argument parsing exited" % (d.getVar('PN', True), pkg)) | 15 | message = message or ("%s - %s: useradd.bbclass: Argument parsing exited" % (d.getVar('PN'), pkg)) |
16 | error(message) | 16 | error(message) |
17 | 17 | ||
18 | def error(self, message): | 18 | def error(self, message): |
@@ -52,10 +52,10 @@ def update_useradd_static_config(d): | |||
52 | 52 | ||
53 | def handle_missing_id(id, type, pkg): | 53 | def handle_missing_id(id, type, pkg): |
54 | # For backwards compatibility we accept "1" in addition to "error" | 54 | # For backwards compatibility we accept "1" in addition to "error" |
55 | if d.getVar('USERADD_ERROR_DYNAMIC', True) == 'error' or d.getVar('USERADD_ERROR_DYNAMIC', True) == '1': | 55 | if d.getVar('USERADD_ERROR_DYNAMIC') == 'error' or d.getVar('USERADD_ERROR_DYNAMIC') == '1': |
56 | raise NotImplementedError("%s - %s: %sname %s does not have a static ID defined. Skipping it." % (d.getVar('PN', True), pkg, type, id)) | 56 | raise NotImplementedError("%s - %s: %sname %s does not have a static ID defined. Skipping it." % (d.getVar('PN'), pkg, type, id)) |
57 | elif d.getVar('USERADD_ERROR_DYNAMIC', True) == 'warn': | 57 | elif d.getVar('USERADD_ERROR_DYNAMIC') == 'warn': |
58 | bb.warn("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id)) | 58 | bb.warn("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id)) |
59 | 59 | ||
60 | # We parse and rewrite the useradd components | 60 | # We parse and rewrite the useradd components |
61 | def rewrite_useradd(params): | 61 | def rewrite_useradd(params): |
@@ -89,8 +89,8 @@ def update_useradd_static_config(d): | |||
89 | # paths are resolved via BBPATH | 89 | # paths are resolved via BBPATH |
90 | def get_passwd_list(d): | 90 | def get_passwd_list(d): |
91 | str = "" | 91 | str = "" |
92 | bbpath = d.getVar('BBPATH', True) | 92 | bbpath = d.getVar('BBPATH') |
93 | passwd_tables = d.getVar('USERADD_UID_TABLES', True) | 93 | passwd_tables = d.getVar('USERADD_UID_TABLES') |
94 | if not passwd_tables: | 94 | if not passwd_tables: |
95 | passwd_tables = 'files/passwd' | 95 | passwd_tables = 'files/passwd' |
96 | for conf_file in passwd_tables.split(): | 96 | for conf_file in passwd_tables.split(): |
@@ -106,7 +106,7 @@ def update_useradd_static_config(d): | |||
106 | try: | 106 | try: |
107 | uaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param)) | 107 | uaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param)) |
108 | except: | 108 | except: |
109 | bb.fatal("%s: Unable to parse arguments for USERADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param)) | 109 | bb.fatal("%s: Unable to parse arguments for USERADD_PARAM_%s: '%s'" % (d.getVar('PN'), pkg, param)) |
110 | 110 | ||
111 | # Read all passwd files specified in USERADD_UID_TABLES or files/passwd | 111 | # Read all passwd files specified in USERADD_UID_TABLES or files/passwd |
112 | # Use the standard passwd layout: | 112 | # Use the standard passwd layout: |
@@ -130,7 +130,7 @@ def update_useradd_static_config(d): | |||
130 | field = users[uaargs.LOGIN] | 130 | field = users[uaargs.LOGIN] |
131 | 131 | ||
132 | if uaargs.uid and field[2] and (uaargs.uid != field[2]): | 132 | if uaargs.uid and field[2] and (uaargs.uid != field[2]): |
133 | bb.warn("%s: Changing username %s's uid from (%s) to (%s), verify configuration files!" % (d.getVar('PN', True), uaargs.LOGIN, uaargs.uid, field[2])) | 133 | bb.warn("%s: Changing username %s's uid from (%s) to (%s), verify configuration files!" % (d.getVar('PN'), uaargs.LOGIN, uaargs.uid, field[2])) |
134 | uaargs.uid = field[2] or uaargs.uid | 134 | uaargs.uid = field[2] or uaargs.uid |
135 | 135 | ||
136 | # Determine the possible groupname | 136 | # Determine the possible groupname |
@@ -158,12 +158,12 @@ def update_useradd_static_config(d): | |||
158 | # We want to add a group, but we don't know it's name... so we can't add the group... | 158 | # We want to add a group, but we don't know it's name... so we can't add the group... |
159 | # We have to assume the group has previously been added or we'll fail on the adduser... | 159 | # We have to assume the group has previously been added or we'll fail on the adduser... |
160 | # Note: specifying the actual gid is very rare in OE, usually the group name is specified. | 160 | # Note: specifying the actual gid is very rare in OE, usually the group name is specified. |
161 | bb.warn("%s: Changing gid for login %s to %s, verify configuration files!" % (d.getVar('PN', True), uaargs.LOGIN, uaargs.groupid)) | 161 | bb.warn("%s: Changing gid for login %s to %s, verify configuration files!" % (d.getVar('PN'), uaargs.LOGIN, uaargs.groupid)) |
162 | 162 | ||
163 | uaargs.gid = uaargs.groupid | 163 | uaargs.gid = uaargs.groupid |
164 | uaargs.user_group = None | 164 | uaargs.user_group = None |
165 | if newgroup: | 165 | if newgroup: |
166 | groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg, True) | 166 | groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg) |
167 | if groupadd: | 167 | if groupadd: |
168 | d.setVar("GROUPADD_PARAM_%s" % pkg, "%s; %s" % (groupadd, newgroup)) | 168 | d.setVar("GROUPADD_PARAM_%s" % pkg, "%s; %s" % (groupadd, newgroup)) |
169 | else: | 169 | else: |
@@ -223,8 +223,8 @@ def update_useradd_static_config(d): | |||
223 | # paths are resolved via BBPATH | 223 | # paths are resolved via BBPATH |
224 | def get_group_list(d): | 224 | def get_group_list(d): |
225 | str = "" | 225 | str = "" |
226 | bbpath = d.getVar('BBPATH', True) | 226 | bbpath = d.getVar('BBPATH') |
227 | group_tables = d.getVar('USERADD_GID_TABLES', True) | 227 | group_tables = d.getVar('USERADD_GID_TABLES') |
228 | if not group_tables: | 228 | if not group_tables: |
229 | group_tables = 'files/group' | 229 | group_tables = 'files/group' |
230 | for conf_file in group_tables.split(): | 230 | for conf_file in group_tables.split(): |
@@ -241,7 +241,7 @@ def update_useradd_static_config(d): | |||
241 | # If we're processing multiple lines, we could have left over values here... | 241 | # If we're processing multiple lines, we could have left over values here... |
242 | gaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param)) | 242 | gaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param)) |
243 | except: | 243 | except: |
244 | bb.fatal("%s: Unable to parse arguments for GROUPADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param)) | 244 | bb.fatal("%s: Unable to parse arguments for GROUPADD_PARAM_%s: '%s'" % (d.getVar('PN'), pkg, param)) |
245 | 245 | ||
246 | # Read all group files specified in USERADD_GID_TABLES or files/group | 246 | # Read all group files specified in USERADD_GID_TABLES or files/group |
247 | # Use the standard group layout: | 247 | # Use the standard group layout: |
@@ -264,7 +264,7 @@ def update_useradd_static_config(d): | |||
264 | 264 | ||
265 | if field[2]: | 265 | if field[2]: |
266 | if gaargs.gid and (gaargs.gid != field[2]): | 266 | if gaargs.gid and (gaargs.gid != field[2]): |
267 | bb.warn("%s: Changing groupname %s's gid from (%s) to (%s), verify configuration files!" % (d.getVar('PN', True), gaargs.GROUP, gaargs.gid, field[2])) | 267 | bb.warn("%s: Changing groupname %s's gid from (%s) to (%s), verify configuration files!" % (d.getVar('PN'), gaargs.GROUP, gaargs.gid, field[2])) |
268 | gaargs.gid = field[2] | 268 | gaargs.gid = field[2] |
269 | 269 | ||
270 | if not gaargs.gid or not gaargs.gid.isdigit(): | 270 | if not gaargs.gid or not gaargs.gid.isdigit(): |
@@ -288,32 +288,32 @@ def update_useradd_static_config(d): | |||
288 | # the files listed in USERADD_UID/GID_TABLES. We need to tell bitbake | 288 | # the files listed in USERADD_UID/GID_TABLES. We need to tell bitbake |
289 | # about that explicitly to trigger re-parsing and thus re-execution of | 289 | # about that explicitly to trigger re-parsing and thus re-execution of |
290 | # this code when the files change. | 290 | # this code when the files change. |
291 | bbpath = d.getVar('BBPATH', True) | 291 | bbpath = d.getVar('BBPATH') |
292 | for varname, default in (('USERADD_UID_TABLES', 'files/passwd'), | 292 | for varname, default in (('USERADD_UID_TABLES', 'files/passwd'), |
293 | ('USERADD_GID_TABLES', 'files/group')): | 293 | ('USERADD_GID_TABLES', 'files/group')): |
294 | tables = d.getVar(varname, True) | 294 | tables = d.getVar(varname) |
295 | if not tables: | 295 | if not tables: |
296 | tables = default | 296 | tables = default |
297 | for conf_file in tables.split(): | 297 | for conf_file in tables.split(): |
298 | bb.parse.mark_dependency(d, bb.utils.which(bbpath, conf_file)) | 298 | bb.parse.mark_dependency(d, bb.utils.which(bbpath, conf_file)) |
299 | 299 | ||
300 | # Load and process the users and groups, rewriting the adduser/addgroup params | 300 | # Load and process the users and groups, rewriting the adduser/addgroup params |
301 | useradd_packages = d.getVar('USERADD_PACKAGES', True) | 301 | useradd_packages = d.getVar('USERADD_PACKAGES') |
302 | 302 | ||
303 | for pkg in useradd_packages.split(): | 303 | for pkg in useradd_packages.split(): |
304 | # Groupmems doesn't have anything we might want to change, so simply validating | 304 | # Groupmems doesn't have anything we might want to change, so simply validating |
305 | # is a bit of a waste -- only process useradd/groupadd | 305 | # is a bit of a waste -- only process useradd/groupadd |
306 | useradd_param = d.getVar('USERADD_PARAM_%s' % pkg, True) | 306 | useradd_param = d.getVar('USERADD_PARAM_%s' % pkg) |
307 | if useradd_param: | 307 | if useradd_param: |
308 | #bb.warn("Before: 'USERADD_PARAM_%s' - '%s'" % (pkg, useradd_param)) | 308 | #bb.warn("Before: 'USERADD_PARAM_%s' - '%s'" % (pkg, useradd_param)) |
309 | d.setVar('USERADD_PARAM_%s' % pkg, rewrite_useradd(useradd_param)) | 309 | d.setVar('USERADD_PARAM_%s' % pkg, rewrite_useradd(useradd_param)) |
310 | #bb.warn("After: 'USERADD_PARAM_%s' - '%s'" % (pkg, d.getVar('USERADD_PARAM_%s' % pkg, True))) | 310 | #bb.warn("After: 'USERADD_PARAM_%s' - '%s'" % (pkg, d.getVar('USERADD_PARAM_%s' % pkg))) |
311 | 311 | ||
312 | groupadd_param = d.getVar('GROUPADD_PARAM_%s' % pkg, True) | 312 | groupadd_param = d.getVar('GROUPADD_PARAM_%s' % pkg) |
313 | if groupadd_param: | 313 | if groupadd_param: |
314 | #bb.warn("Before: 'GROUPADD_PARAM_%s' - '%s'" % (pkg, groupadd_param)) | 314 | #bb.warn("Before: 'GROUPADD_PARAM_%s' - '%s'" % (pkg, groupadd_param)) |
315 | d.setVar('GROUPADD_PARAM_%s' % pkg, rewrite_groupadd(groupadd_param)) | 315 | d.setVar('GROUPADD_PARAM_%s' % pkg, rewrite_groupadd(groupadd_param)) |
316 | #bb.warn("After: 'GROUPADD_PARAM_%s' - '%s'" % (pkg, d.getVar('GROUPADD_PARAM_%s' % pkg, True))) | 316 | #bb.warn("After: 'GROUPADD_PARAM_%s' - '%s'" % (pkg, d.getVar('GROUPADD_PARAM_%s' % pkg))) |
317 | 317 | ||
318 | 318 | ||
319 | 319 | ||
@@ -323,6 +323,6 @@ python __anonymous() { | |||
323 | try: | 323 | try: |
324 | update_useradd_static_config(d) | 324 | update_useradd_static_config(d) |
325 | except NotImplementedError as f: | 325 | except NotImplementedError as f: |
326 | bb.debug(1, "Skipping recipe %s: %s" % (d.getVar('PN', True), f)) | 326 | bb.debug(1, "Skipping recipe %s: %s" % (d.getVar('PN'), f)) |
327 | raise bb.parse.SkipPackage(f) | 327 | raise bb.parse.SkipPackage(f) |
328 | } | 328 | } |