bst show --order alpha splits up elements from junction

Open
#2,041 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start by reading the Element comparison operator in src/buildstream/element.py and the sorting at src/buildstream/_frontend/cli.py, using the referenced lines as entry points. Reproduce bst show --order alpha with elements from different junctions, then determine whether alpha should sort by _get_full_name and verify that junction elements remain grouped in the output.

Written by the indexing model from the issue text.

Description

The ordering used by bst show --order alpha is based on the comparison operator of the Element class. This ordering is based on element name only which means that the junction an element comes from is ignored when searching elements. This means that elements from different junctions get mixed together in the bst show output which is confusing.

A better option might be to use _get_full_name as the sort key (either in the def __lt__ in Element or directly in the bst show code). I am not sure on the stability promises of buildstream and whether the ordering of alpha cannot change (if so could we consider adding a new ordering?).

References

Comparison operator of Element class: https://github.com/apache/buildstream/blob/b8e6876d760641c2b6ccc3e2578eba48d0a33332/src/buildstream/element.py#L315-L316

Sorting in bst show: https://github.com/apache/buildstream/blob/b8e6876d760641c2b6ccc3e2578eba48d0a33332/src/buildstream/_frontend/cli.py#L657-L658

Dominant language
Python
Stars
144
Forks
45
Avg merge
20h 38m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/buildstream

All issues in apache/buildstream

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.