]> git.ipfire.org Git - pakfire.git/commitdiff
builder: Move shell environment variables into submodule
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Jan 2021 16:47:02 +0000 (16:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Jan 2021 16:47:02 +0000 (16:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/builder.py
src/pakfire/constants.py

index ad77d57697e4f0485dc1b917297b7a949fad6809..1d66893050161f00b085f2011019dbcf741f7990 100644 (file)
@@ -433,15 +433,14 @@ class BuilderContext(object):
 
        @property
        def environ(self):
-               env = MINIMAL_ENVIRONMENT.copy()
-               env.update({
-                       # Add HOME manually, because it is occasionally not set
-                       # and some builds get in trouble then.
+               # Build a minimal environment for executing, but try to inherit TERM and LANG
+               env = {
+                       "HOME" : "/root",
+                       "PATH" : "/usr/bin:/bin:/usr/sbin:/sbin",
+                       "PS1"  : "\\u:\w\$ ",
                        "TERM" : os.environ.get("TERM", "vt100"),
-
-                       # Sanitize language.
-                       "LANG" : os.environ.setdefault("LANG", "en_US.UTF-8"),
-               })
+                       "LANG" : os.environ.get("LANG", "en_US.UTF-8"),
+               }
 
                # Inherit environment from distro
                env.update(self.pakfire.distro.environ)
index c9d22ce66e73dc08747cfa80fdb8cdae323c1ea6..dd83e518fd5a9508ecc0e66c26746f64a0b42e7b 100644 (file)
@@ -85,14 +85,6 @@ SHELL_SCRIPT = "/usr/lib/pakfire/chroot-shell"
 SHELL_PACKAGES = ["elinks", "less", "vim", SHELL_SCRIPT,]
 BUILD_ROOT = "/var/lib/pakfire/build"
 
-MINIMAL_ENVIRONMENT = {
-       "HOME" : "/root",
-       "LANG" : "C",
-       "PATH" : "/usr/bin:/bin:/usr/sbin:/sbin",
-       "PS1"  : "\\u:\w\$ ",
-       "TERM" : "vt100",
-}
-
 SOURCE_CACHE_DIR = os.path.join(CACHE_DIR, "sources")
 
 TIME_10M = 10