Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control inst/doc cleaning of pkgbuild #129

Closed
rubak opened this issue Nov 7, 2020 · 8 comments
Closed

Control inst/doc cleaning of pkgbuild #129

rubak opened this issue Nov 7, 2020 · 8 comments
Labels
feature a feature request or enhancement

Comments

@rubak
Copy link

rubak commented Nov 7, 2020

I have setup GitHub Actions for the spatstat package using the standard workflow which involves rcmdcheck.

This results in the following error:

** testing if installed package can be loaded from final location
Error in base::serialize(base::as.list(base::getNamespace("spatstat"),  : 
  object 'f' not found
Calls: <Anonymous> -> withCallingHandlers -> <Anonymous>
Execution halted
ERROR: loading failed

If I run R CMD check from the command line everything works fine. Have you encountered this problem before?
Here is the error in context

Here is the next run where R CMD check is used from command line without rcmdcheck. It installs and checks the package fine (but has some issues with vignette building which are irrelevant here).

I appreciate any insights you may provide.

@gaborcsardi
Copy link
Member

gaborcsardi commented Nov 7, 2020

This GHA job was 11 days ago, and since then your GHA build is green, so maybe this was an error in your package?

EDIT: oh, right, because you switched to R CMD check...

@gaborcsardi
Copy link
Member

I believe this is a bug in your package, try running R CMD build on it, and you'll see the same error.

Running R CMD check on the package directory directly is a convenience shortcut, but for a proper check, e.g. to submit the package to CRAN, you need to run R CMD build first and run R CMD check on the tar.gz file. So this is what rcmdcheck::rcmdcheck() does by default.

@gaborcsardi gaborcsardi added the reprex needs a minimal reproducible example label Nov 7, 2020
@rubak
Copy link
Author

rubak commented Nov 7, 2020

Thanks for the quick reply and taking your time to look at this.

I believe that I do run it on the built tarball with the command

R CMD check --no-manual --as-cran spatstat*.tar.gz

On the second latest run on GitHub Actions everything worked without errors (except a pdf manual on Windows and a problem with R 3.5.):
https://github.com/spatstat/spatstat/actions/runs/350506100

Then I started a new run where I switched back to rcmdcheck and it fails with the error message described above:
https://github.com/spatstat/spatstat/actions/runs/350979963

I agree that it most likely is something that is strange about the package given that rcmdcheck works flawlessly in so many other cases, but it appears that it is not problematic for standard R CMD check

@gaborcsardi
Copy link
Member

Since the same error happens without rcmdcheck, just for R CMD build, I think maybe you could try to fix that? If R CMD build fails already, how do you build a tarball to run R CMD check on?

I agree that it most likely is something that is strange about the package given that rcmdcheck works flawlessly in so many other cases, but it appears that it is not problematic for standard R CMD check

R CMD check does not build the package up front, and the error happens for R CMD build.

@gaborcsardi
Copy link
Member

This said, if R CMD check works for you, then you can use that on GHA, rcmdcheck is by no means necessary.

@gaborcsardi
Copy link
Member

OK, I think this is an interference with pkgbuild, because pkgbuild deletes inst/doc by default, before building the package. See r-lib/pkgbuild#58 and several other issue in the pkgbuild repository.

So if you run R CMD build on the unchanged git repo of spatstat then it does not fail. If you run it after running rcmdcheck() like I did, then it does, because pkgbuild has cleaned up inst/doc already.

We could work around this in rcmdcheck, by passing clean_doc = FALSE to pkgbuild, but that'll need an rcmdcheck release. So until then I think you are fine using R CMD check.

@gaborcsardi gaborcsardi changed the title Error loading from final location Control inst/doc cleaning of pkgbuild Nov 7, 2020
@gaborcsardi gaborcsardi added feature a feature request or enhancement and removed reprex needs a minimal reproducible example labels Nov 7, 2020
@gaborcsardi
Copy link
Member

I think rcmdcheck can support

Config/build/clean-inst-doc: false

in DESCRIPTION.

@rubak
Copy link
Author

rubak commented Nov 8, 2020

Thanks for clarifying what was going on here. I prefer using rcmdcheck() over R CMD check because it makes it easy to fail e.g. on Warnings or Notes in the CI setup. So either I will add something to DESCRIPTION as you mention or simply build first with R CMD build and then check the built tarball with rcmdcheck().

Thanks again for the quick answer and solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants