rstudio / renv

renv: Project environments for R.

Home Page:https://rstudio.github.io/renv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Result of `renv::install(lock = TRUE)` differs from `renv::install(lock = FALSE); renv::snapshot()`

salim-b opened this issue · comments

I'm using renv with its "explicit" snapshot type and just tested the new lock argument for renv::install() introduced in renv 1.0.4.

I noticed that when I install a new package1 using

renv::install("rsvg", lock = TRUE)

renv writes the following lines to my project's renv.lock:

    "rsvg": {
      "Package": "rsvg",
      "Version": "2.6.0",
      "OS_type": null,
      "NeedsCompilation": "yes",
      "Repository": "CRAN",
      "Source": "Repository",
      "Path": "/home/salim/.cache/R/renv/cache/v5/R-4.3/x86_64-pc-linux-gnu/rsvg/2.6.0/7aaf92c4adddc8a85696ae7f0123a725/rsvg"
    },

When installing the same package using

renv::install("rsvg", lock = FALSE)
renv::snapshot()

OTOH, renv writes these lines to the renv.lock:

    "rsvg": {
      "Package": "rsvg",
      "Version": "2.6.0",
      "Source": "Repository",
      "Repository": "RSPM",
      "Hash": "7aaf92c4adddc8a85696ae7f0123a725"
    },

I guess this isn't supposed to be the intended behaviour, no?

I was first delighted by the new lock argument since it'd give a better UX for renv's explicit snapshot type, but I really don't wanna write local filesystem paths to an renv project's lock file shared with others...

Footnotes

  1. For the sake of simplicity, I use rsvg here, a package without any further R package dependencies. In both cases, rsvg was added to the project's DESCRIPTION file before installing it.

🤦 Thanks for the bug report; I'll get this fixed up.

Should hopefully be fixed via 2efbbdd.