r-lib / pak

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

`upgrade = FALSE` is ignored when `options(pkg.platforms)` is set #657

Open heavywatal opened 3 months ago

heavywatal commented 3 months ago

Here is what happens in my current environment (roxygen2 and knitr are old; latest pak, latest R, on intel mac; sorry it may not be a reprex):

> options(pkg.platforms =  "x86_64-apple-darwin20")
> pak::pkg_install("roxygen2", upgrade = FALSE)
✔ Loading metadata database ... done

→ Will update 14 packages.
→ Will download 9 CRAN packages (1.92 MB), cached: 5 (2.75 MB).
+ R6        2.5.1  → 2.5.1   ⬇ (83.25 kB)
+ brew      1.0-10 → 1.0-10  ⬇ (73.42 kB)
+ callr     3.7.6  → 3.7.6   ⬇ (440.80 kB)
+ desc      1.4.3  → 1.4.3   ⬇ (335.23 kB)
+ evaluate  0.24.0 → 0.24.0
+ highr     0.11   → 0.11
+ knitr     1.45   → 1.47
+ lifecycle 1.0.4  → 1.0.4   ⬇ (124.76 kB)
+ pkgbuild  1.4.4  → 1.4.4   ⬇ (202.56 kB)
+ pkgload   1.4.0  → 1.4.0
+ roxygen2  7.3.1  → 7.3.2
+ rprojroot 2.0.4  → 2.0.4   ⬇ (105.91 kB)
+ stringr   1.5.1  → 1.5.1   ⬇ (313.90 kB)
+ withr     3.0.0  → 3.0.0   ⬇ (241.08 kB)

! R6, lifecycle, pkgbuild, pkgload, stringr, and withr are loaded in the current
R session, you probably need to restart R after the installation.

? Do you want to continue (Y/n) n

It works as expected when the option pkg.platforms is empty:

> options(pkg.platforms =  NULL)
> pak::pkg_install("roxygen2", upgrade = FALSE)
✔ Loading metadata database ... done

→ Will update 1 package.
→ The package (966.13 kB) is cached.
+ roxygen2 7.3.1 → 7.3.2
? Do you want to continue (Y/n) n