aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2019-03-05 22:54:34 +0000
committerRene Ladan <rene@FreeBSD.org>2019-03-05 22:54:34 +0000
commit79f37cc7aeed80117fe461c3764d88149063811b (patch)
treebb5dac59ac7e39b97a130703db70436a5f2e186e /Tools
parent5b195e9a60b963d649089dcb0b502f3c5a0ad563 (diff)
downloadports-79f37cc7aeed80117fe461c3764d88149063811b.tar.gz
ports-79f37cc7aeed80117fe461c3764d88149063811b.zip
rmport: fix and speed up the find_expired() function.
find_expired() is used with -F (report on all expired ports using the format "date category/port: reason") and -a (remove all expired ports). Some speedups: - only calculate the deprecation reason for -F - use nested loops instead of nested recursion for traversing all ports. The nested recursion would also stop after finding the first port. Approved by: maintainer (crees) (implicit, fixit)
Notes
Notes: svn path=/head/; revision=494751
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/rmport36
1 files changed, 15 insertions, 21 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport
index 8dfc595cb614..4e6b771e3658 100755
--- a/Tools/scripts/rmport
+++ b/Tools/scripts/rmport
@@ -116,27 +116,21 @@ find_catport()
fi
}
-find_expired() # [category [port]]
+find_expired()
{
- EXPVAR=EXPIRATION_DATE
-
- # 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
+ for category in $(make -C ${PORTSDIR} -V SUBDIR); do
+ for port in $(make -C ${PORTSDIR}/${category} -V SUBDIR); do
+ DATE="$(make -C ${PORTSDIR}/${category}/${port} -V EXPIRATION_DATE)"
+ if [ -n "${DATE}" -a ! "${DATE}" \> "${TODAY}" ] ; then
+ if [ "$1" = 1 ] ; then
+ echo -n "${DATE} ${category}/${port}: "
+ make -C ${PORTSDIR}/${category}/${port} -V DEPRECATED
+ else
+ echo "${category}/${port}"
+ fi
+ fi
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
+ done
}
# create temporary checkout directory
@@ -496,7 +490,7 @@ if [ ${1} = "-F" ] ; then
if [ ${#} -ne 1 ] ; then
usage
fi
- find_expired
+ find_expired 1
exit
fi
@@ -504,7 +498,7 @@ if [ ${1} = "-a" ] ; then
if [ ${#} -ne 1 ] ; then
usage
fi
- ${0} `find_expired |cut -f 2 -d ' ' |cut -f 1 -d :`
+ ${0} `find_expired 0`
exit
fi