From 8e33c1e0faa53da0046b877a021b4cafdedd9152 Mon Sep 17 00:00:00 2001 From: Rene Ladan Date: Tue, 17 May 2016 17:51:59 +0000 Subject: As a frequent user of the rmport script, it was time for some improvements: - allow PORTSDIR to be a symbolic link when looking for expired ports or dependent ports - allow for trailing slashes when specifying ports as cat/name. This prevents the port being a false positive for itself when the Makefile mentions the port name (e.g., in PLIST_FILES) - fetch possibly open PRs via Bugzilla, GNATS is long gone. Remove the version that used freefall. Thanks to crees for pretty-printing the results. - forcibly delete the temporary checkout to prevent rm(1) from asking for confirmation on each file in .svn - add myself as author Approved by: maintainer (crees) Differential Revision: https://reviews.freebsd.org/D6396 --- Tools/scripts/rmport | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'Tools') diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport index 471192d16f06..9567185de0c7 100755 --- a/Tools/scripts/rmport +++ b/Tools/scripts/rmport @@ -31,6 +31,7 @@ # Originally written by Vasil Dimov # Others: # Chris Rees +# Rene Ladan # # $FreeBSD$ # @@ -107,7 +108,7 @@ find_expired() { EXPVAR=EXPIRATION_DATE - find ${PORTSDIR} -mindepth 3 -maxdepth 3 -name "Makefile*" \ + find -H ${PORTSDIR} -mindepth 3 -maxdepth 3 -name "Makefile*" \ |xargs grep -H ${EXPVAR} \ |sed -E "s|${PORTSDIR}/?([^/]+/[^/]+)/Makefile:${EXPVAR}=[[:space:]]*([0-9-]{10})$|\2 \1|g" \ |perl -ne "if ((substr(\$_, 0, 10) cmp '${TODAY}') <= 0) { print(\$_); }" \ @@ -147,6 +148,7 @@ check_dep_core() rmpkgs="" rmcatports="" for torm in ${alltorm} ; do + torm="`echo ${torm} | sed 's/\/$//'`" rmpkgs="${rmpkgs:+${rmpkgs}|}`pkgname ${torm}`" rmcatports="${rmcatports:+${rmcatports}|}${PORTSDIR}/${torm}/" done @@ -162,7 +164,7 @@ check_dep_core() # check if some Makefiles mention the port to be deleted portdir_grep="^[^#].*/`basename ${catport}`([[:space:]]|/|$)" - r="`find ${PORTSDIR} -mindepth 2 -maxdepth 3 \ + r="`find -H ${PORTSDIR} -mindepth 2 -maxdepth 3 \ \( -name "Makefile*" -or -path "*Mk/*.mk" \) \ |xargs grep -EH "${portdir_grep}" \ |grep -vE "^(${rmcatports})" || :`" @@ -210,18 +212,16 @@ check_dep() fi } -# query GNATS via query-pr-summary.cgi, format and return the result +# query GNATS via Bugzilla, format and return the result +# XXX rene: PRs are listed twice for now due to the HTML code of Bugzilla get_PRs_www() { catport=${1} synopsis=${2} - date_re='[0-9]{4}/[0-9]{2}/[0-9]{2}' - prnum_re='.+/[0-9]{5,6}' - synopsis_re='.{10,}' log "${catport}: getting PRs having ${synopsis} in the synopsis" - url="http://www.freebsd.org/cgi/query-pr-summary.cgi?text=${synopsis}" + url="https://bugs.freebsd.org/bugzilla/buglist.cgi?quicksearch=${synopsis}" raw="`fetch -q -T 20 -o - "${url}"`" @@ -231,28 +231,17 @@ get_PRs_www() fi printf "%s" "${raw}" \ - |sed -nE "s|.*>(${date_re})<.*>(${prnum_re})<.*>(${synopsis_re})