diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-11-03 21:08:23 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-11-03 22:21:53 +0100 |
commit | 550295e0906e7ea874b3b2c35fb17519b429369c (patch) | |
tree | 72b22a201526ceba47a69e6ade09fe2f5cd1dd68 /crates/driver/src/recipe.rs | |
parent | ed31f842d6fc892120117b22d9bfcc13745e16bc (diff) | |
download | rebel-550295e0906e7ea874b3b2c35fb17519b429369c.tar rebel-550295e0906e7ea874b3b2c35fb17519b429369c.zip |
driver: store multiple recipe with the same ID, select highest version number
We are using the Debian version number scheme for comparision.
Diffstat (limited to 'crates/driver/src/recipe.rs')
-rw-r--r-- | crates/driver/src/recipe.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/driver/src/recipe.rs b/crates/driver/src/recipe.rs index 745e2f6..277a393 100644 --- a/crates/driver/src/recipe.rs +++ b/crates/driver/src/recipe.rs @@ -51,8 +51,8 @@ fn is_yml(path: &Path) -> bool { path.extension() == Some("yml".as_ref()) } -pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, TaskDef>> { - let mut tasks = HashMap::new(); +pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, Vec<TaskDef>>> { + let mut tasks = HashMap::<TaskID, Vec<TaskDef>>::new(); for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) { let path = entry.path(); @@ -85,7 +85,7 @@ pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, TaskDef>> task: label, }; task.meta = meta.clone(); - tasks.insert(task_id, task); + tasks.entry(task_id).or_default().push(task); } } |