Subject: making 'make replace' safer
To: None <tech-pkg@NetBSD.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-pkg
Date: 07/16/2006 08:28:00
--=-=-=
Content-Transfer-Encoding: quoted-printable


Currently, both 'make replace' and 'make update' are problematic, with
different failure mechanisms - make replace violates safety properties
and make update liveness properties, compared to a notion that
installed packages should always be correct and present.

Nick Goffee has been working on a scheme to make make replace safer,
based on an idea from me.  I'm writing to explain the big picture and
ask if it's ok to commit the first step.

The basic problem with make replace is that an ABI can change, and
thus the packges that depend on the replaced packages can fail to
work.  The nice thing is that this is fairly rare.  The basic idea is
to keep track of such issues, and systematically repair them.

1. make replace will mark depending packages as unsafe_depends=3DYES

2. a new tool, pkg_rolling_replace (being developed), will

  tsort the set of installed packages by dependencies
  find the set of packages that are out of date
  find the set of packages that have unsafe_depends set
  choose the first package from the union of those sets
  do make replace on the chosen package
  repeat

This will result in an updated system with no broken dependencies.  It
should be able to run in the background, stopping on build failure,
and rarely leaving the system in an unworking state.

Then, the following steps will also be helpful:

3. have 'pkg_add -u' also set unsafe_depends

4. extend pkg_rolling_replace to use binary packages as well

5. With enough information about ABIs, don't set unsafe_depends when
   it can be safely left unset.


I'd like to commit step 1 - is this ok?

Index: mk/flavor/pkg/replace.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/replace.mk,v
retrieving revision 1.4
diff -u -r1.4 replace.mk
=2D-- mk/flavor/pkg/replace.mk	7 Jul 2006 21:24:28 -0000	1.4
+++ mk/flavor/pkg/replace.mk	16 Jul 2006 12:17:07 -0000
@@ -150,6 +150,7 @@
 			{ print }'					\
 			$$contents > $$newcontents;			\
 		${MV} -f $$newcontents $$contents;			\
+		${PKG_ADMIN} set unsafe_depends=3DYES $$pkg;		\
 	done
=20
 ######################################################################



=2D-=20
        Greg Troxel <gdt@ir.bbn.com>

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (NetBSD)

iD8DBQFEujDW+vesoDJhHiURAuitAJ923Jo1W2c0qBIKejLH/A5OHZ/G5gCfeaTd
mC+J3v+Y64RrOjF8DXApoB4=
=Ci1q
-----END PGP SIGNATURE-----
--=-=-=--