diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-06-25 19:11:30 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-09-16 12:32:18 +0200 |
commit | 27f6085f0cc2f882656d40e2b4665e20a4a80959 (patch) | |
tree | 9dd7b122cc3a0960f47c276608f29f33a4ae2c04 /src/commands/tree_of.rs | |
parent | 3cc328a5f5857b95299d0ef998be5dcc3ddde6a7 (diff) |
Add CLI parameters for tree-of subcommand to add condition-checking data
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>
Diffstat (limited to 'src/commands/tree_of.rs')
-rw-r--r-- | src/commands/tree_of.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/commands/tree_of.rs b/src/commands/tree_of.rs index f5ce223..09fcabf 100644 --- a/src/commands/tree_of.rs +++ b/src/commands/tree_of.rs @@ -40,9 +40,20 @@ pub async fn tree_of( .map(PackageVersionConstraint::try_from) .transpose()?; + let image_name = matches + .value_of("image") + .map(String::from) + .map(ImageName::from); + + let additional_env = matches + .values_of("env") + .unwrap_or_default() + .map(crate::util::env::parse_to_env) + .collect::<Result<Vec<(EnvironmentVariableName, String)>>>()?; + let condition_data = ConditionData { - image_name: None - env: &[], + image_name: image_name.as_ref(), + env: &additional_env, }; repo.packages() |