| 42333 |
ripley |
1 |
% File src/library/tools/man/writePACKAGES.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 72166 |
ripley |
3 |
% Copyright 1995-2017 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}
|
| 73574 |
hornik |
8 |
\title{Generate PACKAGES Files}
|
| 32353 |
ripley |
9 |
\description{
|
| 71801 |
hornik |
10 |
Generate \file{PACKAGES}, \file{PACKAGES.gz} and \file{PACKAGES.rds}
|
|
|
11 |
files for a repository of source or Mac/Windows binary packages.
|
| 32353 |
ripley |
12 |
}
|
|
|
13 |
\usage{
|
| 89370 |
urbaneks |
14 |
write_PACKAGES(dir = ".", fields = NULL, type,
|
| 48484 |
ripley |
15 |
verbose = FALSE, unpacked = FALSE, subdirs = FALSE,
|
| 89370 |
urbaneks |
16 |
latestOnly = TRUE, addFiles = grepl("binary", type),
|
|
|
17 |
rds_compress = "xz", validate = 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
|
| 71801 |
hornik |
22 |
\file{PACKAGES}, \file{PACKAGES.gz} and \file{PACKAGES.rds} files
|
|
|
23 |
from and write them to.
|
| 32353 |
ripley |
24 |
}
|
|
|
25 |
\item{fields}{
|
| 35028 |
hornik |
26 |
a character vector giving the fields to be used in the
|
| 71801 |
hornik |
27 |
\file{PACKAGES}, \file{PACKAGES.gz} and \file{PACKAGES.rds} files in
|
|
|
28 |
addition to the default ones, or \code{NULL} (default).
|
|
|
29 |
|
|
|
30 |
The default corresponds to
|
| 35051 |
hornik |
31 |
the fields needed by \code{\link{available.packages}}:
|
| 49135 |
hornik |
32 |
\code{"Package"}, \code{"Version"}, \code{"Priority"},
|
|
|
33 |
\code{"Depends"}, \code{"Imports"}, \code{"LinkingTo"},
|
| 49875 |
ripley |
34 |
\code{"Suggests"}, \code{"Enhances"}, \code{"OS_type"},
|
| 51549 |
ripley |
35 |
\code{"License"} and \code{"Archs"}, and those fields will always
|
|
|
36 |
be included, plus
|
| 49895 |
ripley |
37 |
the file name in field \code{"File"} if \code{addFile = TRUE}
|
|
|
38 |
and the path to the subdirectory in field \code{"Path"} if subdirectories
|
|
|
39 |
are used.
|
| 32353 |
ripley |
40 |
}
|
| 32359 |
ripley |
41 |
\item{type}{
|
| 89370 |
urbaneks |
42 |
Type of packages. It can be either \code{"source"} or the name of
|
|
|
43 |
the binary type (e.g., \code{"win.binary"} or
|
|
|
44 |
\code{"mac.binary.big-sur-x86_64"}). In addition, the value
|
|
|
45 |
\code{"binary"} corresponds to default binary type for this R build
|
|
|
46 |
(see \code{.Platform$pkgType}).
|
|
|
47 |
In R versions before 4.6.0 this argument was partially matched to
|
|
|
48 |
the choices \code{"source"}, \code{"mac.binary"} and \code{"win.binary"}
|
|
|
49 |
which is still honored, but the partial matching is now deprecated
|
|
|
50 |
to better support other binary types.
|
|
|
51 |
Currently, source and custom binary \file{.tar.\{gz,bz2,xz,zstd\}}
|
|
|
52 |
archives, legacy macOS or Windows binary (\file{.tgz} or
|
|
|
53 |
\file{.zip}, respectively) packages are supported. Defaults to
|
| 65966 |
ripley |
54 |
\code{"win.binary"} on Windows and to \code{"source"} otherwise.
|
| 32359 |
ripley |
55 |
}
|
| 35010 |
hornik |
56 |
\item{verbose}{logical. Should packages be listed as they are
|
|
|
57 |
processed?}
|
| 39597 |
hornik |
58 |
\item{unpacked}{a logical indicating whether the package contents are
|
|
|
59 |
available in unpacked form or not (default).}
|
| 44764 |
ripley |
60 |
\item{subdirs}{either logical (to indicate if subdirectories should be
|
| 73800 |
ripley |
61 |
included, recursively) or a character vector of names of subdirectories
|
|
|
62 |
to include (which are not recursed).}
|
| 48484 |
ripley |
63 |
\item{latestOnly}{logical: if multiple versions of a package are
|
|
|
64 |
available should only the latest version be included?}
|
| 49895 |
ripley |
65 |
\item{addFiles}{logical: should the filenames be included as field
|
|
|
66 |
\samp{File} in the \file{PACKAGES} file.}
|
| 72166 |
ripley |
67 |
\item{rds_compress}{The type of compression to be used for
|
| 72895 |
ripley |
68 |
\file{PACKAGES.rds}: see \code{\link{saveRDS}}. The default is the
|
| 85532 |
hornik |
69 |
one found to give maximal compression, and is as used on \abbr{CRAN}.}
|
| 78378 |
hornik |
70 |
\item{validate}{a logical indicating whether \file{DESCRIPTION} files
|
|
|
71 |
should be validated, and the corresponding packages skipped in case
|
|
|
72 |
this finds problems.}
|
| 32353 |
ripley |
73 |
}
|
|
|
74 |
\details{
|
| 53764 |
hornik |
75 |
\code{write_PACKAGES} scans the named directory for R packages,
|
|
|
76 |
extracts information from each package's \file{DESCRIPTION} file, and
|
| 71801 |
hornik |
77 |
writes this information into the \file{PACKAGES}, \file{PACKAGES.gz}
|
|
|
78 |
and \file{PACKAGES.rds} files, where the first two represent the
|
|
|
79 |
information in DCF format, and the third serializes it via
|
|
|
80 |
\code{\link{saveRDS}}.
|
| 61433 |
ripley |
81 |
|
| 48866 |
ripley |
82 |
Including non-latest versions of packages is only useful if they have
|
|
|
83 |
less constraining version requirements, so for example
|
|
|
84 |
\code{latestOnly = FALSE} could be used for a source repository when
|
| 57520 |
ripley |
85 |
\samp{foo_1.0} depends on \samp{R >= 2.15.0} but \samp{foo_0.9} is
|
|
|
86 |
available which depends on \samp{R >= 2.11.0}.
|
| 49875 |
ripley |
87 |
|
|
|
88 |
Support for repositories with subdirectories and hence for
|
| 65147 |
ripley |
89 |
\code{subdirs != FALSE} depends on recording a \code{"Path"} field in
|
| 71801 |
hornik |
90 |
the \file{PACKAGES} files.
|
| 49875 |
ripley |
91 |
|
| 66444 |
hornik |
92 |
Support for more general file names (e.g., other types of compression)
|
| 71801 |
hornik |
93 |
\emph{via} a \code{"File"} field in the \file{PACKAGES} files can be
|
| 65147 |
ripley |
94 |
used by \code{\link{download.packages}}. If the file names are not of
|
|
|
95 |
the standard form, use \code{addFiles = TRUE}.
|
| 61433 |
ripley |
96 |
|
| 35010 |
hornik |
97 |
\code{type = "win.binary"} uses \code{\link{unz}} connections to read
|
|
|
98 |
all \file{DESCRIPTION} files contained in the (zipped) binary packages
|
| 49895 |
ripley |
99 |
for Windows in the given directory \code{dir}, and builds files
|
| 71801 |
hornik |
100 |
\file{PACKAGES}, \file{PACKAGES.gz} and \file{PACKAGES.rds} files from
|
|
|
101 |
this information.
|
| 72166 |
ripley |
102 |
|
|
|
103 |
For a remote repository there is a tradeoff between download speed and
|
|
|
104 |
time spent by \code{\link{available.packages}} processing the
|
|
|
105 |
downloaded file(s). For large repositories it is likely to be
|
| 72185 |
ripley |
106 |
beneficial to use \code{rds_compress = "xz"}.
|
| 32353 |
ripley |
107 |
}
|
|
|
108 |
\value{
|
|
|
109 |
Invisibly returns the number of packages described in the resulting
|
| 71801 |
hornik |
110 |
\file{PACKAGES}, \file{PACKAGES.gz} and \file{PACKAGES.rds} files. If
|
|
|
111 |
\code{0}, no packages were found and no files were written.
|
| 32353 |
ripley |
112 |
}
|
| 32359 |
ripley |
113 |
\note{
|
| 35010 |
hornik |
114 |
Processing \file{.tar.gz} archives to extract the \file{DESCRIPTION}
|
| 32359 |
ripley |
115 |
files is quite slow.
|
| 61433 |
ripley |
116 |
|
| 32359 |
ripley |
117 |
This function can be useful on other OSes to prepare a repository to
|
| 35010 |
hornik |
118 |
be accessed by Windows machines, so \code{type = "win.binary"} should
|
| 32359 |
ripley |
119 |
work on all OSes.
|
|
|
120 |
}
|
| 32353 |
ripley |
121 |
\author{
|
| 85872 |
hornik |
122 |
\I{Uwe Ligges} and R-core.
|
| 32353 |
ripley |
123 |
}
|
|
|
124 |
\seealso{
|
|
|
125 |
See \code{\link{read.dcf}} and \code{\link{write.dcf}} for reading
|
| 35010 |
hornik |
126 |
\file{DESCRIPTION} files and writing the \file{PACKAGES} and
|
| 76358 |
lawrence |
127 |
\file{PACKAGES.gz} files. See \code{\link{update_PACKAGES}} for
|
|
|
128 |
efficiently updating existing \file{PACKAGES} and \file{PACKAGES.gz}
|
|
|
129 |
files.
|
| 32353 |
ripley |
130 |
}
|
|
|
131 |
\examples{
|
|
|
132 |
\dontrun{
|
| 32359 |
ripley |
133 |
write_PACKAGES("c:/myFolder/myRepository") # on Windows
|
| 48866 |
ripley |
134 |
write_PACKAGES("/pub/RWin/bin/windows/contrib/2.9",
|
| 61160 |
ripley |
135 |
type = "win.binary") # on Linux
|
| 32353 |
ripley |
136 |
}}
|
|
|
137 |
\keyword{file}
|
|
|
138 |
\keyword{utilities}
|