capsule
capsule copied to clipboard
Should capsule transform RSPM repo urls
When writing a lockfile, currently {capsule}
diverges from {renv}
with respect to RSPM repo URLS.
On a system with:
> options('repos')
$repos
RSPM
"https://packagemanager.rstudio.com/all/__linux__/focal/latest"
CRAN
"https://cran.rstudio.com"
{capsule}
will write:
"Repositories": [
{
"Name": "RSPM",
"URL": "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
},
{
"Name": "CRAN",
"URL": "https://cran.rstudio.com"
}
]
while {renv}
writes:
"Repositories": [
{
"Name": "RSPM",
"URL": "https://packagemanager.rstudio.com/all/latest"
},
{
"Name": "CRAN",
"URL": "https://cran.rstudio.com"
}
]
Here {renv}
has transformed the platform specific binary url for RSPM into a general source package url. However when restoring from the lockfile {renv}
will attempt to transform the source url into a platform specific binary one.
I am surprised this hasn't caused issues at work with collaborators working on windows and linux with different repository URLs, so it seems like {renv}
falls back to the local system's repo urls if it can't use the lockfile ones. Need to confirm this, but if so, I see no reason to mirror this complexity.
I can't see a fallback in {renv}
.
So I think a better way of handling this is a new option for resolving repos on restore. Renv uses the lockfile repos with the option to override.
I'll use that override to provide a 'merge' option for repo resolution, which is default for capsule.
Mege works like:
- Where conflicting entries exist for a major repo (CRAN, bioc, rspm) prefer the user's configured repo.
- If a major repo exists in one but not the other, bring it in.
- Major repos have a defined order: bioc, rspm, CRAN.
- All other unique repos are brought in, with a message for those coming from the lockfile. - where to place these in the order will be tricky. Probably they should come after the majors, unless the user has explicitly confuguired them otherwise.