pkgcache-package {pkgcache} | R Documentation |
Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.
Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.
You can install the released version of pkgcache from CRAN with:
install.packages("pkgcache")
meta_cache_list()
lists all packages in the metadata cache. It
includes Bioconductor package, and all versions (i.e. both binary and
source) of the packages for the current platform and R version.
library(pkgcache) meta_cache_list() #> # A tibble: 36,184 x 33 #> package title version depends suggests built imports archs repodir platform #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 A3 "Acc~ 1.0.0 R (>= ~ randomF~ R 3.~ <NA> <NA> bin/ma~ macos #> 2 aaSEA "Ami~ 1.1.0 R(>= 3~ knitr, ~ R 3.~ "DT(>=~ <NA> bin/ma~ macos #> 3 ABACUS "App~ 1.0.0 R (>= ~ rmarkdo~ R 3.~ "ggplo~ <NA> bin/ma~ macos #> 4 abbyyR "Acc~ 0.5.5 R (>= ~ testtha~ R 3.~ "httr,~ <NA> bin/ma~ macos #> 5 abc.da~ "Dat~ 1.0 R (>= ~ <NA> R 3.~ <NA> <NA> bin/ma~ macos #> 6 ABC.RAP "Arr~ 0.9.0 R (>= ~ knitr, ~ R 3.~ "graph~ <NA> bin/ma~ macos #> 7 abc "Too~ 2.1 R (>= ~ <NA> R 3.~ <NA> <NA> bin/ma~ macos #> 8 abcADM "Fit~ 1.0 <NA> <NA> R 3.~ "Rcpp ~ abcA~ bin/ma~ macos #> 9 ABCana~ "Com~ 1.2.1 R (>= ~ <NA> R 3.~ "plotr~ <NA> bin/ma~ macos #> 10 abcdeF~ "ABC~ 0.4 Rglpk,~ LIM,syb~ R 3.~ <NA> <NA> bin/ma~ macos #> # ... with 36,174 more rows, and 23 more variables: rversion <chr>, #> # needscompilation <chr>, priority <chr>, ref <chr>, type <chr>, #> # direct <lgl>, status <chr>, target <chr>, mirror <chr>, sources <list>, #> # filesize <int>, sha256 <chr>, sysreqs <chr>, published <dttm>, deps <list>, #> # license <chr>, md5sum <chr>, linkingto <chr>, enhances <chr>, #> # license_restricts_use <chr>, os_type <chr>, license_is_foss <chr>, #> # path <chr>
meta_cache_deps()
and meta_cache_revdeps()
can be used to look up
dependencies and reverse dependencies.
The metadata is updated automatically if it is older than seven days,
and it can also be updated manually with meta_cache_update()
.
See the cranlike_metadata_cache
R6 class for a lower level API, and
more control.
Package management tools may use the pkg_cache_*
functions and in
particular the package_cache
class, to make use of local caching of
package files.
The pkg_cache_*
API is high level, and uses a user level cache:
pkg_cache_summary() #> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/R-pkg/pkg" #> #> $files #> [1] 45 #> #> $size #> [1] 62270503
pkg_cache_list() #> # A tibble: 45 x 9 #> fullpath path package url etag sha256 version platform built #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> #> 1 /Users/gabo~ src/cont~ usethis <NA> <NA> 1eb8efc~ <NA> <NA> 0 #> 2 /Users/gabo~ src/cont~ testth~ <NA> <NA> b7e0682~ <NA> <NA> 0 #> 3 /Users/gabo~ src/cont~ waldo <NA> <NA> 8a33455~ <NA> <NA> 0 #> 4 /Users/gabo~ src/cont~ testth~ <NA> <NA> 95f987c~ <NA> <NA> 0 #> 5 /Users/gabo~ src/cont~ testth~ <NA> <NA> 7c068df~ <NA> <NA> 0 #> 6 /Users/gabo~ bin/maco~ polycl~ https:/~ "\"7~ f396afd~ 1.10-0 macos NA #> 7 /Users/gabo~ bin/maco~ vpc https:/~ "\"d~ ab43b8f~ 1.1.0 macos NA #> 8 /Users/gabo~ bin/maco~ tweenr https:/~ "\"f~ dc551dd~ 1.0.1 macos NA #> 9 /Users/gabo~ bin/maco~ farver https:/~ "\"1~ c8b5d2f~ 2.0.3 macos NA #> 10 /Users/gabo~ bin/maco~ ggforce https:/~ "\"4~ d635860~ 0.3.1 macos NA #> # ... with 35 more rows
pkg_cache_find(package = "dplyr") #> # A tibble: 0 x 9 #> # ... with 9 variables: fullpath <chr>, path <chr>, package <chr>, url <chr>, #> # etag <chr>, sha256 <chr>, version <chr>, platform <chr>, built <int>
pkg_cache_add_file()
can be used to add a file,
pkg_cache_delete_files()
to remove files, pkg_cache_get_files()
to
copy files out of the cache.
The package_cache
class provides a finer API.
Both the metadata cache and the package cache support Bioconductor by
default, automatically. See the BioC_mirror
option and the
R_BIOC_MIRROR
and R_BIOC_VERSION
environment variables below to
configure pkgcache’s Bioconductor support.
The BioC_mirror
option can be used to select a Bioconductor
mirror. This takes priority over the R_BIOC_MIRROR
environment
variable.
pkgcache_timeout
is the HTTP timeout for all downloads. It is in
seconds, and the limit for downloading the whole file. Defaults to
3600, one hour. It corresponds to the TIMEOUT
libcurl option.
pkgcache_connecttimeout
is the HTTP timeout for the connection
phase. It is in seconds and defaults to 30 seconds. It corresponds
to the CONNECTTIMEOUT
libcurl option.
pkgcache_low_speed_limit
and pkgcache_low_speed_time
are used
for a more sensible HTTP timeout. If the download speed is less than
pkgcache_low_speed_limit
bytes per second for at least
pkgcache_low_speed_time
seconds, the download errors. They
correspond to the
LOW_SPEED_LIMIT
and
LOW_SPEED_TIME
curl options.
The R_BIOC_VERSION
environment variable can be used to override
the default Bioconductor version detection and force a given
version. E.g. this can be used to force the development version of
Bioconductor.
The R_BIOC_MIRROR
environment variable can be used to select a
Bioconductor mirror. The BioC_mirror
option takes priority over
this, if set.
PKGCACHE_TIMEOUT
is the HTTP timeout for all downloads. It is in
seconds, and the limit for downloading the whole file. Defaults to
3600, one hour. It corresponds to the TIMEOUT
libcurl option. The
pkgcache_timeout
option has priority over this, if set.
PKGCACHE_CONNECTTIMEOUT
is the HTTP timeout for the connection
phase. It is in seconds and defaults to 30 seconds. It corresponds
to the CONNECTTIMEOUT
libcurl option.
The pkgcache_connecttimeout
option takes precedence over this, if
set.
PKGCACHE_LOW_SPEED_LIMIT
and PKGCACHE_LOW_SPEED_TIME
are used
for a more sensible HTTP timeout. If the download speed is less than
PKGCACHE_LOW_SPEED_LIMIT
bytes per second for at least
PKGCACHE_LOW_SPEED_TIME
seconds, the download errors. They
correspond to the
LOW_SPEED_LIMIT
and
LOW_SPEED_TIME
curl options. The pkgcache_low_speed_time
and
pkgcache_low_speed_limit
options have priority over these
environment variables, if they are set.
R_PKG_CACHE_DIR
is used for the cache directory, if set.
(Otherwise rappdirs::user_cache_dir()
is used, see also
meta_cache_summary()
and pkg_cache_summary()
).
Please note that the ‘pkgcache’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
MIT © RStudio Inc
Maintainer: Gábor Csárdi csardi.gabor@gmail.com
Useful links: