Subject: Re: Proposed fix for fetch-list recursion
To: Bernd Ernesti <netbsd@arresum.inka.de>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-pkg
Date: 02/24/2002 10:17:26
On Sun, 24 Feb 2002, Bernd Ernesti wrote:

> It tries to fetch files, where the package Makefile have this:
>
> do-fetch:
>         @if ${TEST} \! -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}; then \
>                 ${ECHO} "===> You need to request a password on ${HOMEPAGE}"; \
>                 ${ECHO} "     and fetch on your own source file."; \
>                 exit 1; \
>         fi
>
> Thats from audio/simian.
>
> And runing that script produce this:
>
> Requesting http://weewave.mer.utexas.edu/MED_files/CODE_RQST/simian_12_98.tar.gz
>   (via 127.0.0.1:3128)
> 401 Unauthorized
> Username for `CLUB':
>
> Now, you don't get the echo message from the package Makefile.

Hmm. "fetch-list" doesn't know that the "do-fetch" target has been
overidden. How could it?

> I guess that would be also a problem for other packages which have such
> targets (fetching a distfile manually).

I suppose a "fetch-list-one-pkg" target could be added to each package
that has a do-fetch target, like so:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/cad/simian/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	2001/12/07 21:02:18	1.2
+++ Makefile	2002/02/24 16:00:56
@@ -20,12 +20,18 @@
 WRKSRC=		${WRKDIR}/Simian/src
 ALL_TARGET=	simian

+_FETCH_MESSAGE= \
+	${ECHO} "===> You need to request a password on ${HOMEPAGE}"; \
+	${ECHO} "     and fetch on your own source file."
+
 do-fetch:
 	@if ${TEST} \! -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}; then \
-		${ECHO} "===> You need to request a password on ${HOMEPAGE}"; \
-		${ECHO} "     and fetch on your own source file."; \
+		${_FETCH_MESSAGE}; \
 		exit 1; \
 	fi
+
+fetch-list-one-pkg:
+	@${ECHO} ${_FETCH_MESSAGE:Q}

 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/simian ${PREFIX}/bin

There's also the issue of how to handle packages that do "getsites.sh"
(of which is currently exactly one). What it does, with the patch, is
just go to the master site.

> And what about adding the file size to the
>
> # Fetch simian_12_98.tar.gz:
> #
>
> lines?

That sounds do-able. I even thought about parsing distinfo for the
checksum, and having the generated script use it, but that means you
have to have "digest" on the fetching host. I'll see about extracting
just the size.

Frederick