Prevent buildstream sandbox folders from appearing in checked out artifacts
Summary
The directories "buildstream" and "buildstream-install" should not appear in the output directory when "bst checkout" is run. However, they're appearing whenever integration commands are run as part of the checkout. (Only affects Build Elements)
Steps to reproduce
- Identify a build element which doesn't run any integration commands. (ie it has no integration commands, and its dependencies have no integration commands). For example
hello.bst
fromhttps://gitlab.com/BuildStream/buildstream/-/tree/master/doc/examples/running-commands
. - Build the element with
bst build
. - Check the element out with `bst checkout'
- Inspect the checked out directory, it should not contain the folders
buildstream
orbuildstream-install
. - Edit the original element (or create an edited copy). Add integration commands:
public:
bst:
integration-commands:
- ls
- Build the element again
- Checkout the element again.
- The checkout directory now contains the
buildstream
andbuildstream-install
subdirectories.
If you check the element out a third time, now using the '--no-integrate' option, the subdirectories will disappear again.
What is the current bug behaviour?
When an element is checked out and there are integration commands to run, buildstream creates a sandbox to run the integration commands. The sandbox seems to create the folders 'buildstream' and 'buildstream-install', as it would when building the element. These folders arn't removed after the integration commands are run, so they appear in the checked out artifact.
This happens whether the integration commands are part of the element in question, or part whether they belong to its dependencies.
It appears to only affect Build Elements. The issue doesn't affect Filter elements, Compose elements or Import elements. (I believe that those elements don't create the two sub-directories in the first place).
What is the expected correct behavior?
The subdirectories should not appear in checkout directory.
Relevant logs and/or screenshots
edited-hello.bst
is identical to hello.bst, except that it has integration commands. The build artefact was checked out twice. Once normally, and once with the
--no-integrateoption.
hello.bst` was also checkout out for comparison.
$ ls checkouts_folder/*
checkouts_folder/edited-hello.bst-normal-checkout:
bin buildstream-install etc lib mnt root sbin sys usr
buildstream dev home media proc run srv tmp var
checkouts_folder/edited-hello.bst-with-no-integrate-option:
bin etc lib mnt root sbin sys usr
dev home media proc run srv tmp var
checkouts_folder/hello.bst-normal-checkout:
bin etc lib mnt root sbin sys usr
dev home media proc run srv tmp var
Possible fixes
Presumably the directories need to be deleted from the sandbox directory after the integration commands are run, and before the checkout is completed. Or alternatively, checkout sandboxes should be made differently than the build sandboxes, and the two subdirectories shouldn't be added in the first place.
Other relevant information
- BuildStream version affected: /milestone %BuildStream_v1.0.0
- BuildStream version affected: /milestone %BuildStream_v1.4.2
I mainly tested this on v1.4.2, but I've tried with older versions of buildstream and could replicate this or similar behaviour all the way back to v1.0.0. This has probably never worked correctly.