rmport: correctly deal with expired ports when the -a (find all expired) option.

Instead of grepping port Makefiles for EXPIRATION_DATE, evaluate this variable
using make. Also find ports by evaluating SUBDIR recursively instead of using
find on Makefile\*

Submitted by:   crees (maintainer)
Approved by:    crees (maintainer)
This commit is contained in:
Rene Ladan 2019-02-26 21:51:44 +00:00
parent 4f7524b595
commit 17094bb838
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=493983

View File

@ -116,19 +116,27 @@ find_catport()
fi
}
find_expired()
find_expired() # [category [port]]
{
EXPVAR=EXPIRATION_DATE
find -H ${PORTSDIR} -mindepth 3 -maxdepth 3 -name "Makefile*" \
|xargs grep -H "^${EXPVAR}" \
|grep -v '^#' \
|sed -E "s|${PORTSDIR}/?([^/]+/[^/]+)/Makefile[^:]*:${EXPVAR}=[[:space:]]*([0-9-]{10})$|\2 \1|g" \
|perl -ne "if ((substr(\$_, 0, 10) cmp '${TODAY}') <= 0) { print(\$_); }" \
|while read expdate catport ; do \
echo -n "${expdate} ${catport}: " ; \
make -C ${PORTSDIR}/${catport} -V DEPRECATED ; \
# Called bare, just discovers categories
if [ -z "$1" ]; then
for category in $(make -C ${PORTSDIR} -VSUBDIR); do
find_expired $category
done
elif [ -z "$2" ]; then
for port in $(make -C ${PORTSDIR}/$1 -VSUBDIR); do
find_expired $1 $port
done
else
DATE="$(make -C${PORTSDIR}/$1/$2 -V${EXPVAR})"
[ -n "$DATE" ] || return
if [ ! "$DATE" \> "${TODAY}" ]; then
echo "${DATE} $1/$2: ";
make -C${PORTSDIR}/$1/$2 -VDEPRECATED
fi
fi
}
# create temporary checkout directory