EVOLUTION-MANAGER
Edit File: rev_check.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Run 'R CMD check' on the reverse dependencies of a package</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for rev_check {xfun}"><tr><td>rev_check {xfun}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Run <code>R CMD check</code> on the reverse dependencies of a package</h2> <h3>Description</h3> <p>Install the source package, figure out the reverse dependencies on CRAN, download all of their source packages, and run <code>R CMD check</code> on them in parallel. </p> <h3>Usage</h3> <pre> rev_check( pkg, which = "all", recheck = NULL, ignore = NULL, update = TRUE, timeout = getOption("xfun.rev_check.timeout", 15 * 60), src = file.path(src_dir, pkg), src_dir = getOption("xfun.rev_check.src_dir") ) compare_Rcheck(status_only = FALSE, output = "00check_diffs.md") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>pkg</code></td> <td> <p>The package name.</p> </td></tr> <tr valign="top"><td><code>which</code></td> <td> <p>Which types of reverse dependencies to check. See <code>tools::<a href="../../tools/html/package_dependencies.html">package_dependencies</a>()</code> for possible values. The special value <code>'hard'</code> means the hard dependencies, i.e., <code>c('Depends', 'Imports', 'LinkingTo')</code>.</p> </td></tr> <tr valign="top"><td><code>recheck</code></td> <td> <p>A vector of package names to be (re)checked. If not provided and there are any ‘<span class="file">*.Rcheck</span>’ directories left by certain packages (this often means these packages failed the last time), <code>recheck</code> will be these packages; if there are no ‘<span class="file">*.Rcheck</span>’ directories but a text file ‘<span class="file">recheck</span>’ exists, <code>recheck</code> will be the character vector read from this file. This provides a way for you to manually specify the packages to be checked. If there are no packages to be rechecked, all reverse dependencies will be checked.</p> </td></tr> <tr valign="top"><td><code>ignore</code></td> <td> <p>A vector of package names to be ignored in <code>R CMD check</code>. If this argument is missing and a file ‘<span class="file">00ignore</span>’ exists, the file will be read as a character vector and passed to this argument.</p> </td></tr> <tr valign="top"><td><code>update</code></td> <td> <p>Whether to update all packages before the check.</p> </td></tr> <tr valign="top"><td><code>timeout</code></td> <td> <p>Timeout in seconds for <code>R CMD check</code>.</p> </td></tr> <tr valign="top"><td><code>src</code></td> <td> <p>The path of the source package directory.</p> </td></tr> <tr valign="top"><td><code>src_dir</code></td> <td> <p>The parent directory of the source package directory. This can be set in a global option if all your source packages are under a common parent directory.</p> </td></tr> <tr valign="top"><td><code>status_only</code></td> <td> <p>If <code>TRUE</code>, only compare the final statuses of the checks (the last line of ‘<span class="file">00check.log</span>’), and delete ‘<span class="file">*.Rcheck</span>’ and ‘<span class="file">*.Rcheck2</span>’ if the statuses are identical, otherwise write out the full diffs of the logs. If <code>FALSE</code>, compare the full logs under ‘<span class="file">*.Rcheck</span>’ and ‘<span class="file">*.Rcheck2</span>’.</p> </td></tr> <tr valign="top"><td><code>output</code></td> <td> <p>The output Markdown file to which the diffs in check logs will be written. If the <span class="pkg">markdown</span> package is available, the Markdown file will be converted to HTML, so you can see the diffs more clearly.</p> </td></tr> </table> <h3>Details</h3> <p>Everything occurs under the current working directory, and you are recommended to call this function under a designated directory, especially when the number of reverse dependencies is large, because all source packages will be downloaded to this directory, and all ‘<span class="file">*.Rcheck</span>’ directories will be generated under this directory, too. </p> <p>If a source tarball of the expected version has been downloaded before (under the ‘<span class="file">tarball</span>’ directory), it will not be downloaded again (to save time and bandwidth). </p> <p>After a package has been checked, the associated ‘<span class="file">*.Rcheck</span>’ directory will be deleted if the check was successful (no warnings or errors or notes), which means if you see a ‘<span class="file">*.Rcheck</span>’ directory, it means the check failed, and you need to take a look at the log files under that directory. </p> <p>The time to finish the check is recorded for each package. As the check goes on, the total remaining time will be roughly estimated via <code>n * mean(times)</code>, where <code>n</code> is the number of packages remaining to be checked, and <code>times</code> is a vector of elapsed time of packages that have been checked. </p> <p>If a check on a reverse dependency failed, its ‘<span class="file">*.Rcheck</span>’ directory will be renamed to ‘<span class="file">*.Rcheck2</span>’, and another check will be run against the CRAN version of the package. If the logs of the two checks are the same, it means no new problems were introduced in the package, and you can probably ignore this particular reverse dependency. The function <code>compare_Rcheck()</code> can be used to create a summary of all the differences in the check logs under ‘<span class="file">*.Rcheck</span>’ and ‘<span class="file">*.Rcheck2</span>’. This will be done automatically if <code>options(xfun.rev_check.summary = TRUE)</code> has been set. </p> <p>A recommended workflow is to use a special directory to run <code>rev_check()</code>, set the global <code><a href="../../base/html/options.html">options</a></code> <code>xfun.rev_check.src_dir</code> and <code>repos</code> in the R startup (see <code>?<a href="../../base/html/Startup.html">Startup</a></code>) profile file <code>.Rprofile</code> under this directory, and (optionally) set <code>R_LIBS_USER</code> in ‘<span class="file">.Renviron</span>’ to use a special library path (so that your usual library will not be cluttered). Then run <code>xfun::rev_check(pkg)</code> once, investigate and fix the problems or (if you believe it was not your fault) ignore broken packages in the file ‘<span class="file">00ignore</span>’, and run <code>xfun::rev_check(pkg)</code> again to recheck the failed packages. Repeat this process until all ‘<span class="file">*.Rcheck</span>’ directories are gone. </p> <p>As an example, I set <code>options(repos = c(CRAN = 'https://cran.rstudio.com'), xfun.rev_check.src_dir = '~/Dropbox/repo')</code> in ‘<span class="file">.Rprofile</span>’, and <code>R_LIBS_USER=~/R-tmp</code> in ‘<span class="file">.Renviron</span>’. Then I can run, for example, <code>xfun::rev_check('knitr')</code> repeatedly under a special directory ‘<span class="file">~/Downloads/revcheck</span>’. Reverse dependencies and their dependencies will be installed to ‘<span class="file">~/R-tmp</span>’, and <span class="pkg">knitr</span> will be installed from ‘<span class="file">~/Dropbox/repo/kintr</span>’. </p> <h3>See Also</h3> <p><code>devtools::revdep_check()</code> is more sophisticated, but currently has a few major issues that affect me: (1) It always deletes the ‘<span class="file">*.Rcheck</span>’ directories (<a href="https://github.com/hadley/devtools/issues/1395">https://github.com/hadley/devtools/issues/1395</a>), which makes it difficult to know more information about the failures; (2) It does not fully install the source package before checking its reverse dependencies (<a href="https://github.com/hadley/devtools/pull/1397">https://github.com/hadley/devtools/pull/1397</a>); (3) I feel it is fairly difficult to iterate the check (ignore the successful packages and only check the failed packages); by comparison, <code>xfun::rev_check()</code> only requires you to run a short command repeatedly (failed packages are indicated by the existing ‘<span class="file">*.Rcheck</span>’ directories, and automatically checked again the next time). </p> <p><code>xfun::rev_check()</code> borrowed a very nice feature from <code>devtools::revdep_check()</code>: estimating and displaying the remaining time. This is particularly useful for packages with huge numbers of reverse dependencies. </p> <hr /><div style="text-align: center;">[Package <em>xfun</em> version 0.16 <a href="00Index.html">Index</a>]</div> </body></html>