diff options
author | Richard Purdie <richard@openedhand.com> | 2008-09-30 20:57:18 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-09-30 20:57:18 +0000 |
commit | 2e182847e4a780c58c5b8046eb98f7f6c8970ea1 (patch) | |
tree | dc3ccf060b2b04c8af29c75607260052bc92673b /bitbake-dev/lib/bb/utils.py | |
parent | 221ac2b25f544a500869667d8f95c6c12c80db1a (diff) | |
download | poky-2e182847e4a780c58c5b8046eb98f7f6c8970ea1.tar.gz |
bitbake/bitbake-dev: Allow much better control of which variable influence bitbake from the environment
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5347 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake-dev/lib/bb/utils.py')
-rw-r--r-- | bitbake-dev/lib/bb/utils.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/bitbake-dev/lib/bb/utils.py b/bitbake-dev/lib/bb/utils.py index 0a0c9ada34..9c9eb5d328 100644 --- a/bitbake-dev/lib/bb/utils.py +++ b/bitbake-dev/lib/bb/utils.py | |||
@@ -296,6 +296,60 @@ def sha256_file(filename): | |||
296 | s.update(line) | 296 | s.update(line) |
297 | return s.hexdigest() | 297 | return s.hexdigest() |
298 | 298 | ||
299 | def preserved_envvars_list(): | ||
300 | return [ | ||
301 | 'BBPATH', | ||
302 | 'BB_PRESERVE_ENV', | ||
303 | 'BB_ENV_WHITELIST', | ||
304 | 'BB_ENV_EXTRAWHITE', | ||
305 | 'COLORTERM', | ||
306 | 'DBUS_SESSION_BUS_ADDRESS', | ||
307 | 'DESKTOP_SESSION', | ||
308 | 'DESKTOP_STARTUP_ID', | ||
309 | 'DISPLAY', | ||
310 | 'GNOME_KEYRING_PID', | ||
311 | 'GNOME_KEYRING_SOCKET', | ||
312 | 'GPG_AGENT_INFO', | ||
313 | 'GTK_RC_FILES', | ||
314 | 'HOME', | ||
315 | 'LANG', | ||
316 | 'LOGNAME', | ||
317 | 'PATH', | ||
318 | 'PWD', | ||
319 | 'SESSION_MANAGER', | ||
320 | 'SHELL', | ||
321 | 'SSH_AUTH_SOCK', | ||
322 | 'TERM', | ||
323 | 'USER', | ||
324 | 'USERNAME', | ||
325 | '_', | ||
326 | 'XAUTHORITY', | ||
327 | 'XDG_DATA_DIRS', | ||
328 | 'XDG_SESSION_COOKIE', | ||
329 | ] | ||
330 | |||
331 | def filter_environment(good_vars): | ||
332 | """ | ||
333 | Create a pristine environment for bitbake. This will remove variables that | ||
334 | are not known and may influence the build in a negative way. | ||
335 | """ | ||
336 | |||
337 | import bb | ||
338 | |||
339 | removed_vars = [] | ||
340 | for key in os.environ.keys(): | ||
341 | if key in good_vars: | ||
342 | continue | ||
343 | |||
344 | removed_vars.append(key) | ||
345 | os.unsetenv(key) | ||
346 | del os.environ[key] | ||
347 | |||
348 | if len(removed_vars): | ||
349 | bb.debug(1, "Removed the following variables from the environment:", ",".join(removed_vars)) | ||
350 | |||
351 | return removed_vars | ||
352 | |||
299 | def prunedir(topdir): | 353 | def prunedir(topdir): |
300 | # Delete everything reachable from the directory named in 'topdir'. | 354 | # Delete everything reachable from the directory named in 'topdir'. |
301 | # CAUTION: This is dangerous! | 355 | # CAUTION: This is dangerous! |