r-lib / crancache

Transparent caching of CRAN package files - WORK IN PROGRESS!
Other
28 stars 2 forks source link

available_packages(): Error: invalid version specification '2.2.0 ' #29

Closed HenrikBengtsson closed 7 years ago

HenrikBengtsson commented 7 years ago

(For background, see https://github.com/r-lib/revdepcheck/issues/108)

Issue

> repos <- "https://bioconductor.org/packages/3.5/data/annotation"
> pkgs <- crancache::available_packages(repos = repos)
Error: invalid version specification '2.2.0 '

Enter a frame number, or 0 to exit   

1: crancache::available_packages(repos = repos)
2: apply_filters(res, filters)
3: f(pkgs)
4: tools:::.remove_stale_dups(db)
5: package_version(ap[wh, "Version"])
6: .make_numeric_version(x, strict, .standard_regexps()$valid_package_version, "
7: stop(gettextf("invalid version specification %s", paste(sQuote(unique(x[!ok])

Troubleshooting

From quick debugging of available_packages(), I found that although:

> db <- utils::available.packages(repos = "https://bioconductor.org/packages/3.5/data/annotation")
> db["hgu95av2", "Version"]
[1] "2.2.0"

the local cached repository gives:

> db <- utils::available.packages(repos = "file:///home/hb/.cache/R-crancache/bioc")
> db["hgu95av2", "Version"]
[1] "2.2.0 "

So, somehow the local cache does not strip that trailing space in the DESCRIPTION:Version field.

gaborcsardi commented 7 years ago

Looks like this is a duplicate of #25 and it was already fixed in cranlike. Can you please check?

HenrikBengtsson commented 7 years ago

Confirming. Updating to cranlike on the GitHub:

> remotes::install_github("r-hub/cranlike")

AND wiping related cached PACKAGES* files:

$ rm ~/.cache/R-crancache/bioc/src/contrib/PACKAGES*

fixed it.

PS. There was no need to wipe the offending package file ~/.cache/R-crancache/bioc/src/contrib/hgu95av2_2.2.0.tar.gz.