summaryrefslogtreecommitdiff
path: root/buildstream/sandbox/_sandboxbwrap.py
Commit message (Collapse)AuthorAgeFilesLines
* Sandbox: use linux32 for x86-32 builds on x86-64 machinesRaoul Hidalgo Charman2018-12-051-1/+8
| | | | | | | | o _platform/linux.py: Add linux32 flag to send to sandbox bwrap when the build arch is x86-32 and the machines arch is x86-64 or similarly with aarch32 and aarch64. o sandbox/_sandboxbwrap.py: Use flag passed to start bwrap command with linux32 if set.
* sandbox: Deduplicate code to process cwd, env, and command argumentsJürg Billeter2018-11-271-11/+1
|
* buildstream/sandbox/_sandboxbwrap.py: Distinguish sandbox failure from ↵Richard Maw2018-11-141-20/+49
| | | | | | | | | | | command failure If `bwrap` fails to set up the sandbox and start the payload command it won't write an exit-code in --json-status-fd, so we can report if it was a sandboxing failure if we don't get exit-code status and a payload command failure if we do and it's non-zero. Closes https://gitlab.com/BuildStream/buildstream/issues/286
* Check if command is a str and replace by list before checking existenceBenjamin Schubert2018-10-261-4/+4
| | | | | | | | Currently we would make sure the sandbox had a command before converting it to a list if it was given as a string. That meant that a string command would never exist and the check be invalid. This also adds the same logic in the dummy sandbox for consistency.
* sandbox/_sandboxbwrap.py: Disable lint about dict.getDaniel Silverstone2018-10-251-1/+1
| | | | | | | Sometimes `dict.get()` is preferable, in this instance it's less clear so we'll disable that lint Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* Sandbox: CWD was not being created for workspacesWilliam Salmon2018-10-161-8/+4
| | | | | | | | | | | | The code was creating the cwd folder but when the workspace was mounted in to the buildroot it was hiding the folder created in it behind the bind mounted workspace. However by using the bubblewarp `--dir` directive to ensure that cwd exists we can cover both workspace and non workspace situations with the same method. For issue #512 in Gitlab.
* sandbox: deduplicate default environment logicRichard Maw2018-09-161-14/+2
|
* subprocesses: Ensure PWD is set in process environmentRichard Maw2018-09-101-3/+9
| | | | | | | | | | | | | | | Naive getcwd implementations (such as in bash 4.4) can break when bind-mounts to different paths on the same filesystem are present, since the algorithm needs to know whether it's a mount-point to know whether it can trust the inode value from the readdir result or to use stat on the directory. Less naive implementations (such as in glibc) iterate again using stat in the case of not finding the directory because the inode in readdir was wrong, though a Linux-specific implementation could use name_to_handle_at. Letting the command know what directory it is in makes it unnecessary for it to call the faulty getcwd in the first place.
* Directory API: add mark_changedJim MacArthur2018-08-151-0/+1
|
* Convert uses of external_directory to get_underlying_directory()Jim MacArthur2018-08-151-1/+1
|
* Set environment in bwrap command line instead of its environmentValentin David2018-08-101-3/+7
| | | | Fixes #498
* sandbox: Remove instances of get_directoryJim MacArthur2018-08-011-1/+3
| | | | | sandbox/_mount.py, sandbox/_sandboxbwrap.py: Remove instances of get_directory
* Provide better error message on missing commandsTiago Gomes2018-07-021-0/+6
| | | | | | | Before running a command in the sandbox, check its existence and fail early if it does not. This fixes issue #289.
* Remove shebangs from python filesGökçen Nurlu2018-06-191-1/+0
| | | | Fixes #424
* _sandboxbwrap.py: Fix post-bwrap cleanup behaviourGökçen Nurlu2018-06-051-1/+1
| | | | | | | | | The cleanup was supposed not to remove folders (`/dev`, `/tmp`, `/proc`) if they already existed before bwrap but it did the opposite: it tried to remove them if they existed before, and didn't remove them if they were created during bwrap. This was caused by a `not` clause, and this removes it. Fixes #379
* Add 'sandbox' configuration key and build-uid/build-gid elementsJim MacArthur2018-03-231-1/+3
| | | | | | | | | | | | | | | | | | | | This only affects SandboxBWrap at the moment. buildstream/_loader.py: Add Symbol.SANDBOX and allow it in validation buildstream/_metaelement.py: Add 'sandbox' variable and store it in the object buildstream/_project.py: Add 'sandbox' configuration key and load it from project.conf. buildstream/data/projectconfig.yaml: Default build-uid/build-gid values of 0 for 'sandbox'. buildstream/element.py: Add __extract_sandbox_config to find the final sandbox configuration. Pass this to the sandbox constructor. buildstream/sandbox/_sandboxbwrap.py: If sandbox configuration was supplied, use it for uid and gid instead of the default 0. buildstream/sandbox/_sandboxchroot.py: Throw exception if non-0 uid/gid were supplied. buildstream/sandbox/__init__.py: Import SandboxConfig. buildstream/sandbox/_private.py: New file, containing SandboxConfig. Made private to avoid documentation for this class.
* pylint - dealt with unidiomatic-typecheck warningJames Ennis2018-03-141-1/+1
|
* _sandboxbwrap.py: Force cleanup when in interactive modeTristan Van Berkom2018-03-021-7/+24
| | | | | | | | | | | | | | | | | | | | When running a sandbox in interactive mode (implies `bst shell` was launched or an interactive shell for debugging), dont bail out when cleaning up directories which are not empty. We treat this as a bug, if any of the base sandbox directories (/dev, /tmp or /proc) are not empty when tearing down the sandbox, because it would indicate something is wrong with bwrap. When in interactive mode however, the user/project may have mounted additional directories inside these base directories; for which we need to create intermediate directories for the mount. Instead of keeping track of every intermediate directory, just force remove in interactive mode, as this is safe. Ideally, we should fix upstream bwrap to cleanup the debris it creates when exiting.
* _sandboxbwrap.py: Allow device nodes to be bind mountedTristan Van Berkom2018-03-021-1/+10
|
* sandbox/_sandboxbwrap.py: Use --die-with-parentJürg Billeter2018-02-241-0/+5
| | | | | | | This ensures subprocesses are cleaned up when the bwrap parent dies. This is available since bubblewrap 0.1.8. We skip the option if the host bwrap does not support it.
* sandbox/_sandboxbwrap.py: Unshare IPC namespace in build sandboxJürg Billeter2018-02-241-0/+1
| | | | Isolate sandbox processes from System V IPC.
* sandbox/_sandboxbwrap.py: Unshare UTS namespace in build sandboxJürg Billeter2018-02-241-0/+1
| | | | | Set hostname to buildstream in build sandbox to reduce host contamination.
* Inherit user id and group id for bst shellJürg Billeter2018-02-221-1/+3
| | | | | | This allows D-Bus access. Fixes #227
* Add support for doing incremental buildsChandan Singh2018-01-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This functionality is only supported for sources which have an open workspace. When such sources are present, the workspace directory will be mounted directly inside the sandbox. As opposed to the default behavior, which is to copy files inside the sandbox. This will save time when building large projects as only those files will need be re-compiled that have been modified during two consecutive builds (assuming the underlying build system supports such behavior). A few things to note regarding this behavior: - If there are any `configure-commands` present, they will run only once for each open workspace. If an element has multiple workspaces and any one of them is opened/closed, they will be executed again on the next run. But, modifying the contents of a workspace will not trigger the `configure-commands` to be executed on the next run. - Workspaced builds still leverage the cache. So, if no changes are made to the workspace, i.e. no files are modified, then it will not force a rebuild. Fixes #192.
* Remove unused variablesGökçen Nurlu2017-12-111-2/+0
|
* sandbox: Make sandbox.run use keyword argsJonathan Maw2017-11-141-1/+1
|
* sandbox: Refactoring, moving accidentally public MountMap into it's own fileTristan Van Berkom2017-11-061-1/+2
|
* sandbox/_sandboxbwrap.py: Dont use user namespaces if they are unavailableTristan Van Berkom2017-10-311-1/+6
| | | | Part of the fix for #92
* artifactcache.py: Fix missing fetch_remote_refs interface98-ctrl-c-doesn-t-properly-kill-a-non-interactive-shellTristan Maat2017-10-191-1/+6
|
* Fix keyboardinterrupts caused by subprocessesTristan Maat2017-10-191-1/+29
|
* Move sandboxes to separate directoryTristan Maat2017-09-281-0/+327