diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2024-01-22 14:58:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-02 10:38:28 +0000 |
commit | c17ce99a2fd6bf95543f3559b847cf98c34d4563 (patch) | |
tree | 1587578ab6e1c22b5daed0a6b923368935ed4c58 | |
parent | c9c0974209d3f6ae3827bb8f8b0258147aac49e6 (diff) | |
download | poky-c17ce99a2fd6bf95543f3559b847cf98c34d4563.tar.gz |
devtool: refactor exec_fakeroot
Provide a function exec_fakeroot_no_d which does the same like
exec_fakeroot does, but is usable independenlty from bitbake. This
allows to use the fanction from scripts where the d variable is not
available.
(From OE-Core rev: 6f5980d96844559639fc3660bb975b0bdd1aa523)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/devtool/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index b4f998a5bc..c7fc3cfc41 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
@@ -78,12 +78,15 @@ def exec_fakeroot(d, cmd, **kwargs): | |||
78 | """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" | 78 | """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" |
79 | # Grab the command and check it actually exists | 79 | # Grab the command and check it actually exists |
80 | fakerootcmd = d.getVar('FAKEROOTCMD') | 80 | fakerootcmd = d.getVar('FAKEROOTCMD') |
81 | fakerootenv = d.getVar('FAKEROOTENV') | ||
82 | exec_fakeroot_no_d(fakerootcmd, fakerootenv, cmd, kwargs) | ||
83 | |||
84 | def exec_fakeroot_no_d(fakerootcmd, fakerootenv, cmd, **kwargs): | ||
81 | if not os.path.exists(fakerootcmd): | 85 | if not os.path.exists(fakerootcmd): |
82 | logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built') | 86 | logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built') |
83 | return 2 | 87 | return 2 |
84 | # Set up the appropriate environment | 88 | # Set up the appropriate environment |
85 | newenv = dict(os.environ) | 89 | newenv = dict(os.environ) |
86 | fakerootenv = d.getVar('FAKEROOTENV') | ||
87 | for varvalue in fakerootenv.split(): | 90 | for varvalue in fakerootenv.split(): |
88 | if '=' in varvalue: | 91 | if '=' in varvalue: |
89 | splitval = varvalue.split('=', 1) | 92 | splitval = varvalue.split('=', 1) |