Currently, if one wishes to bypass any of the sanity checks that pkg_add does, one has to use -f. That's bad, because -f is a huge hammer. I've created a patch to add an option (-D, but I don't care what it's called) to override only the check that is done on updating a package to verify that the dependencies of a depending package are still satisifed by the new version of the package being updated. The intent is that only "make replace" would use this flag, and that the marking of depending packages unsafe_depends and their subsequently being rebuilt will bring a systems packages to a good state. I'm running a pkg_rollin-replace now (which has a lot to do, between png and gnome), and it's working fine. Besides adding -D, the patch below adds a missing "break;" to -C; I would appreciate confirmation that adding the break is correct. Index: mk/flavor/pkg/flavor-vars.mk =================================================================== RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/flavor-vars.mk,v retrieving revision 1.15 diff -u -p -r1.15 flavor-vars.mk --- mk/flavor/pkg/flavor-vars.mk 19 Feb 2010 14:27:36 -0000 1.15 +++ mk/flavor/pkg/flavor-vars.mk 15 Jun 2010 17:06:20 -0000 @@ -37,7 +37,7 @@ LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfar # Latest versions of tools required for correct pkgsrc operation. .if make(replace) && ${_USE_DESTDIR} != "no" -PKGTOOLS_REQD= 20100130 +PKGTOOLS_REQD= 20100615 .else PKGTOOLS_REQD= 20090528 .endif Index: pkgtools/pkg_install/files/add/add.h =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/add.h,v retrieving revision 1.18 diff -u -p -r1.18 add.h --- pkgtools/pkg_install/files/add/add.h 30 Jan 2010 20:09:34 -0000 1.18 +++ pkgtools/pkg_install/files/add/add.h 15 Jun 2010 17:06:20 -0000 @@ -40,6 +40,7 @@ extern int Replace; extern int ReplaceSame; extern Boolean ForceDepends; +extern Boolean ForceDepending; int make_hierarchy(char *); void apply_perms(char *, char **, int); Index: pkgtools/pkg_install/files/add/main.c =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/main.c,v retrieving revision 1.25 diff -u -p -r1.25 main.c --- pkgtools/pkg_install/files/add/main.c 18 Feb 2010 13:43:11 -0000 1.25 +++ pkgtools/pkg_install/files/add/main.c 15 Jun 2010 17:06:20 -0000 @@ -39,7 +39,7 @@ __RCSID("$NetBSD: main.c,v 1.25 2010/02/ #include "lib.h" #include "add.h" -static char Options[] = "AIK:LP:RVW:fhm:np:t:Uuvw:"; +static char Options[] = "ADIK:LP:RVW:fhm:np:t:Uuvw:"; char *Destdir = NULL; char *OverrideMachine = NULL; @@ -51,6 +51,12 @@ Boolean NoInstall = FALSE; Boolean NoRecord = FALSE; Boolean Automatic = FALSE; Boolean ForceDepends = FALSE; +/* + * Normally, updating fails if the dependencies of a depending package + * are not satisfied by the package to be updated. ForceDepending + * turns that failure into a warning. + */ +Boolean ForceDepending = FALSE; int LicenseCheck = 0; int Replace = 0; @@ -82,7 +88,11 @@ main(int argc, char **argv) case 'C': config_file = optarg; + break; + case 'D': + ForceDepending = TRUE; + case 'P': Destdir = optarg; break; @@ -90,6 +100,7 @@ main(int argc, char **argv) case 'f': Force = TRUE; ForceDepends = TRUE; + ForceDepending = TRUE; break; case 'I': Index: pkgtools/pkg_install/files/add/perform.c =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/perform.c,v retrieving revision 1.96 diff -u -p -r1.96 perform.c --- pkgtools/pkg_install/files/add/perform.c 14 Apr 2010 18:24:58 -0000 1.96 +++ pkgtools/pkg_install/files/add/perform.c 15 Jun 2010 17:06:20 -0000 @@ -458,7 +458,7 @@ check_other_installed(struct pkg_task *p continue; /* Both match, ok. */ warnx("Dependency of %s fulfilled by %s, but not by %s", iter, pkg->other_version, pkg->pkgname); - if (!Force) + if (!ForceDepending) status = -1; break; } Index: pkgtools/pkg_install/files/add/pkg_add.1 =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/pkg_add.1,v retrieving revision 1.43 diff -u -p -r1.43 pkg_add.1 --- pkgtools/pkg_install/files/add/pkg_add.1 18 Feb 2010 13:43:11 -0000 1.43 +++ pkgtools/pkg_install/files/add/pkg_add.1 15 Jun 2010 17:06:20 -0000 @@ -125,6 +125,11 @@ will still try to find and auto-install a failure to find one will not be fatal. This flag also overrides the fatal error when the operating system or architecture the package was built on differ from that of the host. +.It Fl D +Force updating even if the dependencies of depending packages are not +satisfied by the new package. +This is used by "make replace", after which one would typically +replace the depending packages. .It Fl I If an installation script exists for a given package, do not execute it. .It Fl K Ar pkg_dbdir Index: pkgtools/pkg_install/files/add/pkg_add.cat =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/pkg_add.cat,v retrieving revision 1.3 diff -u -p -r1.3 pkg_add.cat --- pkgtools/pkg_install/files/add/pkg_add.cat 18 Feb 2010 13:43:47 -0000 1.3 +++ pkgtools/pkg_install/files/add/pkg_add.cat 15 Jun 2010 17:06:21 -0000 @@ -60,6 +60,11 @@ OOPPTTIIOONNSS rides the fatal error when the operating system or architecture the package was built on differ from that of the host. + --DD Force updating even if the dependencies of depending packages are + not satisfied by the new package. This is used by "make + replace", after which one would typically replace the depending + packages. + --II If an installation script exists for a given package, do not exe- cute it. @@ -262,4 +267,4 @@ BBUUGGSS Sure to be others. -NetBSD 5.0 February 18, 2010 NetBSD 5.0 +NetBSD 5.1_RC2 February 18, 2010 NetBSD 5.1_RC2 Index: pkgtools/pkg_install/files/lib/version.h =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/lib/version.h,v retrieving revision 1.155 diff -u -p -r1.155 version.h --- pkgtools/pkg_install/files/lib/version.h 20 Apr 2010 21:22:38 -0000 1.155 +++ pkgtools/pkg_install/files/lib/version.h 15 Jun 2010 17:06:21 -0000 @@ -27,6 +27,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION 20100421 +#define PKGTOOLS_VERSION 20100615 #endif /* _INST_LIB_VERSION_H_ */ After -D is available, I have the following patch to the replace code ready to commit: Index: mk/flavor/pkg/replace.mk =================================================================== RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/replace.mk,v retrieving revision 1.29 diff -u -p -r1.29 replace.mk --- mk/flavor/pkg/replace.mk 12 Jun 2010 00:53:43 -0000 1.29 +++ mk/flavor/pkg/replace.mk 15 Jun 2010 17:06:20 -0000 @@ -183,23 +183,23 @@ replace-clean: .PHONY # Logically we would like to do a "pkg_add -U". However, that fails # if there is a depending package that exactly depends on the package -# being replaced. Historically, 'make replace' would replace a -# package regardless of whether that broke depending packages -# (typically due to shlib ABI changes, especially major version -# bumps). Therefore, make replace in DESTDIR mode should behave the -# same way. unsafe_depends will be set on depending packages, and -# then those may be rebuilt via a manual process or by -# pkg_rolling-replace. +# being replaced, so we override that check with -D. Historically, +# 'make replace' would replace a package regardless of whether that +# broke depending packages (typically due to shlib ABI changes, +# especially major version bumps). Therefore, make replace in DESTDIR +# mode should behave the same way. unsafe_depends will be set on +# depending packages, and then those may be rebuilt via a manual +# process or by pkg_rolling-replace. replace-destdir: .PHONY @${PHASE_MSG} "Updating using binary package of "${PKGNAME:Q} .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) @${MKDIR} ${_CROSS_DESTDIR}${PREFIX} - ${PKG_ADD} -U -f -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${PKGFILE} + ${PKG_ADD} -U -D -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${PKGFILE} @${ECHO} "Fixing recorded cwd..." @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS .else - ${PKG_ADD} -U -f ${PKGFILE} + ${PKG_ADD} -U -D ${PKGFILE} .endif ${RUN}${_REPLACE_OLDNAME_CMD}; \ ${PKG_INFO} -qR ${PKGNAME:Q} | while read pkg; do \
Attachment:
pgpOYUXQt2_0s.pgp
Description: PGP signature