Index: bin/bitbake =================================================================== --- bin/bitbake (Revision 1063) +++ bin/bitbake (Arbeitskopie) @@ -42,6 +42,56 @@ #============================================================================# +# clean_environment +#============================================================================# +def clean_environment(): + """ + Create a pristine environment for bitbake. This will remove variables that + are not known and may influence the build in a negative way. + """ + good_keys = [ + "BBPATH", + "COLORTERM", + "DBUS_SESSION_BUS_ADDRESS", + "DESKTOP_SESSION", + "DESKTOP_STARTUP_ID", + "DISPLAY", + "GNOME_KEYRING_PID", + "GNOME_KEYRING_SOCKET", + "GPG_AGENT_INFO", + "GTK_RC_FILES", + "HOME", + "LANG", + "LOGNAME", + "PATH", + "PWD", + "SESSION_MANAGER", + "SHELL", + "SSH_AUTH_SOCK", + "TERM", + "USER", + "USERNAME", + "_", + "XAUTHORITY", + "XDG_DATA_DIRS", + "XDG_SESSION_COOKIE", + ] + + + removed_vars = [] + for key in os.environ.keys(): + if key in good_keys: + continue + + removed_vars.append(key) + os.unsetenv(key) + del os.environ[key] + + if len(removed_vars): + bb.note("Removed the following variables from the environment:", ",".join(removed_vars)) + + +#============================================================================# # main #============================================================================# @@ -111,6 +161,8 @@ configuration.pkgs_to_build = [] configuration.pkgs_to_build.extend(args[1:]) + clean_environment() + cooker = bb.cooker.BBCooker(configuration) if configuration.profile: