Date: Sat, 28 Apr 2001 04:05:07 -0300 From: "Mario Sergio Fujikawa Ferreira" <lioux@uol.com.br> To: freebsd-ports@freebsd.org Subject: RFC: New port target fetch-check (bsd.port.mk patch) Message-ID: <20010428040507.A8145@Fedaykin.here>
next in thread | raw e-mail | index | archive | help
--pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I would like some comments on this new target. One the most common problems we have when either creating or updating ports is verifying if the DISTFILES exist under the MASTER_SITES. Some of us have automated tools to do that but the ports system could use an automated target. Are my port DISTFILES available under my MASTER_SITES? I wrote a simple fetch-check target that does exactly that. It is pretty naive in which it currently depends on the existence of fetch in the target system but we can improve it in the future. A sample output $ cd /usr/ports/mail/qpopper $ make fetch-check >> checking URI ftp://ftp.qualcomm.com/eudora/servers/unix/popper/qpopper4.0.1.tar.gz >>> URI OK. qpopper4.0.1.tar.gz exists under ftp://ftp.qualcomm.com/eudora/servers/unix/popper/ with 2382486 bytes >> checking URI ftp://sunsite.doc.ic.ac.uk/Mirrors/ftp.qualcomm.com/eudora/servers/unix/popper/qpopper4.0.1.tar.gz >>> URI OK. qpopper4.0.1.tar.gz exists under ftp://sunsite.doc.ic.ac.uk/Mirrors/ftp.qualcomm.com/eudora/servers/unix/popper/ with 2382486 bytes >> checking URI ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/qpopper4.0.1.tar.gz >>> URI not OK. qpopper4.0.1.tar.gz does not exist under ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ >> checking URI http://www.imasy.or.jp/~ume/ipv6/qpopper4.0-ipv6-20010418.diff.gz >>> URI OK. qpopper4.0-ipv6-20010418.diff.gz exists under http://www.imasy.or.jp/~ume/ipv6/ with 20649 bytes >> checking URI ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/qpopper4.0-ipv6-20010418.diff.gz >>> URI not OK. qpopper4.0-ipv6-20010418.diff.gz does not exist under ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ A think fenner is the most appropriate reviewer for this since he has been "our" distfiles meister. And, as such, has experience with all sort of fetching problems. But the whole port community is more than welcome. I am contributing this in the hope that I can quit using perl scripting when I could be benefiting of internal port building tools like makesum. And, that others might find it helpful. :) I wrote it in less than an hour so I am pretty sure that others can help me improve it. Regards, -- Mario S F Ferreira - UnB - Brazil - "I guess this is a signature." lioux at ( freebsd dot org | linf dot unb dot br ) flames to beloved devnull@someotherworldbeloworabove.org --pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-bsd.port.mk" --- bsd.port.mk.orig Sat Apr 28 02:17:06 2001 +++ bsd.port.mk Sat Apr 28 03:52:46 2001 @@ -946,15 +946,17 @@ .endif .if exists(/usr/bin/fetch) +FETCH= /usr/bin/fetch # avoid -A for 2.2 -- it's not ported to that branch .if ${OSVERSION} < 300000 -FETCH_CMD?= /usr/bin/fetch +FETCH_CMD?= ${FETCH} .else -FETCH_CMD?= /usr/bin/fetch -A +FETCH_CMD?= ${FETCH} -A .endif #FETCH_BEFORE_ARGS+= $${CKSIZE:+-S $$CKSIZE} .else -FETCH_CMD?= /usr/bin/ftp +FTP= /usr/bin/ftp +FETCH_CMD?= ${FTP} .endif TOUCH?= /usr/bin/touch @@ -2339,6 +2341,50 @@ done; \ ${ECHO} "echo $${file} not fetched" ; \ fi \ + done) +.endif +.endif + +# Checks if MASTER_SITES contain the DISTFILES + +.if !target(fetch-check) +fetch-check: +.if defined(FETCH) + @(for file in ${DISTFILES}; do \ + for site in `${SORTED_MASTER_SITES_CMD}`; do \ + DIR=${DIST_SUBDIR}; \ + CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ + case $${file} in \ + */*) args="-o $${file} $${site}$${file}";; \ + *) args=$${site}$${file};; \ + esac; \ + ${ECHO_MSG} ">> checking URI $${args}" ; \ + FETCH_CHECK_FILE_SIZE=`if ${SETENV} ${FETCH_ENV} ${FETCH} -as $${args} 2>/dev/null; then continue 2; fi`; \ + if [ -n "$${FETCH_CHECK_FILE_SIZE}" ] ; then \ + ${ECHO_MSG} ">>> URI OK. $${file} exists under $${site} with $${FETCH_CHECK_FILE_SIZE} bytes" ; \ + else \ + ${ECHO_MSG} ">>> URI not OK. $${file} does not exist under $${site}" ; \ + fi \ + done; \ + done) +.endif +.if defined(PATCHFILES) + @(for file in ${PATCHFILES}; do \ + for site in `${SORTED_PATCH_SITES_CMD}`; do \ + DIR=${DIST_SUBDIR}; \ + CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ + case $${file} in \ + */*) args="-o $${file} $${site}$${file}";; \ + *) args=$${site}$${file};; \ + esac; \ + ${ECHO_MSG} ">> checking URI $${args}" ; \ + FETCH_CHECK_FILE_SIZE=`if ${SETENV} ${FETCH_ENV} ${FETCH} -as $${args} 2>/dev/null; then continue 2; fi`; \ + if [ -n "$${FETCH_CHECK_FILE_SIZE}" ] ; then \ + ${ECHO_MSG} ">>> URI OK. $${file} exists under $${site} with $${FETCH_CHECK_FILE_SIZE} bytes" ; \ + else \ + ${ECHO_MSG} ">>> URI not OK. $${file} does not exist under $${site}" ; \ + fi \ + done; \ done) .endif .endif --pf9I7BMVVzbSWLtt-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010428040507.A8145>