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

1

5

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).

Hasidism answered 14/6, 2022 at 6:50 Comment(0)
H
6

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.

Haver answered 15/6, 2022 at 12:19 Comment(2)
Thank you for pointing to this bit of documentation. So do you add the file to .gitignore or do you systematically remove it after submitting to CRAN? I understand use_github_release() removes it automatically because the user isn't actually submitting to CRAN, so again, wondering if there's another reason release() or submit_cran() don't delete it once it has been sent... Probably because success is not automatically reported to the function by CRAN, and might take a few days? I might track it as it ultimately increases transparency of everything that's been done with the package...Hasidism
In my case the file is in .gitignore and, as I create releases with use_github_release(), it is removed/I removed it after the new version is accepted on CRANHaver

© 2022 - 2024 — McMap. All rights reserved.