aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorrene <rene@FreeBSD.org>2019-02-27 05:51:44 +0800
committerrene <rene@FreeBSD.org>2019-02-27 05:51:44 +0800
commit6bcb0897850adc2e25f984057d8a6f4a240f4f13 (patch)
treefa34bf3dc4434d5c4c2ca79932948c77ac8e5c3e /Tools/scripts
parent3722a6d36892fdfa44feab4758fd034755ed1e85 (diff)
downloadfreebsd-ports-gnome-6bcb0897850adc2e25f984057d8a6f4a240f4f13.tar.gz
freebsd-ports-gnome-6bcb0897850adc2e25f984057d8a6f4a240f4f13.tar.zst
freebsd-ports-gnome-6bcb0897850adc2e25f984057d8a6f4a240f4f13.zip
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)
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/rmport26
1 files changed, 17 insertions, 9 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport
index 9c2c3e9dc050..8dfc595cb614 100755
--- a/Tools/scripts/rmport
+++ b/Tools/scripts/rmport
@@ -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