science-computing / butido

Build Linux packages using Docker containers
Eclipse Public License 2.0
22 stars 8 forks source link

Provide context when adding an edge to the package dependency DAG fails #325

Closed primeos-work closed 10 months ago

primeos-work commented 11 months ago

This can happen when the package repository contains cyclic dependencies. The DAG library would only emit WouldCycle as error message, which isn't enough to trace down the cycle. This adds enough context to find the final DAG edge that would complete the cycle, e.g.:

$ butido build -I deb12 tree 1.8.0
[...]
Error: build command failed

Caused by:
    0: Failed to add package dependency DAG edge from package "tree" (1.8.0) to dependency "vim" (9.0.2153)
    1: WouldCycle

This resolves #52.

christophprokop commented 10 months ago

Only tested with a simple cycle but output is much more helpful than before. Feel free to merge when the linter is satisfied (line too long) Thank you!

primeos-work commented 10 months ago

Thanks! :) The commit-lint check can be ignored in this case - I wanted to put butido's output into the commit message without any modifications like word wrapping (I don't have a strong opinion on this though as both approaches aren't ideal IMO).

Anyway, we kept the commit-lint check optional for now for cases like this (IIRC it wasn't easy/possible to disable the line length check for code blocks (```.*```)).

primeos-work commented 10 months ago

Oops, now the cargo check CI test fails as well with the beta toolchain due to a new beta release in the meantime... I'll create a new PR to fix this regression as it's unrelated to this PR. Edit: I had to re-queue as GitHub moved #326 down in the merge queue when I added the other two PRs (that was quite strange and undesirable...).