summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
blob: 8db973d58f995255d7ac2a6c8aa83224911c5a18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
.\" $NetBSD: pkg_rolling-replace.8,v 1.17 2010/02/01 09:33:21 sno Exp $
.Dd February 1, 2010
.Dt PKG_ROLLING-REPLACE 8
.Os
.Sh NAME
.Nm pkg_rolling-replace
.Nd rebuild or update packages using 'make replace' in tsorted order
.Sh SYNOPSIS
.Nm
.Op Fl hFknrsuv
.Op Fl D Ar bool
.Op Fl j Ar jobs
.Op Fl L Ar path
.Op Fl X Ar pkgs
.Op Fl x Ar pkgs
.Sh DESCRIPTION
.Nm
runs
.Dq make replace
on packages that have been marked to have unsafe dependencies or have
been marked to be rebuilt.
Optionally it can replace any outdated packages (as reported by
.Xr pkg_chk 8 )
as well.
.Pp
Whenever
.Dq make replace
is run on a package, all installed packages
that depend on it are marked with the
.Dq unsafe_depends_strict=YES
flag.
If the version of the replaced package has changed, this indicates
that it may no longer be ABI-compatible so
.Dq unsafe_depends=YES
is also set for all packages that depend on it.
Running
.Nm
with no arguments will restore such packages to a safe state by
building a dependency graph, running
.Xr tsort 1
on it, and running
.Dq make replace
in the resulting topological order.
The dependency graph and topological sort are re-calculated after each
.Dq make replace ,
in case it causes additional packages to be marked unsafe.
.Pp
The user can mark additional packages to be rebuilt by setting the
.Dq rebuild=YES
flag on them using the command
.Dl % pkg_admin set rebuild=YES Aq pkg
.Pp
If the
.Fl u
option is given,
.Nm
will use
.Xr pkg_chk 8
to check for packages for which the version in pkgsrc is different
than the installed version, and run
.Dq make replace
on those packages as well (tsorting them along with the unsafe/rebuild
packages).
(Usually this results in packages being upgraded to newer versions,
assuming the pkgsrc tree is more recent than the currently installed
packages.)
.Ss Options
.Bl -tag -width xxxxxxxx
.It Fl h
Brief help.
.It Fl F
Just fetches the sources of all mismatched packages required to be updated
(and it's dependencies).
.It Fl k
Keep on going, even on error during handling current package.
Warning: This could (potential will) rebuild package depending
on the failed package, anyway. This may cause a broken tree.
Use with caution!
.It Fl j Ar jobs
Enables a pkgsrc tunable (MAKE_JOBS=<n>) to allow parallel build while
compiling a package. It's unset by default.
.It Fl n
Display actions that would be taken, but don't actually run
.Dq make replace
or change any flags on installed packages.
This option attempts to calculate the new packages that would be
marked unsafe after each
.Dq make replace .
.It Fl r
Just replace packages, do not build binary packages.
.It Fl s
Enable strict mode.
This makes
.Nm
look at
.Dq unsafe_depends_strict
tags instead of
.Dq unsafe_depends
tags.
This will replace packages more aggressively and can be used to solve
shared library problems.
.It Fl u
Use
.Xl pkg_chk 8
to check for outdated packages, and replace those too.
.It Fl v
Verbose output.
.It Fl D Ar bool
Sets the
.Dq USE_DESTDIR=<bool>
for the given bool. The default value is
.Dq NO
to ensure the same behaviour for pkgsrc developers when the act as users
and update their system. To disable the default behaviour, use
.Dq OFF
as value for the
.Dq -D
parameter.
.It Fl L Ar path
Logs each build (each command output from the commands which are run for
packages) to given path. The full log file name is composed from the path
given by this argument, the category name of the package and the package
name:
.Dq given-path/category/pkgname .
The specified path must exists and being user writable of the invoking
user or any parent directory must be writable by the invoking user.
Potentially existing log in the same file name will be overwritten.
.It Fl X Ar pkgs
Exclude the comma-separated list of package base names
from being rebuilt for any reason.
.It Fl x Ar pkgs
Exclude the comma-separated list of package base names
from the check for outdated packages.
This has no effect if the
.Fl u
flag is not given,
and does not prevent packages from being rebuilt for any other reason
(such as being a dependency of another package that is also rebuilt,
or having any of the
.Xr pkg_admin 1
.Dq unsafe_depends ,
.Dq unsafe_depends_strict ,
or
.Dq rebuild
variables set to
.Dq YES ) .
.El
.Sh ENVIRONMENT
.Nm
uses the following environment variables.
.Bl -tag -width xxxx
.It Ev MAKECONF
Path to
.Pa mk.conf .
Defaults to
.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
or
.Pa /etc/mk.conf .
.It Ev PKGSRCDIR
Base of pkgsrc tree.
If not set in the environment, then this variable is read from
.Pa ${MAKECONF} .
If it is still not set, and if the current working directory
appears to be inside a pkgsrc tree, then this variable
is set to the base of that pkgsrc tree.
Finally, if
.Pa /usr/pkgsrc
appears to contain a pkgsrc tree, then that is used as a last resort.
.It Ev PKG_DBDIR
pkgsrc database directory.
If not set in environment then defaults to
.Pa /var/db/pkg .
.El
.Sh EXAMPLES
To update all packages on the system and ensure correct shared library
dependencies:
.Bd -literal -offset indent
pkg_rolling-replace -rsuv
.Ed
.Pp
To update all packages on the system, do as little rebuilding as possible,
and also produce binary packages:
.Bd -literal -offset indent
pkg_rolling-replace -uv
.Ed
.Pp
To fetch all distfiles for the packages requiring an update on the system
(packages with different version numbers than installed), and exit after it:
.Bd -literal -offset indent
pkg_rolling-replace -F
.Ed
.Pp
To update gtk2+ and all packages that depend on it, except openoffice2:
.Bd -literal -offset indent
pkg_admin set rebuild=YES gtk2+
pkg_rolling-replace -rsv -X openoffice2
.Ed
.Pp
To force rebuild of gtk2+ and all packages that depend on it, keep
going on even if one package fails, except openoffice2 - log to
.Dq /var/log/pkg_rr :
.Bd -literal -offset indent
pkg_admin set rebuild=YES gtk2+
pkg_rolling-replace -krsv -L /var/log/pkg_rr -X openoffice2
.Ed
.Pp
To mark all packages that compiled against X11 as needing rebuild
(used after switching to X11_TYPE=modular):
.Bd -literal -offset indent
cd /var/db/pkg \*[Am]\*[Am] grep "blddep x11-links" */* | cut -d/ -f1 | \\
sort -u | xargs pkg_admin set rebuild=YES
.Ed
.Sh AUTHORS
.An -nosplit
.An Nick Goffee
.Aq ngoffee@bbn.com ,
with initial idea and many suggestions from
.An Greg Troxel
.Aq gdt@ir.bbn.com .
The options
.Fl s
and
.Fl r
were added by
.An Tobias Nygren
.Aq tnn@NetBSD.org .
The options
.Fl k ,
.Fl j ,
.Fl D ,
.Fl F
and
.Fl L
were added by
.An Jens Rehsack
.Aq sno@NetBSD.org .
.Sh BUGS
.Nm
does not run fully automatically when any significant number of
packages need to be replaced.
.Pp
.Nm
does not run fully automatically when the PKGNAME of a package
changes.