Issue with CRAN recipes that use `renv`
I've tried to build an R recipe with rattler-build, but it seems to be failing because it is somehow not handling renv well. Maybe renv needs to be ignored, or at least dealt with int some way?
See the recipe here: https://github.com/conda-forge/staged-recipes/pull/30080 And the relevant error here: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=1259906&view=logs&j=4cabe686-70ae-553a-7fd0-310379f2cbac&t=6a4fc7c9-c31a-5115-eff9-6479d72b69ff&l=849
To be honest, I am unsure in which way this interacts. From the logs it looked like it might not find some dependencies (`dependency ‘cli’ is not available for package ‘rpix’ `) although I can see that you are installing it correctly.
I would guess that somehow .Rprofile gets called, which activates renv.
Can’t test right now, but maybe the debugging/next steps could be:
- Try writing the recipe in the old format and see how it behaves to get an idea about whether this is actually rattler-build related.
- Prepend commands to the build script to remove .Rprofile, possibly renv files and folders and maybe set renv-related environment variables.
I added a line in scripts that simply removed all the renv related stuff, and it now builds fine! It now looks:
build:
noarch: generic
script:
- rm -rf .Rprofile renv renv.lock
- R CMD INSTALL --build .
There were a few lints by conda-forge-linting which maybe should be fixed in the example on the website:
Hi! This is the friendly automated conda-forge-linting service.
I wanted to let you know that I linted all conda-recipes in your PR (recipes/r-rpix/recipe.yaml) and found some lint.
Here's what I've got...
For recipes/r-rpix/recipe.yaml:
❌ The recipe could do with some maintainers listed in the extra/recipe-maintainers section. ❌ The recipe must have a build/number section. ❌ There are too few lines. There should be one empty line at the end of the file. ❌ license_file entry is missing, but is required.