Subject: Re: Packages with dynamic download sites
To: Frederick Bruckman <fredb@immanent.net>
From: David Brownlee <abs@netbsd.org>
List: tech-pkg
Date: 12/21/2001 16:13:21
Thanks! - rather than try the getsites.sh for every package would
it be reasonable to have a DYNAMIC_MASTER_SITES variable which
could be set to point to the package specific 'MASTER_SITES'
outputting script?
Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.882
diff -u -B -r1.882 bsd.pkg.mk
--- mk/bsd.pkg.mk 2001/12/19 10:29:11 1.882
+++ mk/bsd.pkg.mk 2001/12/21 16:12:00
@@ -1285,6 +1285,9 @@
${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR}; \
sortedsites=`${SORTED_MASTER_SITES_CMD}`; \
sites="${MASTER_SITES_${fetchfile:T}} $$sortedsites"; \
+ if [ -n "${DYNAMIC_MASTER_SITES}" ] ; then \
+ sites="`${SH} ${PKGDIR}/${DYNAMIC_MASTER_SITES} ${fetchfile}` $sites"; \
+ fi; \
file="${fetchfile}"; \
bfile="${fetchfile:T}"; \
${_CHECK_DIST_PATH}; \
--
David/absolute -- www.netbsd.org: No hype required --
On Wed, 19 Dec 2001, Frederick Bruckman wrote:
> On Wed, 19 Dec 2001, Frederick Bruckman wrote:
>
> > 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 forgot that the script would need access to the name of the distfile.
> So here's a script that parses the site out of the javascript, given the
> name of the distfile as argument:
>
> cut here---8\------------------getsites.sh
> #!/bin/sh
>
> ftp -o - http://www.cult3d.com/download/viewer/code.js |
> awk -F '"' '
> /'"$1"'/ {
> sub(/'"$1"'/, "", $2)
> print $2
> exit 0
> }'
> cut here---8\------------------getsites.sh
>
> And here's an improved patch, to give the script the argument (still not
> tested):
>
> Index: bsd.pkg.mk
> ===================================================================
> RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
> retrieving revision 1.882
> diff -c -r1.882 bsd.pkg.mk
> *** bsd.pkg.mk 2001/12/19 10:29:11 1.882
> --- bsd.pkg.mk 2001/12/19 15:01:46
> ***************
> *** 1283,1290 ****
> ${_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}; \
> --- 1283,1291 ----
> ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_DISTDIR}
> .for fetchfile in ${_DISTFILES}
> ${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR}; \
> + dynamicsites=`${SH} ${FILESDIR}/getsites.sh $$fetchfile`; \
> sortedsites=`${SORTED_MASTER_SITES_CMD}`; \
> ! sites="$$dynamicsites ${MASTER_SITES_${fetchfile:T}} $$sortedsites"; \
> file="${fetchfile}"; \
> bfile="${fetchfile:T}"; \
> ${_CHECK_DIST_PATH}; \
>
>
> Frederick
>
>