From e516bf78985622b188485bb0766b4a627a1043c0 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 4 Feb 2022 15:24:51 +0100 Subject: [PATCH] BuildRoot: Support adding custom env vars We will need this later to set SOURCE_DATE_EPOCH in the build. --- osbuild/buildroot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osbuild/buildroot.py b/osbuild/buildroot.py index 317f73aa..36604893 100644 --- a/osbuild/buildroot.py +++ b/osbuild/buildroot.py @@ -169,7 +169,7 @@ class BuildRoot(contextlib.AbstractContextManager): if self._exitstack: self._exitstack.enter_context(api) - def run(self, argv, monitor, timeout=None, binds=None, readonly_binds=None): + def run(self, argv, monitor, timeout=None, binds=None, readonly_binds=None, extra_env=None): """Runs a command in the buildroot. Takes the command and arguments, as well as bind mounts to mirror @@ -282,6 +282,8 @@ class BuildRoot(contextlib.AbstractContextManager): "PYTHONUNBUFFERED": "1", "TERM": os.getenv("TERM", "dumb"), } + if extra_env: + env.update(extra_env) proc = subprocess.Popen(cmd, bufsize=0,