summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-09-30 20:57:18 +0000
committerRichard Purdie <richard@openedhand.com>2008-09-30 20:57:18 +0000
commit2e182847e4a780c58c5b8046eb98f7f6c8970ea1 (patch)
treedc3ccf060b2b04c8af29c75607260052bc92673b /bitbake/lib/bb/utils.py
parent221ac2b25f544a500869667d8f95c6c12c80db1a (diff)
downloadpoky-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/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 9c8d8e8435..3c1fd31b03 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/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
299def 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
331def 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
299def prunedir(topdir): 353def 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!