The R Project SVN R

Rev

Rev 61160 | Rev 65966 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/tools/man/writePACKAGES.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2011 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
32353 ripley 6
\name{write_PACKAGES}
56186 murdoch 7
\alias{write_PACKAGES}
35010 hornik 8
\title{Generate PACKAGES files}
32353 ripley 9
\description{
35010 hornik 10
  Generate \file{PACKAGES} and \file{PACKAGES.gz} files for a
11
  repository of source or Mac/Windows binary packages.
32353 ripley 12
}
13
\usage{
47156 ripley 14
write_PACKAGES(dir = ".", fields = NULL,
33254 ripley 15
               type = c("source", "mac.binary", "win.binary"),
48484 ripley 16
               verbose = FALSE, unpacked = FALSE, subdirs = FALSE,
49895 ripley 17
               latestOnly = TRUE, addFiles = FALSE)
32353 ripley 18
}
19
\arguments{
35010 hornik 20
  \item{dir}{Character vector describing the location of the repository
21
    (directory including source or binary packages) to generate the
22
    \file{PACKAGES} and \file{PACKAGES.gz} files from and write them to.
32353 ripley 23
  }
24
  \item{fields}{
35028 hornik 25
    a character vector giving the fields to be used in the
35051 hornik 26
    \file{PACKAGES} and \file{PACKAGES.gz} files in addition to the
27
    default ones, or \code{NULL} (default).  The default corresponds to
28
    the fields needed by \code{\link{available.packages}}:
49135 hornik 29
    \code{"Package"}, \code{"Version"}, \code{"Priority"},
30
    \code{"Depends"}, \code{"Imports"}, \code{"LinkingTo"},
49875 ripley 31
    \code{"Suggests"}, \code{"Enhances"}, \code{"OS_type"},
51549 ripley 32
    \code{"License"} and \code{"Archs"}, and those fields will always
33
    be included, plus
49895 ripley 34
    the file name in field \code{"File"} if \code{addFile = TRUE}
35
    and the path to the subdirectory in field \code{"Path"} if subdirectories
36
    are used.
32353 ripley 37
  }
32359 ripley 38
  \item{type}{
35010 hornik 39
    Type of packages: currently source \file{.tar.gz} archives, and Mac
40
    or Windows binary (\file{.tgz} or \file{.zip}, respectively)
41
    packages are supported.  Defaults to \code{"win.binary"} on Windows
42
    and to \code{"source"} otherwise.
32359 ripley 43
  }
35010 hornik 44
  \item{verbose}{logical.  Should packages be listed as they are
45
    processed?}
39597 hornik 46
  \item{unpacked}{a logical indicating whether the package contents are
47
    available in unpacked form or not (default).}
44764 ripley 48
  \item{subdirs}{either logical (to indicate if subdirectories should be
49895 ripley 49
    included, recursively) or a character vector of name of subdirectories
50
    to include.}
48484 ripley 51
  \item{latestOnly}{logical: if multiple versions of a package are
52
    available should only the latest version be included?}
49895 ripley 53
  \item{addFiles}{logical: should the filenames be included as field
54
    \samp{File} in the \file{PACKAGES} file.}
32353 ripley 55
}
56
\details{
53764 hornik 57
  \code{write_PACKAGES} scans the named directory for R packages,
58
  extracts information from each package's \file{DESCRIPTION} file, and
59
  writes this information into the \file{PACKAGES} and
60
  \file{PACKAGES.gz} files.
61433 ripley 61
 
48866 ripley 62
  Including non-latest versions of packages is only useful if they have
63
  less constraining version requirements, so for example
64
  \code{latestOnly = FALSE} could be used for a source repository when
57520 ripley 65
  \samp{foo_1.0} depends on \samp{R >= 2.15.0} but \samp{foo_0.9} is
66
  available which depends on \samp{R >= 2.11.0}.
49875 ripley 67
 
68
  Support for repositories with subdirectories and hence for
69
  \code{subdirs != FALSE} was added in \R 2.7.0: this depends on
70
  recording a \code{"Path"} field in the \file{PACKAGES} file.
71
 
72
  Support for more general file names (e.g. other types of compression)
73
  \emph{via} a \code{"File"} field in the \file{PACKAGES} file was added
49895 ripley 74
  in \R 2.10.0 and can be used by \code{\link{download.packages}}.  If
75
  the file names are not of the standard form, use
76
  \code{addFiles = TRUE}.
61433 ripley 77
 
35010 hornik 78
  \code{type = "win.binary"} uses \code{\link{unz}} connections to read
79
  all \file{DESCRIPTION} files contained in the (zipped) binary packages
49895 ripley 80
  for Windows in the given directory \code{dir}, and builds files
43623 hornik 81
  \file{PACKAGES} and \file{PACKAGES.gz} files from this information.
32353 ripley 82
}
83
\value{
84
  Invisibly returns the number of packages described in the resulting
53764 hornik 85
  \file{PACKAGES} and \file{PACKAGES.gz} files.  If \code{0}, no
86
  packages were found and no files were written.
32353 ripley 87
}
32359 ripley 88
\note{
35010 hornik 89
  Processing \file{.tar.gz} archives to extract the \file{DESCRIPTION}
32359 ripley 90
  files is quite slow.
61433 ripley 91
 
32359 ripley 92
  This function can be useful on other OSes to prepare a repository to
35010 hornik 93
  be accessed by Windows machines, so \code{type = "win.binary"} should
32359 ripley 94
  work on all OSes.
95
}
32353 ripley 96
\author{
32359 ripley 97
  Uwe Ligges and R-core.
32353 ripley 98
}
99
\seealso{
100
  See \code{\link{read.dcf}} and \code{\link{write.dcf}} for reading
35010 hornik 101
  \file{DESCRIPTION} files and writing the \file{PACKAGES} and
102
  \file{PACKAGES.gz} files.
32353 ripley 103
}
104
\examples{
105
\dontrun{
32359 ripley 106
write_PACKAGES("c:/myFolder/myRepository")  # on Windows
48866 ripley 107
write_PACKAGES("/pub/RWin/bin/windows/contrib/2.9",
61160 ripley 108
               type = "win.binary")  # on Linux
32353 ripley 109
}}
110
\keyword{file}
111
\keyword{utilities}