All of lore.kernel.org
 help / color / mirror / Atom feed
* Creating a pristine environment?
@ 2008-05-08  0:15 Holger Freyther
  2008-05-08 10:05 ` Koen Kooi
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Holger Freyther @ 2008-05-08  0:15 UTC (permalink / raw)
  To: bitbake-dev; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

Hey,

I have seen raster's environment breaking various buildsystems and we might 
want to really start having a clean environment before starting to build.

the patch below should implement it. Should we do this in OE? I'm aware of the 
unexport inside OE but we really should do this the otherway around.


comments?

	z.

[-- Attachment #2: clean_environment.patch --]
[-- Type: text/x-diff, Size: 1953 bytes --]

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:

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-05-21 21:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08  0:15 Creating a pristine environment? Holger Freyther
2008-05-08 10:05 ` Koen Kooi
2008-05-08 11:06   ` Holger Freyther
2008-05-08 11:29     ` Richard Purdie
2008-05-08 12:51       ` Mark Brown
2008-05-10 12:05       ` Holger Freyther
2008-05-10 12:28         ` Koen Kooi
2008-05-13  8:43           ` Holger Freyther
2008-05-13 10:42             ` Rolf Leggewie
2008-05-19 21:15         ` Richard Purdie
2008-05-21 21:38           ` Richard Purdie
2008-05-08 12:06 ` Cliff Brake
2008-05-08 12:14   ` Leon Woestenberg
2008-05-08 13:57     ` Cliff Brake
2008-05-08 14:10 ` Geoffrey Wossum
2008-05-09  8:55 ` Leon Woestenberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.