Sun Jun 8 17:29:01 2008 UTC ()
Add example showing how to mark all packages depdending on X11 for
rebuild, useful for moving to X11_TYPE=modular.  From tnn@.


(gdt)
diff -r1.19 -r1.20 pkgsrc/pkgtools/pkg_rolling-replace/Makefile
diff -r1.12 -r1.13 pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8

cvs diff -r1.19 -r1.20 pkgsrc/pkgtools/pkg_rolling-replace/Makefile (switch to unified diff)

--- pkgsrc/pkgtools/pkg_rolling-replace/Makefile 2008/05/02 19:04:03 1.19
+++ pkgsrc/pkgtools/pkg_rolling-replace/Makefile 2008/06/08 17:29:01 1.20
@@ -1,77 +1,78 @@ @@ -1,77 +1,78 @@
1# $NetBSD: Makefile,v 1.19 2008/05/02 19:04:03 apb Exp $ 1# $NetBSD: Makefile,v 1.20 2008/06/08 17:29:01 gdt Exp $
2 2
3DISTNAME= pkg_rolling-replace-0.16 3DISTNAME= pkg_rolling-replace-0.16
 4PKGREVISION= 1
4CATEGORIES= pkgtools 5CATEGORIES= pkgtools
5MASTER_SITES= # empty 6MASTER_SITES= # empty
6DISTFILES= # empty 7DISTFILES= # empty
7 8
8MAINTAINER= ngoffee@bbn.com 9MAINTAINER= ngoffee@bbn.com
9COMMENT= Replace/upgrade packages in-place 10COMMENT= Replace/upgrade packages in-place
10 11
11DEPENDS+= pkg_chk>=1.76:../../pkgtools/pkg_chk 12DEPENDS+= pkg_chk>=1.76:../../pkgtools/pkg_chk
12DEPENDS+= pkg_tarup>=1.6.6:../../pkgtools/pkg_tarup 13DEPENDS+= pkg_tarup>=1.6.6:../../pkgtools/pkg_tarup
13 14
14PKG_INSTALLATION_TYPES= overwrite pkgviews 15PKG_INSTALLATION_TYPES= overwrite pkgviews
15 16
16USE_TOOLS+= patch 17USE_TOOLS+= patch
17 18
18WRKSRC= ${WRKDIR} 19WRKSRC= ${WRKDIR}
19NO_CHECKSUM= yes 20NO_CHECKSUM= yes
20NO_BUILD= yes 21NO_BUILD= yes
21USE_LANGUAGES= # none 22USE_LANGUAGES= # none
22 23
23INSTALLATION_DIRS= sbin ${PKGMANDIR}/man8 24INSTALLATION_DIRS= sbin ${PKGMANDIR}/man8
24 25
25PKG_CHK?= ${PREFIX}/sbin/pkg_chk 26PKG_CHK?= ${PREFIX}/sbin/pkg_chk
26 27
27SUBST_CLASSES+= tools 28SUBST_CLASSES+= tools
28SUBST_STAGE.tools= pre-configure 29SUBST_STAGE.tools= pre-configure
29SUBST_MESSAGE.tools= Substituting tool locations. 30SUBST_MESSAGE.tools= Substituting tool locations.
30SUBST_FILES.tools= pkg_rolling-replace.sh 31SUBST_FILES.tools= pkg_rolling-replace.sh
31SUBST_VARS.tools= PKG_INFO_CMD MAKE PKG_CHK AWK 32SUBST_VARS.tools= PKG_INFO_CMD MAKE PKG_CHK AWK
32 33
33SUBST_CLASSES+= prefix 34SUBST_CLASSES+= prefix
34SUBST_STAGE.prefix= pre-configure 35SUBST_STAGE.prefix= pre-configure
35SUBST_MESSAGE.prefix= Substituting PREFIX location. 36SUBST_MESSAGE.prefix= Substituting PREFIX location.
36SUBST_FILES.prefix= pkg_rolling-replace.8 37SUBST_FILES.prefix= pkg_rolling-replace.8
37SUBST_VARS.prefix= PREFIX 38SUBST_VARS.prefix= PREFIX
38 39
39SUBST_CLASSES+= makeconf 40SUBST_CLASSES+= makeconf
40SUBST_STAGE.makeconf= pre-configure 41SUBST_STAGE.makeconf= pre-configure
41SUBST_MESSAGE.makeconf= Recording default path of mk.conf. 42SUBST_MESSAGE.makeconf= Recording default path of mk.conf.
42SUBST_FILES.makeconf= pkg_rolling-replace.sh pkg_rolling-replace.8 43SUBST_FILES.makeconf= pkg_rolling-replace.sh pkg_rolling-replace.8
43SUBST_SED.makeconf= -e 's,@MAKECONF@,${MAKE:T:Mbmake:S/bmake/${PREFIX}/g}/etc/mk.conf,g' 44SUBST_SED.makeconf= -e 's,@MAKECONF@,${MAKE:T:Mbmake:S/bmake/${PREFIX}/g}/etc/mk.conf,g'
44 45
45REPLACE_SH+= pkg_rolling-replace.sh 46REPLACE_SH+= pkg_rolling-replace.sh
46 47
47.include "../../mk/bsd.prefs.mk" 48.include "../../mk/bsd.prefs.mk"
48 49
49# target exists only to force check-pkgsrc-patch prior to install 50# target exists only to force check-pkgsrc-patch prior to install
50do-extract: check-pkgsrc-patch 51do-extract: check-pkgsrc-patch
51 cp ${FILESDIR}/pkg_rolling-replace.sh ${WRKSRC} 52 cp ${FILESDIR}/pkg_rolling-replace.sh ${WRKSRC}
52 cp ${FILESDIR}/pkg_rolling-replace.8 ${WRKSRC} 53 cp ${FILESDIR}/pkg_rolling-replace.8 ${WRKSRC}
53 54
54do-install: check-pkgsrc-patch 55do-install: check-pkgsrc-patch
55 ${INSTALL_SCRIPT} ${WRKSRC}/pkg_rolling-replace.sh \ 56 ${INSTALL_SCRIPT} ${WRKSRC}/pkg_rolling-replace.sh \
56 ${PREFIX}/sbin/pkg_rolling-replace 57 ${PREFIX}/sbin/pkg_rolling-replace
57 ${INSTALL_MAN} ${WRKSRC}/pkg_rolling-replace.8 \ 58 ${INSTALL_MAN} ${WRKSRC}/pkg_rolling-replace.8 \
58 ${PREFIX}/${PKGMANDIR}/man8/pkg_rolling-replace.8 59 ${PREFIX}/${PKGMANDIR}/man8/pkg_rolling-replace.8
59 60
60check-pkgsrc-patch: 61check-pkgsrc-patch:
61 @${ECHO_N} "=> Checking for unsafe_depends support in pkgsrc..."; \ 62 @${ECHO_N} "=> Checking for unsafe_depends support in pkgsrc..."; \
62 REPLACE_MK="${PKGSRCDIR}/mk/flavor/pkg/replace.mk"; \ 63 REPLACE_MK="${PKGSRCDIR}/mk/flavor/pkg/replace.mk"; \
63 if [ -f "$$REPLACE_MK" ]; then \ 64 if [ -f "$$REPLACE_MK" ]; then \
64 if [ "`${EGREP} unsafe_depends=YES $$REPLACE_MK`" ]; then \ 65 if [ "`${EGREP} unsafe_depends=YES $$REPLACE_MK`" ]; then \
65 ${ECHO} "found."; \ 66 ${ECHO} "found."; \
66 ${TRUE}; \ 67 ${TRUE}; \
67 else \ 68 else \
68 ${ECHO}; \ 69 ${ECHO}; \
69 ${ECHO} "*** pkg_rolling replace requires pkgsrc>=2006Q3" \ 70 ${ECHO} "*** pkg_rolling replace requires pkgsrc>=2006Q3" \
70 ${FALSE}; \ 71 ${FALSE}; \
71 fi; \ 72 fi; \
72 else \ 73 else \
73 ${ECHO} "*** pkg_rolling replace requires pkgsrc>=2006Q3"; \ 74 ${ECHO} "*** pkg_rolling replace requires pkgsrc>=2006Q3"; \
74 ${FALSE}; \ 75 ${FALSE}; \
75 fi 76 fi
76 77
77.include "../../mk/bsd.pkg.mk" 78.include "../../mk/bsd.pkg.mk"

cvs diff -r1.12 -r1.13 pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 (switch to unified diff)

--- pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 2008/05/22 13:48:36 1.12
+++ pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 2008/06/08 17:29:01 1.13
@@ -1,176 +1,183 @@ @@ -1,176 +1,183 @@
1.\" $NetBSD: pkg_rolling-replace.8,v 1.12 2008/05/22 13:48:36 tnn Exp $ 1.\" $NetBSD: pkg_rolling-replace.8,v 1.13 2008/06/08 17:29:01 gdt Exp $
2.Dd May 22, 2008 2.Dd May 22, 2008
3.Dt PKG_ROLLING-REPLACE 8 3.Dt PKG_ROLLING-REPLACE 8
4.Os 4.Os
5.Sh NAME 5.Sh NAME
6.Nm pkg_rolling-replace 6.Nm pkg_rolling-replace
7.Nd rebuild or update packages using 'make replace' in tsorted order 7.Nd rebuild or update packages using 'make replace' in tsorted order
8.Sh SYNOPSIS 8.Sh SYNOPSIS
9.Nm 9.Nm
10.Op Fl hnrsuv 10.Op Fl hnrsuv
11.Op Fl x Ar pkgs 11.Op Fl x Ar pkgs
12.Op Fl X Ar pkgs 12.Op Fl X Ar pkgs
13.Sh DESCRIPTION 13.Sh DESCRIPTION
14.Nm 14.Nm
15runs 15runs
16.Dq make replace 16.Dq make replace
17on packages that have been marked to have unsafe dependencies or have 17on packages that have been marked to have unsafe dependencies or have
18been marked to be rebuilt. 18been marked to be rebuilt.
19Optionally it can replace any outdated packages (as reported by 19Optionally it can replace any outdated packages (as reported by
20.Xr pkg_chk 8 ) 20.Xr pkg_chk 8 )
21as well. 21as well.
22.Pp 22.Pp
23Whenever 23Whenever
24.Dq make replace 24.Dq make replace
25is run on a package, all installed packages 25is run on a package, all installed packages
26that depend on it are marked with the 26that depend on it are marked with the
27.Dq unsafe_depends_strict=YES 27.Dq unsafe_depends_strict=YES
28flag. 28flag.
29If the version of the replaced package has changed, this indicates 29If the version of the replaced package has changed, this indicates
30that it may no longer be ABI-compatible so 30that it may no longer be ABI-compatible so
31.Dq unsafe_depends=YES 31.Dq unsafe_depends=YES
32is also set for all packages that depend on it. 32is also set for all packages that depend on it.
33Running 33Running
34.Nm 34.Nm
35with no arguments will restore such packages to a safe state by 35with no arguments will restore such packages to a safe state by
36building a dependency graph, running 36building a dependency graph, running
37.Xr tsort 1 37.Xr tsort 1
38on it, and running 38on it, and running
39.Dq make replace 39.Dq make replace
40in the resulting topological order. 40in the resulting topological order.
41The dependency graph and topological sort are re-calculated after each 41The dependency graph and topological sort are re-calculated after each
42.Dq make replace , 42.Dq make replace ,
43in case it causes additional packages to be marked unsafe. 43in case it causes additional packages to be marked unsafe.
44.Pp 44.Pp
45The user can mark additional packages to be rebuilt by setting the 45The user can mark additional packages to be rebuilt by setting the
46.Dq rebuild=YES 46.Dq rebuild=YES
47flag on them using the command 47flag on them using the command
48.Dl % pkg_admin set rebuild=YES Aq pkg 48.Dl % pkg_admin set rebuild=YES Aq pkg
49.Pp 49.Pp
50If the 50If the
51.Fl u 51.Fl u
52option is given, 52option is given,
53.Nm 53.Nm
54will use 54will use
55.Xr pkg_chk 8 55.Xr pkg_chk 8
56to check for packages for which the version in pkgsrc is different 56to check for packages for which the version in pkgsrc is different
57than the installed version, and run 57than the installed version, and run
58.Dq make replace 58.Dq make replace
59on those packages as well (tsorting them along with the unsafe/rebuild 59on those packages as well (tsorting them along with the unsafe/rebuild
60packages). 60packages).
61(Usually this results in packages being upgraded to newer versions, 61(Usually this results in packages being upgraded to newer versions,
62assuming the pkgsrc tree is more recent than the currently installed 62assuming the pkgsrc tree is more recent than the currently installed
63packages.) 63packages.)
64.Ss Options 64.Ss Options
65.Bl -tag -width xxxxxxxx 65.Bl -tag -width xxxxxxxx
66.It Fl h 66.It Fl h
67Brief help. 67Brief help.
68.It Fl n 68.It Fl n
69Display actions that would be taken, but don't actually run 69Display actions that would be taken, but don't actually run
70.Dq make replace 70.Dq make replace
71or change any flags on installed packages. 71or change any flags on installed packages.
72This option attempts to calculate the new packages that would be 72This option attempts to calculate the new packages that would be
73marked unsafe after each 73marked unsafe after each
74.Dq make replace . 74.Dq make replace .
75.It Fl r 75.It Fl r
76Just replace packages, do not build binary packages. 76Just replace packages, do not build binary packages.
77.It Fl s 77.It Fl s
78Enable strict mode. 78Enable strict mode.
79This makes 79This makes
80.Nm 80.Nm
81look at 81look at
82.Dq unsafe_depends_strict 82.Dq unsafe_depends_strict
83tags instead of 83tags instead of
84.Dq unsafe_depends 84.Dq unsafe_depends
85tags. 85tags.
86This will replace packages more aggressively and can be used to solve 86This will replace packages more aggressively and can be used to solve
87shared library problems. 87shared library problems.
88.It Fl u 88.It Fl u
89Use 89Use
90.Xl pkg_chk 8 90.Xl pkg_chk 8
91to check for outdated packages, and replace those too. 91to check for outdated packages, and replace those too.
92.It Fl v 92.It Fl v
93Verbose output. 93Verbose output.
94.It Fl x Ar pkgs 94.It Fl x Ar pkgs
95Exclude the comma-separated list of package base names 95Exclude the comma-separated list of package base names
96from the check for outdated packages. 96from the check for outdated packages.
97This has no effect if the 97This has no effect if the
98.Fl u 98.Fl u
99flag is not given, 99flag is not given,
100and does not prevent packages from being rebuilt for any other reason 100and does not prevent packages from being rebuilt for any other reason
101(such as being a dependency of another package that is also rebuilt, 101(such as being a dependency of another package that is also rebuilt,
102or having any of the 102or having any of the
103.Xr pkg_admin 8 103.Xr pkg_admin 8
104.Dq unsafe_depends , 104.Dq unsafe_depends ,
105.Dq unsafe_depends_strict , 105.Dq unsafe_depends_strict ,
106or 106or
107.Dq rebuild 107.Dq rebuild
108variables set to 108variables set to
109.Dq YES ) . 109.Dq YES ) .
110.It Fl X Ar pkgs 110.It Fl X Ar pkgs
111Exclude the comma-separated list of package base names 111Exclude the comma-separated list of package base names
112from being rebuilt for any reason. 112from being rebuilt for any reason.
113.El 113.El
114.Sh EXAMPLES 114.Sh EXAMPLES
115.Pp 115.Pp
116To update all packages on the system and ensure correct shared library 116To update all packages on the system and ensure correct shared library
117dependencies: 117dependencies:
118.Bd -literal -offset indent 118.Bd -literal -offset indent
119pkg_rolling-replace -rsuv 119pkg_rolling-replace -rsuv
120.Ed 120.Ed
121.Pp 121.Pp
122To update all packages on the system, do as little rebuilding as possible, 122To update all packages on the system, do as little rebuilding as possible,
123and also produce binary packages: 123and also produce binary packages:
124.Bd -literal -offset indent 124.Bd -literal -offset indent
125pkg_rolling-replace -uv 125pkg_rolling-replace -uv
126.Ed 126.Ed
127.Pp 127.Pp
128To update gtk2+ and all packages that depend on it, except openoffice2: 128To update gtk2+ and all packages that depend on it, except openoffice2:
129.Bd -literal -offset indent 129.Bd -literal -offset indent
130pkg_admin set rebuild=YES gtk2+ 130pkg_admin set rebuild=YES gtk2+
131pkg_rolling-replace -rsv -X openoffice2 131pkg_rolling-replace -rsv -X openoffice2
132.Ed 132.Ed
 133.Pp
 134To mark all packages that compiled against X11 as needing rebuild
 135(used after switching to X11_TYPE=modular):
 136.Bd -literal -offset indent
 137cd /var/db/pkg && grep "blddep x11-links" */* | cut -d/ -f1 | \\
 138sort -u | xargs pkg_admin set rebuild=YES
 139.Ed
133.Sh ENVIRONMENT 140.Sh ENVIRONMENT
134.Nm 141.Nm
135uses the following environment variables. 142uses the following environment variables.
136.Bl -tag -width xxxx 143.Bl -tag -width xxxx
137.It Ev MAKECONF 144.It Ev MAKECONF
138Path to 145Path to
139.Pa mk.conf . 146.Pa mk.conf .
140Defaults to 147Defaults to
141.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf , 148.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
142or 149or
143.Pa /etc/mk.conf . 150.Pa /etc/mk.conf .
144.It Ev PKGSRCDIR 151.It Ev PKGSRCDIR
145Base of pkgsrc tree. 152Base of pkgsrc tree.
146If not set in the environment, then this variable is read from 153If not set in the environment, then this variable is read from
147.Pa ${MAKECONF} . 154.Pa ${MAKECONF} .
148If it is still not set, and if the current working directory 155If it is still not set, and if the current working directory
149appears to be inside a pkgsrc tree, then this variable 156appears to be inside a pkgsrc tree, then this variable
150is set to the base of that pkgsrc tree. 157is set to the base of that pkgsrc tree.
151Finally, if 158Finally, if
152.Pa /usr/pkgsrc 159.Pa /usr/pkgsrc
153appears to contain a pkgsrc tree, then that is used as a last resort. 160appears to contain a pkgsrc tree, then that is used as a last resort.
154.It Ev PKG_DBDIR 161.It Ev PKG_DBDIR
155pkgsrc database directory. 162pkgsrc database directory.
156If not set in environment then defaults to 163If not set in environment then defaults to
157.Pa /var/db/pkg . 164.Pa /var/db/pkg .
158.El 165.El
159.Sh AUTHORS 166.Sh AUTHORS
160.An -nosplit 167.An -nosplit
161.An Nick Goffee 168.An Nick Goffee
162.Aq ngoffee@bbn.com , 169.Aq ngoffee@bbn.com ,
163with initial idea and many suggestions from 170with initial idea and many suggestions from
164.An Greg Troxel 171.An Greg Troxel
165.Aq gdt@ir.bbn.com . 172.Aq gdt@ir.bbn.com .
166The options 173The options
167.Fl s 174.Fl s
168and 175and
169.Fl r 176.Fl r
170were added by 177were added by
171.An Tobias Nygren 178.An Tobias Nygren
172.Aq tnn@NetBSD.org . 179.Aq tnn@NetBSD.org .
173.Sh BUGS 180.Sh BUGS
174.Nm 181.Nm
175does not run fully automatically when any significant number of 182does not run fully automatically when any significant number of
176packages need to be replaced. 183packages need to be replaced.