Skip to contents

Downloads and reads the repository index from an S3 bucket (under src/contrib). Prefers PACKAGES.rds, then PACKAGES.gz, then plain PACKAGES. If none exist, returns an empty pkg_index with a warning.

The returned object is a pkg_index data frame. For convenience, the following attributes are attached:

  • s3_bucket: the bucket name used

  • s3_key: the object key that was read (or NULL if none)

  • s3_etag: the ETag of the object that was read (or NA_character_)

This function relies on the AWS CLI and the helpers s3_etag() and s3_download() that error on failures.

Usage

s3cran_read_pkg_index(bucket)

Arguments

bucket

Character scalar. Name of the S3 bucket hosting the CRAN-like repo.

Value

A pkg_index object (possibly zero rows) with S3 attributes attached.

Details

Only the index files are downloaded; package archives are never fetched. The repository root is assumed to be src/contrib.

Examples

if (FALSE) { # \dontrun{
# Read the current index (prefers PACKAGES.rds)
idx <- s3cran_read_pkg_index("g6tr-cran")
idx
attr(idx, "s3_etag")
} # }