From 4eefbb2500c7e0b3a4ccfcc7dc17d0e0a21c1dd2 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 31 Mar 2015 09:20:57 +0000 Subject: Reduce the number of 'new environment variable' logs on startup This reduces noise on the console when using `morph build --verbose`. Before (example from my current chroot): $ morph build systems/devel-system-x86_64-generic.morph --verbose 2015-03-31 09:25:08 new environment variable SCHROOT_UID = "0" 2015-03-31 09:25:08 new environment variable SCHROOT_CHROOT_NAME = "baserock-2015-03-24-ostree" 2015-03-31 09:25:08 new environment variable LOGNAME = "root" 2015-03-31 09:25:08 new environment variable XDG_SEAT = "seat0" 2015-03-31 09:25:08 new environment variable PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 2015-03-31 09:25:08 new environment variable XDG_VTNR = "1" 2015-03-31 09:25:08 new environment variable HOME = "/root" 2015-03-31 09:25:08 new environment variable SCHROOT_ALIAS_NAME = "baserock-2015-03-24-ostree" 2015-03-31 09:25:08 new environment variable TERM = "xterm" 2015-03-31 09:25:08 new environment variable SHELL = "/bin/bash" 2015-03-31 09:25:08 new environment variable SHLVL = "1" 2015-03-31 09:25:08 new environment variable SCHROOT_USER = "root" 2015-03-31 09:25:08 new environment variable EDITOR = "vim" 2015-03-31 09:25:08 new environment variable SCHROOT_GID = "0" 2015-03-31 09:25:08 new environment variable SCHROOT_GROUP = "root" 2015-03-31 09:25:08 new environment variable GIT_NO_REPLACE_OBJECTS = "1" 2015-03-31 09:25:08 new environment variable SCHROOT_COMMAND = "/usr/bin/env SSH_AUTH_SOCK=/tmp/tmp.eVw95CcpjS/auth-sock /bin/bash -l" 2015-03-31 09:25:08 new environment variable PYTHONPATH = "/src/morph/" 2015-03-31 09:25:08 new environment variable SSH_AUTH_SOCK = "/tmp/tmp.eVw95CcpjS/auth-sock" 2015-03-31 09:25:08 new environment variable SCHROOT_SESSION_ID = "baserock-2015-03-24-ostree-f3c36e20-c3db-4404-8808-e805ca0c1ac4" 2015-03-31 09:25:08 new environment variable MANPAGER = "less -R" 2015-03-31 09:25:08 new environment variable XDG_SESSION_ID = "2" 2015-03-31 09:25:08 new environment variable _ = "/src/morph/morph" 2015-03-31 09:25:08 new environment variable OLDPWD = "/src/morph" 2015-03-31 09:25:08 new environment variable PWD = "/src/ws/master/baserock/baserock/definitions" 2015-03-31 09:25:08 new environment variable USER = "root" 2015-03-31 09:25:08 Starting build 8f80a816dfe44f6c8352a4242b84bf48 2015-03-31 09:25:08 Collecting morphologies involved in building systems/devel-system-x86_64-generic.morph from master 2015-03-31 09:25:08 Adding uncommitted changes in /src/ws/master/baserock/baserock/definitions to 2015-03-31 09:25:15 Building file:///src/ws/master/baserock/baserock/definitions 7735ec20d13490058a3d7758f79471637ce1ae71 systems/devel-system-x86_64-generic.morph ... After: $ morph build systems/devel-system-x86_64-generic.morph --verbose 2015-03-31 09:23:38 new environment variable GIT_NO_REPLACE_OBJECTS = "1" 2015-03-31 09:23:38 Starting build acfdf9a405384e1ea4e1b62cd1bce27f 2015-03-31 09:23:38 Collecting morphologies involved in building systems/devel-system-x86_64-generic.morph from master 2015-03-31 09:23:38 Adding uncommitted changes in /src/ws/master/baserock/baserock/definitions to 2015-03-31 09:23:45 Building file:///src/ws/master/baserock/baserock/definitions 7735ec20d13490058a3d7758f79471637ce1ae71 systems/devel-system-x86_64-generic.morph ... Change-Id: I20bbdf35b280ccd305bc7e4a70b5f3de7679a368 --- morphlib/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphlib/app.py b/morphlib/app.py index c8fe397d..b12b87de 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -369,7 +369,7 @@ class Morph(cliapp.Application): self._write_status(self._commandline_as_message(argv, args)) # Log the environment. - prev = getattr(self, 'prev_env', {}) + prev = getattr(self, 'prev_env', os.environ) morphlib.util.log_environment_changes(self, kwargs['env'], prev) self.prev_env = kwargs['env'] -- cgit v1.2.1