Subject: Re: Packages with dynamic download sites
To: David Brownlee <abs@formula1.com>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-pkg
Date: 12/19/2001 08:30:21
On Wed, 19 Dec 2001, David Brownlee wrote:
> I'm trying to put together a package for a netscape plugin that seems
> to want to have a changing download page (defined in some javascript).
>
> I wondered if people had thoughts on how to best handle this (other
> that just marking it INTERACTIVE).
>
> As a proof of concept I came up with the following, which is obviously
> not viable as it involves running ftp anytime anything goes near the
> Makefile...
MASTER_SITES!= ftp -o - 'http://www.cult3d.com/download/viewer/code.js' | ${AWK} \
-F \" "/${DISTNAME}/{sub(\"${DISTNAME}.tar.gz\","'"",$$2);print $$2;exit}'
Does that work? I thought regular expressions in awk were supposed to be
delimited by '/', not '"'.
Anyway, this situation comes up often enough that maybe a general solution
is called for? Like...
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.880
diff -c -r1.880 bsd.pkg.mk
*** bsd.pkg.mk 2001/12/12 12:31:14 1.880
--- bsd.pkg.mk 2001/12/19 14:24:45
***************
*** 1282,1289 ****
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_DISTDIR}
.for fetchfile in ${_DISTFILES}
${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR}; \
sortedsites=`${SORTED_MASTER_SITES_CMD}`; \
! sites="${MASTER_SITES_${fetchfile:T}} $$sortedsites"; \
file="${fetchfile}"; \
bfile="${fetchfile:T}"; \
${_CHECK_DIST_PATH}; \
--- 1282,1290 ----
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_DISTDIR}
.for fetchfile in ${_DISTFILES}
${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR}; \
+ dynamicsites=`${SH} ${FILESDIR}/getsites.sh`; \
sortedsites=`${SORTED_MASTER_SITES_CMD}`; \
! sites="$$dynamicsites ${MASTER_SITES_${fetchfile:T}} $$sortedsites"; \
file="${fetchfile}"; \
bfile="${fetchfile:T}"; \
${_CHECK_DIST_PATH}; \
so you only have to write the script "files/getsites.sh" for each
package that has this issue (not tested). The point is, $dynamicsites
is added to the shell code in the _FETCH_FILES macro, which is then
only executed when the script is, when do-fetch is actually run.
Frederick