r-lib / pkgdepends

R Package Dependency Resolution
https://r-lib.github.io/pkgdepends/
Other
102 stars 30 forks source link

Stop resolution multiplying rows from metadata #380

Closed jameslairdsmith closed 2 months ago

jameslairdsmith commented 2 months ago

(Fixes #379)

The metadata column was causing certain rows to recycle over the result data frame. This could happen with any list column that isn't of length one. The solution I created here is to check if the list is not already length one and to wrap it into a list if it is not.

Also added an assertion to force the output into being one row as desired.

Very happy to accept changes as you think is appropriate.

gaborcsardi commented 2 months ago

Thanks! I don't love my old solution of magically fixing bad resolution output. But if we are already doing that, we might as well do it properly.

It seems that

      res$metadata[["RemoteRepos"]] <- config$get("cran-mirror")

converts the metadata character vector to a list silently, that's how we end up with a list.

I am not sure why config$get("cran-mirror") is a list, this can possibly cause other problems as well, so I'll fix that as well.

gaborcsardi commented 2 months ago

Thanks again!