From 42f3104099a0e1d65bbf95c86935190794bf444c Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Fri, 7 Jul 2000 15:00:38 +0000 Subject: Add checknewver.sh - a shell script which checks for availability of newest version of distfiles on MASTER_SITES. This is still work in progress, so please use with caution and don't forget report bugs and submit patches. --- Tools/scripts/checknewver.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 Tools/scripts/checknewver.sh (limited to 'Tools') diff --git a/Tools/scripts/checknewver.sh b/Tools/scripts/checknewver.sh new file mode 100755 index 000000000000..e6d061b83d22 --- /dev/null +++ b/Tools/scripts/checknewver.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# +# checknewver +# Check for availability of the newest distfiles +# +# ---------------------------------------------------------------------------- +# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): +# Maxim Sobolev &2 + echo "ports/ftp/ftpcopy port." >&2 + echo " Please make sure that it is installed and try again." >&2 + exit 1 +fi + +if [ ! -e Makefile ]; then + echo "ERROR: Couldn't find Makefile here." >&2 + exit 1 +fi + +PORTNAME=`make -V PORTNAME` +PORTVERSION=`make -V PORTVERSION` +DISTFILES=`make -V DISTFILES` +if [ x"${PORTNAME}" = x"" -o x"${PORTVERSION}" = x"" -o x"${DISTFILES}" = x"" ]; then + echo "ERROR: either PORTNAME, PORTVERSION or DISTFILES is undefined in Makefile." >&2 + exit 1 +fi + +MASTER_SITES=`env MASTER_SITE_BACKUP=\"\" make -V MASTER_SITES | xargs -n1 echo | grep ^ftp://` +if [ x"${MASTER_SITES}" = x"" ]; then + echo "ERROR: either MASTER_SITES is undefined in Makefile or it doesn't contain any ftp sites." >&2 + exit 1 +fi + +echo "Checking for updated version of ${PORTNAME}..." >&2 +PV_PATR=`echo ${PORTVERSION} | sed 's=\.=\\\\.=g'` +for DISTNAME in ${DISTFILES}; do + DF_PATR=`echo ${DISTNAME} | sed "s=${PV_PATR}=.*=" | \ + sed 's=\.=\\\\.=g ; s=\\\.\*=.*='` + DF_CHECK=`echo ${DISTNAME} | sed 's=\.=\\\\.=g` + if [ x"${DF_PATR}" = x"${DF_CHECK}" ]; then + echo "WARN: Couldn't construct searching pattern - ${DISTNAME} ignored." >&2 + else + DF_PATRNS="${DF_PATRNS} ${DF_PATR}" + F_DISTFILES="${F_DISTFILES} ${DISTNAME}" + fi +done + +if [ x"${F_DISTFILES}" = x"" ]; then + echo "WARN: Nothing to check - exitting." >&2 + exit 0 +fi + +DISTFILES="${F_DISTFILES}" + +for MASTER_SITE in ${MASTER_SITES}; do + echo "...checking ${MASTER_SITE}" >&2 + FTPLIST=`ftpls ${MASTER_SITE} 2>/dev/null | grep -v ^dir | awk '{print $6}'` + for DISTNAME in ${DISTFILES}; do + DF_PATR=`echo ${DISTNAME} | sed "s=${PV_PATR}=.*=" | \ + sed 's=\.=\\\\.=g ; s=\\\.\*=.*='` + for i in `echo ${FTPLIST} | xargs -n1 echo | grep "${DF_PATR}"` ; do + if [ "${i}" ">" "${DISTNAME}" ]; then + NEW="${NEW} ${MASTER_SITE}${i}" + fi + done + done +done + +if [ x"${NEW}" != x"" ]; then + echo "" + echo "Hmm, is seems that there is newest version(s) at:" + echo "${NEW}" | xargs -n1 echo + echo "" +fi -- cgit v1.2.3