| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/revcheck.R |
| 3 |
\name{rev_check} |
| 4 |
\alias{rev_check} |
| 5 |
\alias{compare_Rcheck} |
| 6 |
\title{Run \command{R CMD check} on the reverse dependencies of a package} |
| 7 |
\usage{ |
| 8 |
rev_check( |
| 9 |
pkg, |
| 10 |
which = "all", |
| 11 |
recheck = NULL, |
| 12 |
ignore = NULL, |
| 13 |
update = TRUE, |
| 14 |
timeout = getOption("xfun.rev_check.timeout", 15 * 60), |
| 15 |
src = file.path(src_dir, pkg), |
| 16 |
src_dir = getOption("xfun.rev_check.src_dir") |
| 17 |
) |
| 18 |
|
| 19 |
compare_Rcheck(status_only = TRUE, output = "00check_diffs.md") |
| 20 |
} |
| 21 |
\arguments{ |
| 22 |
\item{pkg}{The package name.} |
| 23 |
|
| 24 |
\item{which}{Which types of reverse dependencies to check. See |
| 25 |
\code{\link[tools:package_dependencies]{tools::package_dependencies()}} for possible values. The special value |
| 26 |
\code{'hard'} means the hard dependencies, i.e., \code{c('Depends', 'Imports', 'LinkingTo')}.} |
| 27 |
|
| 28 |
\item{recheck}{A vector of package names to be (re)checked. If not provided |
| 29 |
and there are any \file{*.Rcheck} directories left by certain packages |
| 30 |
(this often means these packages failed the last time), \code{recheck} will be |
| 31 |
these packages; if there are no \file{*.Rcheck} directories but a text file |
| 32 |
\file{recheck} exists, \code{recheck} will be the character vector read from |
| 33 |
this file. This provides a way for you to manually specify the packages to |
| 34 |
be checked. If there are no packages to be rechecked, all reverse |
| 35 |
dependencies will be checked.} |
| 36 |
|
| 37 |
\item{ignore}{A vector of package names to be ignored in \command{R CMD |
| 38 |
check}. If this argument is missing and a file \file{00ignore} exists, the |
| 39 |
file will be read as a character vector and passed to this argument.} |
| 40 |
|
| 41 |
\item{update}{Whether to update all packages before the check.} |
| 42 |
|
| 43 |
\item{timeout}{Timeout in seconds for \command{R CMD check} to check each |
| 44 |
package. The (approximate) total time can be limited by the global option |
| 45 |
\code{xfun.rev_check.timeout_total}.} |
| 46 |
|
| 47 |
\item{src}{The path of the source package directory.} |
| 48 |
|
| 49 |
\item{src_dir}{The parent directory of the source package directory. This can |
| 50 |
be set in a global option if all your source packages are under a common |
| 51 |
parent directory.} |
| 52 |
|
| 53 |
\item{status_only}{If \code{TRUE}, only compare the final statuses of the |
| 54 |
checks (the last line of \file{00check.log}), and delete \file{*.Rcheck} |
| 55 |
and \file{*.Rcheck2} if the statuses are identical, otherwise write out the |
| 56 |
full diffs of the logs. If \code{FALSE}, compare the full logs under |
| 57 |
\file{*.Rcheck} and \file{*.Rcheck2}.} |
| 58 |
|
| 59 |
\item{output}{The output Markdown file to which the diffs in check logs will |
| 60 |
be written. If the \pkg{markdown} package is available, the Markdown file |
| 61 |
will be converted to HTML, so you can see the diffs more clearly.} |
| 62 |
} |
| 63 |
\value{ |
| 64 |
A named numeric vector with the names being package names of reverse |
| 65 |
dependencies; \code{0} indicates check success, \code{1} indicates failure, and \code{2} |
| 66 |
indicates that a package was not checked due to global timeout. |
| 67 |
} |
| 68 |
\description{ |
| 69 |
Install the source package, figure out the reverse dependencies on CRAN, |
| 70 |
download all of their source packages, and run \command{R CMD check} on them |
| 71 |
in parallel. The number of parallel downloads can be set via |
| 72 |
\code{options(xfun.rev_check.download_cores = n)} and the number of parallel |
| 73 |
checks can be set via \code{options(mc.cores = n)} (both default to |
| 74 |
\code{\link[parallel:detectCores]{parallel::detectCores()}}). |
| 75 |
} |
| 76 |
\details{ |
| 77 |
Everything occurs under the current working directory, and you are |
| 78 |
recommended to call this function under a designated directory, especially |
| 79 |
when the number of reverse dependencies is large, because all source packages |
| 80 |
will be downloaded to this directory, and all \file{*.Rcheck} directories |
| 81 |
will be generated under this directory, too. |
| 82 |
|
| 83 |
If a source tarball of the expected version has been downloaded before (under |
| 84 |
the \file{tarball} directory), it will not be downloaded again (to save time |
| 85 |
and bandwidth). |
| 86 |
|
| 87 |
After a package has been checked, the associated \file{*.Rcheck} directory |
| 88 |
will be deleted if the check was successful (no warnings or errors or notes), |
| 89 |
which means if you see a \file{*.Rcheck} directory, it means the check |
| 90 |
failed, and you need to take a look at the log files under that directory. |
| 91 |
|
| 92 |
The time to finish the check is recorded for each package. As the check goes |
| 93 |
on, the total remaining time will be roughly estimated via \code{n * mean(times)}, |
| 94 |
where \code{n} is the number of packages remaining to be checked, and \code{times} is a |
| 95 |
vector of elapsed time of packages that have been checked. |
| 96 |
|
| 97 |
If a check on a reverse dependency failed, its \file{*.Rcheck} directory will |
| 98 |
be renamed to \file{*.Rcheck2}, and another check will be run against the |
| 99 |
CRAN version of the package unless \code{options(xfun.rev_check.compare = FALSE)} |
| 100 |
is set. If the logs of the two checks are the same, it means no new problems |
| 101 |
were introduced in the package, and you can probably ignore this particular |
| 102 |
reverse dependency. The function \code{compare_Rcheck()} can be used to create a |
| 103 |
summary of all the differences in the check logs under \file{*.Rcheck} and |
| 104 |
\file{*.Rcheck2}. This will be done automatically if |
| 105 |
\code{options(xfun.rev_check.summary = TRUE)} has been set. |
| 106 |
|
| 107 |
A recommended workflow is to use a special directory to run \code{rev_check()}, |
| 108 |
set the global \code{\link[=options]{options()}} \code{xfun.rev_check.src_dir} and \code{repos} in the R |
| 109 |
startup (see \verb{?}\code{\link{Startup}}) profile file \code{.Rprofile} under this directory, |
| 110 |
and (optionally) set \code{R_LIBS_USER} in \file{.Renviron} to use a special |
| 111 |
library path (so that your usual library will not be cluttered). Then run |
| 112 |
\code{xfun::rev_check(pkg)} once, investigate and fix the problems or (if you |
| 113 |
believe it was not your fault) ignore broken packages in the file |
| 114 |
\file{00ignore}, and run \code{xfun::rev_check(pkg)} again to recheck the failed |
| 115 |
packages. Repeat this process until all \file{*.Rcheck} directories are gone. |
| 116 |
|
| 117 |
As an example, I set \code{options(repos = c(CRAN = 'https://cran.rstudio.com'), xfun.rev_check.src_dir = '~/Dropbox/repo')} in \file{.Rprofile}, and |
| 118 |
\verb{R_LIBS_USER=~/R-tmp} in \file{.Renviron}. Then I can run, for example, |
| 119 |
\code{xfun::rev_check('knitr')} repeatedly under a special directory |
| 120 |
\file{~/Downloads/revcheck}. Reverse dependencies and their dependencies will |
| 121 |
be installed to \file{~/R-tmp}, and \pkg{knitr} will be installed from |
| 122 |
\file{~/Dropbox/repo/kintr}. |
| 123 |
} |
| 124 |
\seealso{ |
| 125 |
\code{devtools::revdep_check()} is more sophisticated, but currently has |
| 126 |
a few major issues that affect me: (1) It always deletes the |
| 127 |
\file{*.Rcheck} directories |
| 128 |
(\url{https://github.com/r-lib/devtools/issues/1395}), which makes it difficult |
| 129 |
to know more information about the failures; (2) It does not fully install |
| 130 |
the source package before checking its reverse dependencies |
| 131 |
(\url{https://github.com/r-lib/devtools/pull/1397}); (3) I feel it is fairly |
| 132 |
difficult to iterate the check (ignore the successful packages and only |
| 133 |
check the failed packages); by comparison, \code{xfun::rev_check()} only |
| 134 |
requires you to run a short command repeatedly (failed packages are |
| 135 |
indicated by the existing \file{*.Rcheck} directories, and automatically |
| 136 |
checked again the next time). |
| 137 |
|
| 138 |
\code{xfun::rev_check()} borrowed a very nice feature from |
| 139 |
\code{devtools::revdep_check()}: estimating and displaying the remaining time. |
| 140 |
This is particularly useful for packages with huge numbers of reverse |
| 141 |
dependencies. |
| 142 |
} |