Using devtools::check() to account for private packages?

Hi all,

I am developing packages for internal use at my company, so for the LICENSE field of my DESCRIPTION file looks something like:

License: Confidential and Proprietary to Acme, Inc.

When I use devtools::check() or hit the "Check" button in the RStudio IDE, I have come to expect a warning that my license is non-standard.

As a result, I consider

0 errors ✔ | 1 warning ✖ | 0 notes ✔

to be a success.

This is OK for me as a work around, but it might not work if I am using an internal CI service.

My question is: is there a way to specify to the "checker" to ignore the license, or to add another permitted licence in this context?

Thanks!

The license check is coming from R CMD check, so you can disable it by setting the environment variable _R_CHECK_LICENSE_=false. You may also want to try maybe, see https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Tools for details.

4 Likes

Thanks Jim!

I have looked at a couple of different strategies for adding the line

_R_CHECK_LICENSE_=FALSE

to a .Renviron file:

  1. Add it to the file in my home directory: I can get this to work robustly, but I may miss problems on open-source packages. This is not a show-stopper because Travis will find problems when I push to GitHub.

  2. Create a .Renviron file specific to the root directory of any internal package (and add it to .Rbuildignore) - then put the line in. This limits the behavior to that package, but I lose all the variables I set in my "home" .Renviron. I understand that R considers no more than one .Renviron file.

I think solution (1) will work OK for me, but I wanted to ask the followon question - is there a way to direct a project .Renviron file to refer also to the "home" .Renviron file? If the answer is no, that's OK :slightly_smiling_face:

Thanks again!

if you use readRenviron() you can manage that. You can put something in your project .Rprofile or just in a script

Either load both Renviron

readRenviron("~/.Renviron")
readRenviron("./.Renviron")

or use a custom file to store your check related environment file and load this one before checking

readRenviron("check.env")

where check.env is

_R_CHECK_LICENSE_=FALSE

i think this should work. Most of the time... the only drawback is that some variable expansion are not done (like %V or %p for lib path - pretty annoying but it is like that).

Also, do not forget you have a env_vars argument in devtools::check(), specifically for this kind of use case. I think this is used that way

devtools::check(env_vars = c(_R_CHECK_LICENSE_= FALSE))

This would be the simpler for those variable dedicated to checking :package:.

Hope it helps

2 Likes

Hi Christophe,

This is super, thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.