diff options
Diffstat (limited to 'scripts/lib/devtool/__init__.py')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index ea0b63e767..61b810c938 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
@@ -80,6 +80,22 @@ def exec_watch(cmd, **options): | |||
80 | 80 | ||
81 | return buf, None | 81 | return buf, None |
82 | 82 | ||
83 | def exec_fakeroot(d, cmd, **kwargs): | ||
84 | """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" | ||
85 | # Grab the command and check it actually exists | ||
86 | fakerootcmd = d.getVar('FAKEROOTCMD', True) | ||
87 | if not os.path.exists(fakerootcmd): | ||
88 | 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') | ||
89 | return 2 | ||
90 | # Set up the appropriate environment | ||
91 | newenv = dict(os.environ) | ||
92 | fakerootenv = d.getVar('FAKEROOTENV', True) | ||
93 | for varvalue in fakerootenv.split(): | ||
94 | if '=' in varvalue: | ||
95 | splitval = varvalue.split('=', 1) | ||
96 | newenv[splitval[0]] = splitval[1] | ||
97 | return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs) | ||
98 | |||
83 | def setup_tinfoil(): | 99 | def setup_tinfoil(): |
84 | """Initialize tinfoil api from bitbake""" | 100 | """Initialize tinfoil api from bitbake""" |
85 | import scriptpath | 101 | import scriptpath |