r-lib / pak

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

Upgrade fails with git repos #640

Closed latot closed 3 weeks ago

latot commented 3 weeks ago

Hi!, I found this issue today:

pak::pkg_install("https://github.com/moodymudskipper/typed")

pak::pkg_install("typed", upgrade = TRUE)

→ Will update 1 package.
→ The package (47.33 kB) is cached.
+ typed 0.0.1.9000 → 0.0.1 [bld]
? Do you want to continue (Y/n) 

As you can see, first install a git version, which install fine, but if we ask to upgrade the same package, is going back to the old version, it should upgrade on the git repo instead ask CRAN about it.

Thx!

gaborcsardi commented 3 weeks ago
pak::pkg_install("typed")

installs the CRAN version, always. It would be quite bad if the version to be installed depended on what you already have installed.

upgrade = TRUE only applies to the dependencies of typed. typed itself is always upgraded to the latest version. The latest CRAN version in this case.

latot commented 3 weeks ago

mmm, I think is right, but also complex.

The hard part comes when you install from the list of installed packages.

dplyr::filter(pak::lib_status(), package == "typed")
# A data frame: 1 × 36
  library         package title version license imports suggests depends remotes
  <chr>           <chr>   <chr> <chr>   <chr>   <chr>   <chr>    <chr>   <chr>  
1 /home/pipe/R/x… typed   Supp… 0.0.1.… GPL-3   utils,… testtha… NA      NA     

Actually, is not possible to retrieve this distinction from for example lib_status, we can know the package, but is not very intuitive that the name used here does not match with the one to install.