Skip to contents

uvr resolves the R it targets on its own: .r-version first, then the uvr.toml r_version constraint, then the newest R it can find (managed installs before system R). In an image carrying more than one R – for example a /opt/R/current symlink already moved to a newer release than the R that started the build – "newest wins" selects an R other than the session's. uvr lock then resolves per-R-minor binary URLs for the wrong minor and uvr sync refuses to install anything at all: "Refusing to install: uvr is running inside R 4.5 but the project pin/lockfile resolves to R 4.6". Writing an exact pin binds uvr to the session driving the build.

Usage

write_r_version_pin(clone_dir)

Arguments

clone_dir

Directory to write .r-version into; uvr reads it from the working directory of the lock and sync runs.

Value

Invisibly, the path to the written .r-version.

Details

The pin is assembled the way uvr itself queries a version (R.version$major + R.version$minor), so it matches the R uvr discovers via R_HOME character for character; a non-matching pin is a hard uvr error rather than a silent build against the wrong R.