r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
643 stars 56 forks source link

Work around PPM macOS `Built` field bug #540

Open gaborcsardi opened 9 months ago

gaborcsardi commented 9 months ago

Some macOS packages from PPM have an incorrect Built field.

options(repos = c(CRAN = "https://packagemanager.posit.co/cran/latest"))
pak::pkg_install("sodium?reinstall&nocache")
#> āœ” Loading metadata database ... done
#> 
#> ā†’ Will install 1 package.
#> ā†’ Will download 1 CRAN package (609.70 kB).
#> + sodium   1.3.0 šŸ”§ ā¬‡ (609.70 kB)
#> ā„¹ Getting 1 pkg (609.70 kB)
#> āœ” Got sodium 1.3.0 (aarch64-apple-darwin20) (589.84 kB)
#> āœ” Downloaded 1 package (589.84 kB) in 764ms
#> āœ” Installed sodium 1.3.0  (40ms)
#> āœ” 1 pkg: added 1, dld 1 (589.84 kB) [4.2s]
packageDescription("sodium")[["Built"]]
#> [1] "R 4.3.0; x86_64-pc-linux-gnu; 2023-09-28 18:34:51 UTC; unix"

We could either correct this in pkgdepends or maybe pkgcache. For packages installed with pak/pkgdepends we also have

RemotePkgPlatform: aarch64-apple-darwin20

which we could use. OTOH for packages installed with install.packages() we don't have this, so we would need to assume the local platform, if

Repository: RSPM

is set.

pkgcache only works with the (extended) metadata, so right now (= until we collect extended metadata from PPM) it is ok.