Subject: Re: did the "make reinstall" functionality get slightly broken in 19990119?
To: NetBSD Packages Technical Discussion List <tech-pkg@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-pkg
Date: 03/02/1999 16:02:21
[ On Tuesday, March 2, 1999 at 21:19:01 (+0100), Hubert Feyrer wrote: ]
> Subject: Re: did the "make reinstall" functionality get slightly broken in  19990119?
>
> 
> On Tue, 2 Mar 1999, Greg A. Woods wrote:
> > 	make reinstall FORCE_PKG_REGISTER=yes
>                        ^^^^^^^^^^^^^^^^^^^^^^
> The're 's your problem, as Todd already stated. Use "make deinstall
> reinstall" instead (it's even shorter).

Hmmm, uh, then either your (and Todd's) understanding of
pkgsrc/mk/bsd.pkg.mk is wrong, or those rules aren't implemented
properly!  ;-)

> > I now see the problem too.  Setting FORCE_PKG_REGISTER only removes the
> > package-specific files in the ${PKG_DBDIR}.  It doesn't clean up the
> > merged database (i.e. pkgdb.byfile.db) at the same time, but it should.
> 
> Setting FORCE_PKG_REGISTER _only_ forces the package to be registered
> (again) even if it was already there before - hence the name. 

Well, that's not strictly true.  From the guts of the "fake-pkg" target:

.if defined(FORCE_PKG_REGISTER)
	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}
.endif

Clearly the above is inadeqate now that pkgdb.byfile.db has been
implemented.

If it were possible to change it to something like the following then I
think it would again work as it did before without all the extraneous
and meaninless noise:

.if defined(FORCE_PKG_REGISTER)
	@${PKG_DELETE} -O ${PKG_DBDIR}/${PKGNAME}/+CONTENTS
	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}
.endif

This requires enhancing the pkgtools however.

As I metioned before too, the only currently available work-around is
just a wee bit too expensive (at least IMHO):

.if defined(FORCE_PKG_REGISTER)
	@${rm} -f ${PKG_DBDIR}/pkgdb.byfile.db
	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}
.endif

Obviously the other fix would be to quit printing the noise in the first
place, and perhaps this could be done with a change to pkgsrc/mk/bsd.pkg.mk
something like this:

====
< 		${PKG_CREATE} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
----
> .if defined(FORCE_PKG_REGISTER)
> 		${PKG_CREATE} ${PKG_ARGS} -q -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
> .else
> 		${PKG_CREATE} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
> .endif
----

and of course implementing the '-q' option to pkg_create(1).  I don't
think this is as clean as the pkg_delete(1) change would be though.

(BTW, I just noticed that all the pkg_* manual pages are in section 1,
not section 8 as would be suggested by their presence in /usr/sbin.)

> The usual "install" target will just not care if the files did exist
> before and overwrite them, but the pkgdb code in pkg_create is a bit more
> cautious, but that's not the only one. If you use some package that tries
> to do some @exec/@unexec-replacements in Makefile, you can fail as badly.
> 
> Again: Do NOT use FORCE_PKG_REGISTER. Use "make deinstall".

I shouldn't need to when I'm working on a new package.  "make deinstall"
might even break because I've not yet got the package working properly.

Besides, "make install" tells me to use FORCE_PKG_REGISTER under the
circumstances I'm in to do exactly what I want to do, and there's no
reason why this ability should be removed -- it works perfectly well and
meets well founded requirements (it's just become a little noisy since
pkgdb.byfile.db has been implemented).

Lastly it should be noted yet again that "make reinstall
FORCE_PKG_REGISTER=yes" is a rather decent and usually completely safe
way of upgrading already installed packages from pkgsrc.  ;-)

Actually, I don't think I've ever used "make reinstall" for any purpose
without defining FORCE_PKG_REGISTER -- perhaps that should be the
default too.  Currently I can't see any scenario that would require
"reinstall" but not really require FORCE_PKG_REGISTER.  The already
available inverse (NO_PKG_REGISTER) can be used if really necessary.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>