Skip to content

Resolving duplicates rows when requesting version #379

@jameslairdsmith

Description

@jameslairdsmith

Unless I'm drastically misunderstanding something, I think this is a bug. When resolving and refs contain a version, the resolution data frame unnests the versioned package dependency row into many rows (see reprex below).

library(withr)
library(pkgdepends)

my_resolve <- function() {
  
  local_options(repos = list(CRAN = "https://cran.rstudio.com" ))
  tmp <- local_tempdir()
  
  prop <- new_pkg_installation_proposal(
    refs = "[email protected]",
    config = list(library = tmp)
  )
  
  prop$resolve()
  prop$get_resolution()
}

my_resolve()
#> ℹ Loading metadata database✔ Loading metadata database ... done
#> # A data frame: 10 × 31
#>    ref    type  direct directpkg status package version license needscompilation
#>    <chr>  <chr> <lgl>  <lgl>     <chr>  <chr>   <chr>   <chr>   <lgl>           
#>  1 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  2 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  3 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  4 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  5 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  6 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  7 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  8 rlang… stan… TRUE   TRUE      OK     rlang   1.0.0   MIT + … TRUE            
#>  9 rlang  stan… FALSE  TRUE      OK     rlang   1.1.4   MIT + … FALSE           
#> 10 rlang  stan… FALSE  TRUE      OK     rlang   1.1.4   MIT + … TRUE            
#> # ℹ 22 more variables: priority <chr>, md5sum <chr>, sha256 <chr>,
#> #   filesize <int>, built <chr>, platform <chr>, rversion <chr>,
#> #   repotype <chr>, repodir <chr>, target <chr>, deps <list>, mirror <chr>,
#> #   sources <list>, remote <list>, error <list>, metadata <named list>,
#> #   extra <list>, dep_types <list>, params <list>, sysreqs <chr>,
#> #   os_type <chr>, cache_status <chr>

Created on 2024-09-04 with reprex v2.1.0

If I'm understanding the package correctly, the proper output should be a data frame with three rows (on Windows at least): the binary, the non-versioned source and the versioned source. Is that correct? The offending column here is metadata. Each new row has a single value of the metadata, which was a list and got unnested. I have a fix in mind if it's okay to make a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions