archive.packages: Deal with old packages in your local repository

View source: R/archive.packages.R

archive.packagesR Documentation

Deal with old packages in your local repository

Description

Use this function to move older versions of a package to a specified archive directory, or remove them completely.

Usage

archive.packages(
  repo.root,
  to.dir = "Archive",
  keep = 1,
  keep.revisions = 2,
  package = NULL,
  type = "source",
  archive.root = repo.root,
  overwrite = FALSE,
  reallyDoIt = FALSE,
  graceful = FALSE,
  deb.options = list(distribution = "unstable", component = "main", gpg.version = 2,
    gpg.key = NULL, keyring = NULL, deb.dir = "deb")
)

Arguments

repo.root

Path to the repository root, i.e., the directory which contains the src and bin directories. Usually this path should start with "file:///".

to.dir

Character string, name of the folder to move the old packages to.

keep

An integer value defining the maximum nuber of versions to keep. Setting this to 0 will completely remove all packages from the repository, which is probably only useful in combination with the option package.

keep.revisions

An integer value defining the maximum nuber of revisions to keep. This is only used when archiving Debian packages, i.e., if type includes "deb". Setting this to 0 or NULL will keep all revisions of package versions that are to be kept.

package

A character vector with package names to check. If set, archive.packages will only take actions on these packages. If NULL, all packages are affected.

type

A character vector defining the package formats to keep. Valid entries are "source", "win.binary", "mac.binary", and "deb". By default, only the source packages are archived, all other packages are deleted, except for Debian repos, which currently can only be archived or be left as is.

archive.root

Path to the archive root, i.e., the directory to which files should be moved. Usually the Archive is kept in repo.root.

overwrite

Logical, indicates whether existing files in the archive can be overwritten.

reallyDoIt

Logical, real actions are only taken if set to TRUE, otherwise the actions are only printed.

graceful

Logical, if TRUE the process will not freak out because of missing files. Use this for instance if you deleted files from the repo but did not update the package indices.

deb.options

A named list of options that must be properly set if you want to archive Debian packages. After packages were removed from the repo, all Packages, Sources and Release files must be re-written and signed, and all of the following information is required: distribution, component, gpg.key, keyring (which might be NULL), and deb.dir. If you omit gpg.version, version 2 is assumed by default. See debianize for details.

Note

This function responds to sandbox.

See Also

sandbox to run archive.packages() in a sandbox.

Examples

## Not run: 
# dry run, only prints what would happen, so you can check
# if that's really what you want
archive.packages("file:///var/www/repo")

# after we've confirmed that the right packages will be moved
# and deleted, let's actually commit the changes
archive.packages("file:///var/www/repo", reallyDoIt=TRUE)

# if we don't want a standard archive, but for instance a parallel
# archive repository, we can have it. let's move all but the latest two
# versions from /var/www/repo to /var/www/archive. to suppress the
# creation of a special archive directory, we set to.dir=""
archive.packages("file:///var/www/repo", to.dir="", keep=2,
  type=c("source", "win.binary", "mac.binary"),
  archive.root="/var/www/archive", reallyDoIt=TRUE)

## End(Not run)

unDocUMeantIt/roxyPackage documentation built on March 9, 2023, 6:31 p.m.