Subject: Re: Ports -> make upgrade
To: None <tech-pkg@netbsd.org>
From: Aaron J. Grier <agrier@poofygoof.com>
List: tech-pkg
Date: 02/28/2002 14:19:44
--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

this is heading to tech-pkg land, so I'm following up there.

On Mon, Feb 25, 2002 at 03:20:43PM -0800, Johnny C. Lam wrote:

> The "update" target could be improved slightly in that it could ensure
> that all of the distfiles are present and pass their checksums before
> pkg_deleting any installed packages.  This wasn't possible before due
> to the way that the recursive fetch operation was designed which led
> to unbelievably long fetch times (on the order of several days) for
> complex packages with many dependencies.  I believe a new recursive
> fetch algorithm is being (or has been, I can't remember) committed
> that will fix this problem.

ideally the pkg_delete should be done right before the make install, but
this would only work if the compile isn't reaching into /usr/pkg for
anything.  and to get it to do that... what a complex mess.  ;)

while we're making a pkgsrc wishlist, it seems like it wouldn't be too
tough to get pkgsrc to stop trying to deinstall packages that aren't
installed yet when doing a make update.

somewhat related, since DDIR is created before the make deinstall, which
means if the deinstall fails (because of a bad su or sudo timeout), the
next time make update is run, it will continue on, without having
actually deinstalled anything...  moral of the story being that DDIR
should be deleted if the deinstall fails.

I've attached a patch to bsd.pkg.mk that I hope fixes both problems, but
obviously it could use some extra eyes.

-- 
  Aaron J. Grier | "Not your ordinary poofy goof." | agrier@poofygoof.com
      "[...] I generally haven't found IDM guys to be very good
       live acts, most of them just sit down at their laptop and
       tweak reaktor."  -- Brandon Daniel

--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bsd.pkg.mk.diff"

--- bsd.pkg.mk.orig	Mon Feb 25 06:35:48 2002
+++ bsd.pkg.mk	Thu Feb 28 14:06:35 2002
@@ -2463,8 +2463,10 @@
 
 update:
 	${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${DDIR}
-	${_PKG_SILENT}${_PKG_DEBUG}					\
-		${MAKE} ${MAKEFLAGS} deinstall DEINSTALLDEPENDS=ALL
+	${_PKG_SILENT}${_PKG_DEBUG}if ${PKG_INFO} -qe ${PKGNAME}; then \
+		${MAKE} ${MAKEFLAGS} deinstall DEINSTALLDEPENDS=ALL \
+		|| (${RM} ${DDIR} && ${FALSE}); \
+	fi
 .endif
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 		${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} KEEP_WRKDIR=YES	\

--2fHTh5uZTiUOsy+g--