summaryrefslogtreecommitdiffstats
path: root/src/commands/tree_of.rs
AgeCommit message (Collapse)Author
2021-11-19Update Copyright string to 2020-2022Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-09-16Add tests for DAG-building with conditional dependencyMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-09-16Add CLI parameters for tree-of subcommand to add condition-checking dataMatthias Beyer
This patch adds parameters for the tree-of subcommand which can be used to change the package-DAG-building based on conditional requirements. If a package has a dependency-condition that only includes a dependency if there is a certain image used to build, the "image" parameter can be used to inspect the package tree (DAG) build with that image in mind. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-09-16Add passing of data for condition-checkMatthias Beyer
This patch extends the interface for building the package DAG with a parameter for the data that is required to check conditions for conditional dependencies. A "DTO" type is added for this data. The actual condition-checking is not implemented in this patch. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-07-27Merge branch 'optional-dag-loading-progress'Matthias Beyer
2021-07-21Sort importsMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-18Remove progressbar for tree-of subcommandMatthias Beyer
Remove the progress bar here because it does not bring any real value and rather clutters the output and thus makes it harder to read. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-18Make progress bar for loading DAG optionalMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-11Add module-level docsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-03-18Rewrite PackageVersionConstraint constructingMatthias Beyer
Use the TryFrom trait rather than a `::new()` constructor that can fail. This is way more idomatic. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-03-04Do not pass progress bars by value, but by referenceMatthias Beyer
Because passing by value is simply not necessary here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-02-06Rewrite package organizational structure using DAGMatthias Beyer
This patch reimplements the package orchestration functionality to rely on a DAG rather than a tree. A / \ B E / \ \ C D F Before this change, the structure the packages were organized in for a build was a tree. That did work reasonable well for initial development of butido, because this is a simple case and the implementation is rather simple, too. But, packages and their dependencies are not always organized in a tree. Most of the time, they are organized in a DAG: .-> C -, / \ D > A \ / `-> B -´ This is a real-world example: A could be a common crypto-library that I do not want to name here. B and C could be libraries that use the said crypto-library and D could be a program that use B and C. Because said crypto-library builds rather long, building it twice and throwing one result away is a no-go. A DAG as organizational structure makes that issue go away entirely. Also, we can later implement checks whether the DAG contains multiple versions of the same library, if that is undesireable. The change itself is rather big, frankly because it is a non-trivial change the replace the whole data structure and its handling in the orchestrator code. First of all, we introduce the "daggy" library, which provides the DAG implementation on top of the popular "petgraph" library. The package `Tree` datastructure was replaced by a package `Dag` datastructure. This type implements the heavy-lifting that is needed to load a package and all its dependencies from the `Repository` object. The `JobTree` was also reimplemented, but as `daggy::Dag` provides a convenient `map()` function, its implementation which transforms the package `Dag` into a job `Dag` is rather trivial. `crate::job::Dag` then provides the convenience `iter()` function to iterate over all elements in the DAG and providing a `JobDefinition` object for each node. The topology in which we traverse the DAG is not an issue, as we need to create tasks for all `JobDefinition`s anyways, so we do not care about traversal topology at all. The `crate::package::Package` type got an `Hash` implementation, which is necessary to keep track of the mappings while reading the DAG from the repository. The implementation does not create the edges between the nodes in the DAG right when inserting, but afterwards. To keep track of the `daggy::NodeIndex`es, it keeps a mapping Package -> NodeIndex in a Hashmap. Thus, `Package` must implement `std::hash::Hash` Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Tested-by: Matthias Beyer <mail@beyermatthias.de> squash! Reimplement as DAG
2021-01-18Run `cargo fmt`Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-01-18Add comments on subcommand implementationsMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-01-15Fix clippy: you should consider adding a `Default` implementation for ↵Matthias Beyer
`package::tree::Tree` Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-01-15Reimplement tree printing using 'ptree'Matthias Beyer
This patch reimplements the tree-printing using the 'ptree' crate. Because ptree wants the tree item to implement `Clone`, a wrapper type is added which then implements `Clone` and `ptree::TreeItem` Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-01-13Add LICENSE file and license headersMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-12-11Add "tree-of" subcommand to print dependency tree of a packageMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>