r-lib / revdepcheck

R package reverse dependency checking
https://revdepcheck.r-lib.org
Other
99 stars 31 forks source link

Consider \\. to be part of package name. #347

Closed joethorley closed 1 year ago

joethorley commented 1 year ago

Previously dependencies of leaflet.extras were being included (extras only has 4 depedencies)

revdepcheck::cran_revdeps("extras", "Imports")
#>  [1] "animaltracker" "bcdata"        "GPSeqClus"     "gwavr"        
#>  [5] "IceSat2R"      "mapedit"       "mcmcderive"    "mcmcr"        
#>  [9] "MDMAPR"        "naturaList"    "nlist"         "oceanis"      
#> [13] "term"          "wallace"

Created on 2022-10-29 with reprex v2.0.2

Now with this pull request the correct 4 dependencies are returned

revdepcheck::cran_revdeps("extras", "Imports")
#> [1] "mcmcderive" "mcmcr"      "nlist"      "term"

Created on 2022-10-29 with reprex v2.0.2

hadley commented 1 year ago

I think we need a bit more than this because leaflet.extras would also match leafletXextras etc (not very likely, but a suggestion that we shouldn't be using regexps here).

hadley commented 1 year ago

@gaborcsardi do you think we could switch to tools::dependsOnPkgs(package, dependencies = dependencies, installed = allpkgs, recursive = FALSE) here?

gaborcsardi commented 1 year ago

We have now better tools for this, we could start using them, e.g. pkgcache::meta_cache_revdeps().

hadley commented 1 year ago

Maybe that's at the root of some of the strangeness in #319

hadley commented 1 year ago

Hmmm, but I can't get them to line up:

pkgcache <- pkgcache::meta_cache_revdeps("tidyr", dependencies = TRUE, recursive = FALSE)$package
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
length(pkgcache)
#> [1] 4087
revdepcheck <- revdepcheck::cran_revdeps("tidyr")
length(revdepcheck)
#> [1] 1750

Created on 2023-01-24 with reprex v2.0.2

gaborcsardi commented 1 year ago

pkgcache includes binaries and sources separately, and by default includes bioc as well. It is something like this:

cache <- pkgcache::cranlike_metadata_cache$new(platforms = "source", bioc = FALSE)
revdeps <- cache$revdeps("tidyr", dependencies = TRUE, recursive = FALSE)
revdeps[c("package", "version")]
gaborcsardi commented 1 year ago

We should probably also specify repos in cranlike_metadata_cache$new(), to avoid people's custom repos, and only use CRAN.

hadley commented 1 year ago

Ah, yeah, in parallel I realised that cran_revdeps() depends on getOption("repos") which seems bad.

gaborcsardi commented 1 year ago

I am fairly sure that it is OK, it uses its own get_repos() which is more careful. So I would pass revdepcheck:::get_repos(FALSE) to pkgcache, and also bioc = bioc.

hadley commented 1 year ago

Not really: https://github.com/lbergelson/revdepcheck/blob/patch-1/R/deps.R#L35-L36

gaborcsardi commented 1 year ago

Not really: lbergelson/revdepcheck@patch-1/R/deps.R#L35-L36

I am not sure what you mean, sorry. Is that fork relevant, or that's just accidental?

hadley commented 1 year ago

Ooops, accidental. Anyway, I'm going to close this PR and open a new one that uses pkgcache.