Improve documentation for --except functionality
- Dominant language
- Python
- Stars
- 140
- Forks
- 45
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
[See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/1346)
In GitLab by [[Gitlab user @cs-shadow]](https://gitlab.com/cs-shadow) on Jun 30, 2020, 00:54
`--except` option accepted by some of `bst` commands acts recursively. This may not be immediately obvious to new users, and even some veteran `bst` users. As [[Gitlab user @tristanvb]](https://gitlab.com/tristanvb) mentions in one the comments below:
> We really should have an image in the docs to reflect this behavior in a graph (with blue “active” elements, red “excepted” elements, and an explanation of what happens with the purple elements which fall into both categories).
This issue has been repurposed to be about improving the documentation of the `--except` functionality. Original issue text is preserved below for posterity.
---
**Original issue text. This is now outdated, see updated description above.**
## Summary
While working on !1975, I realized that I had a test that should have failed, but was passing. As it turns out, that MR has uncovered a more fundamental bug with `bst source track` where `--except` option just doesn't work as expected even on its own.
From what I can tell, this never worked as expected. I tried using the commit just before we removed `bst build --track` functionality, and I can still see the same bug behavior. At the very least, it has been broken for a very long time.
## Steps to reproduce
It is very easy to trigger this bug. Find a project with elements A and B, where A depends B, and B needs to be tracked. Run `bst source track B --except A`. Since we only told BuildStream to track B, and tracking B has nothing to do with A, one might expect that B would get tracked as usual. But, in practice, BuildStream tracks nothing in this case.
On the other hand, if we try to track A instead, things appear to work as expected.
Here's an example:
```bash
# In this example project, hello.bst depends on
# base.bst, that depends on base/alpine.bst
cd doc/examples/autotools
# Remove the source ref for base/alpine.bst
sed -i '/ref/d' base/alpine.bst hello.bst
# Verify it needs tracking
bst show base/alpine.bst
# Track base/alpine.bst
bst source track base/alpine.bst --except hello.bst
# BUG: It still needs tracking
# It should have get tracked in the previous step ideally
bst show base/alpine.bst
```
## What is the current bug behavior?
BuildStream fails to track an element, when one of its dependants is on the `--except` list.
## What is the expected correct behavior?
BuildStream tracks the target as expected, since dependants of an element should not be able to influence its tracking in any case.
## Possible fixes
Whatever the fix, we should definitely add a regression test for this.
Contributor guide
Research direction
Read the existing documentation for the `bst` commands that accept `--except` and verify how the option behaves recursively. Done means documenting that behavior with a graph showing active, excepted, and overlapping elements, plus an explanation of the overlapping elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100