aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2019-02-26 21:51:44 +0000
committerRene Ladan <rene@FreeBSD.org>2019-02-26 21:51:44 +0000
commit17094bb8384ce814ed489ca1fcca874faf4df405 (patch)
treefa34bf3dc4434d5c4c2ca79932948c77ac8e5c3e /Tools
parent4f7524b5957bb195029b2ea16c61dcb7cc03f4a3 (diff)
downloadports-17094bb8384ce814ed489ca1fcca874faf4df405.tar.gz
ports-17094bb8384ce814ed489ca1fcca874faf4df405.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)
Notes
Notes: svn path=/head/; revision=493983
Diffstat (limited to 'Tools')
-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