3

I'm updating a package that is currently on CRAN. Running devtools::check() locally consistently gives the WARNING

> checking package subdirectories ... WARNING
  Found the following directory with the name of a version control directory:
  These should not be in a package tarball.
    ./.git

and NOTE

> checking for hidden files and directories ... NOTE
  Found the following hidden files and directories:
    .git
  These were most likely included in error. See section 'Package
  structure' in the 'Writing R Extensions' manual.
  
  CRAN-pack does not know about
    .git

When I check on winbuilder, I no longer get the WARNING, but I do get the NOTE.

This is my .Rbuildignore file, which should be ignoring the .git folder, but isn't for some reason (?)

^.*\.Rproj$
^\.Rproj\.user$
^cran-comments\.md$
^\.Rhistory$
^docs$
^\.travis\.yml$
^CRAN-RELEASE$
^\.git$
^\.github$

I recently migrated from Windows to Mac (os 12.1), and I'm running R version 4.1.1 and RStudio version 1.4.1717. Thanks for any help - I can't figure this one out, and it's making me crazy.


EDIT: For reproducibility, my package is currently on Github at https://github.com/mbtyers/riverdist

7
  • Stab in the dark, but have you converted the line endings in your .Rbuildignore from Windows to Mac line endings?
    – Hobo
    Commented Jan 2, 2022 at 11:11
  • @Hobo This sounds promising - what are Mac line endings?
    – Matt Tyers
    Commented Jan 2, 2022 at 11:16
  • What happens if you just ignore with .git? It seems to work on my build ignores.
    – NelsonGon
    Commented Jan 2, 2022 at 12:49
  • @NelsonGon My Buildignore includes ^\.git$, is that what you meant?
    – Matt Tyers
    Commented Jan 2, 2022 at 13:19
  • 2
    @NelsonGon No luck with .git, ^\.git, ^git, or ^git$. ^\git$ throws an error when I Install & Restart, which is encouraging since it was starting to think my buildignore was being ignored entirely!
    – Matt Tyers
    Commented Jan 2, 2022 at 14:19

2 Answers 2

3

Edited to simplify:

You can leave .git out of .Rbuildignore completely: version control directories are automatically ignored for several version control systems, including git.

7
  • Thanks for your answer - unfortunately, neither suggestion (removing the .git line completely or turning it into ^\.git) made the WARNING or NOTE go away. Trying winbuilder, I still have the NOTE.
    – Matt Tyers
    Commented Jan 2, 2022 at 14:23
  • Is your package on Github? We can't reproduce the issue with what you've posted. Commented Jan 2, 2022 at 14:48
  • Also: you haven't told us how you built the tarball. Do you get the problem if you build it from the command line using R CMD build? Commented Jan 2, 2022 at 14:50
  • Good suggestion with the Github link - see edit above. So far I've built the tarball using the "Install & Restart" button in RStudio.
    – Matt Tyers
    Commented Jan 2, 2022 at 15:52
  • I think the problem may be that "Install & Restart" doesn't build a tarball, it just installs locally. You've probably been submitting an unmodified tarball after each attempted change. To get RStudio to build a tarball, use "Build Source Package" in the "Build | More..." menu. Commented Jan 2, 2022 at 16:22
3

This one had a strange and unrelated solution, which I will post in case someone else runs into a similar issue. I should have seen the clue when I ran "build source package" (ordevtools::build() or devtools::check()) and in the long scrolling output would get a long series of

rm: /var/folders/1r/qj42pgb ... 3c4f: Operation not permitted
rm: /var/folders/1r/qj42pgb ... b6ad: Operation not permitted
rm: /var/folders/1r/qj42pgb ... s/e3: Directory not empty
rm: /var/folders/1r/qj42pgb ... c5d0: Operation not permitted

My guess is that when I transferred my work from a Windows machine to a Mac via external drive, some directory was corrupted or there was a permissions issue. If so, I could imagine my machine being unable to follow my .Rbuildignore, or exclude version control directories as mentioned in @user2554330's answer.

Ultimately, I downloaded a fresh version from Github (which I had been pushing to) and built/checked on that, and the issue was gone.

Not the answer you're looking for? Browse other questions tagged or ask your own question.