summaryrefslogtreecommitdiff
path: root/poky/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorjmbills <jason.m.bills@intel.com>2021-10-04 22:42:48 +0300
committerGitHub <noreply@github.com>2021-10-04 22:42:48 +0300
commit0c9e31989c615598b5d042ffab385606660c93c0 (patch)
tree8019999b0ca042482e5193d6cabc06220c71d776 /poky/bitbake/lib/bb/utils.py
parent04cd92067d2481643df5010cb39b2134b648cf4d (diff)
parentffe6d597d9e3d4407cf8062b5d6505a80ce08f41 (diff)
downloadopenbmc-1-0.75.tar.xz
Merge pull request #72 from Intel-BMC/update2021-0.751-0.75
Update
Diffstat (limited to 'poky/bitbake/lib/bb/utils.py')
-rw-r--r--poky/bitbake/lib/bb/utils.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/poky/bitbake/lib/bb/utils.py b/poky/bitbake/lib/bb/utils.py
index 6ba1d2a37..70634910f 100644
--- a/poky/bitbake/lib/bb/utils.py
+++ b/poky/bitbake/lib/bb/utils.py
@@ -1178,7 +1178,7 @@ def edit_metadata(meta_lines, variables, varfunc, match_overrides=False):
variables: a list of variable names to look for. Functions
may also be specified, but must be specified with '()' at
the end of the name. Note that the function doesn't have
- any intrinsic understanding of _append, _prepend, _remove,
+ any intrinsic understanding of :append, :prepend, :remove,
or overrides, so these are considered as part of the name.
These values go into a regular expression, so regular
expression syntax is allowed.
@@ -1681,3 +1681,19 @@ def rename(src, dst):
shutil.move(src, dst)
else:
raise err
+
+@contextmanager
+def environment(**envvars):
+ """
+ Context manager to selectively update the environment with the specified mapping.
+ """
+ backup = dict(os.environ)
+ try:
+ os.environ.update(envvars)
+ yield
+ finally:
+ for var in envvars:
+ if var in backup:
+ os.environ[var] = backup[var]
+ else:
+ del os.environ[var]