Subject: FAILOVER_FETCH vs. makesum target
To: None <tech-pkg@netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 08/04/2000 10:47:15
From time to time, I've gone to update a package by changing the
version in the package "Makefile", and running "make makesum". Every
time, if FAILOVER_FETCH is set, it fails, and then I comment
FAILOVER_FETCH out of /etc/mk.conf (until I need it again).

Clearly, it makes no sense for the "makesum" target to take action
based on the md5 file before modifying it, FAILOVER_FETCH or not. In
fact, the '_FETCH_FILE' macro does the right thing if no md5 file
exists, but not otherwise.

The following seems to DTRT, but I'm a little leary of using the
"make()" condition this way, because if someone ever creates a target
with "makesum" as a source, the same problem will recur. [make(foo)
only checks if target "foo" was given on the command line, not if
"foo" is being made as a prerequisite for some other target.] Could
anyone suggest a better way?

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.534
diff -c -r1.534 bsd.pkg.mk
*** bsd.pkg.mk	2000/08/03 15:45:42	1.534
--- bsd.pkg.mk	2000/08/04 15:46:49
***************
*** 1173,1178 ****
--- 1173,1181 ----
  
  
  .if !target(do-fetch)
+ .if make(makesum)
+ FAILOVER_FETCH=	# Empty
+ .endif
  do-fetch:
  	${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_DISTDIR}
  	${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR};			\