What should I do with the CRAN-SUBMISSION file after releasing an R package version

Viewed 61

Using the devtools::release() function to submit a new version of a package to CRAN, the file CRAN-SUBMISSION is automatically created and populated with something like this:

Version: 0.1.9
Date: 2022-06-14 05:51:04 UTC
SHA: f583bd94bfbb3b1626670e7dbe08a9d3b494bbc8

I noticed the file is automatically added to the .Rbuildignore file, but is there a good reason why I should track this file in git, or should I simply remove it from the repository / .gitignore it?

I have a vague memory of the same file previously saying something like "remove this once the release is on CRAN", but I'd like to know more about why it exists in the first place (and if there's any reason why it doesn't say that anymore).

1 Answers

If you use Git for your package, the file has the identifier (SHA) indicating which commit you sent to CRAN. The package usethis uses that information for creating a release, see https://usethis.r-lib.org/reference/use_github_release.html :

If you use devtools::release() or devtools::submit_cran() to submit to CRAN, information about the submitted state is captured in a CRAN-SUBMISSION or CRAN-RELEASE file. use_github_release() uses this info to populate the draft GitHub release and, after success, deletes the CRAN-SUBMISSION or CRAN-RELEASE file.

Usually I don’t commit that since it is for internal management only.

Related