Skip to content

Commit

Permalink
Merge pull request #171 from pulp-platform/michaero/fix_dep_mismatch_…
Browse files Browse the repository at this point in the history
…panic

Fix dependency mismatch panic
  • Loading branch information
micprog authored Oct 12, 2024
2 parents 7fa835c + eebfae7 commit e9f032a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/sess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,25 @@ impl<'sess, 'ctx: 'sess> Session<'ctx> {
// Translate the name-based graph into an ID-based graph.
let graph: IndexMap<DependencyRef, IndexSet<DependencyRef>> = graph_names
.into_iter()
.map(|(k, v)| (k, v.iter().map(|name| names[name]).collect()))
.collect();
.map(|(k, v)| {
(
k,
v.iter()
.map(|name| match names.get(name) {
Some(id) => Ok(*id),
None => Err(Error::new(format!(
"Failed to match dependency {}, please run `bender update`!",
name
))),
})
.collect::<Result<_>>(),
)
})
.map(|(k, v)| match v {
Ok(v) => Ok((k, v)),
Err(e) => Err(e),
})
.collect::<Result<_>>()?;

// Determine the topological ordering of the packages.
let pkgs = {
Expand Down

0 comments on commit e9f032a

Please sign in to comment.