From owner-svn-ports-head@freebsd.org Tue Mar 5 22:54:35 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03255151A00F; Tue, 5 Mar 2019 22:54:35 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95A598CBD9; Tue, 5 Mar 2019 22:54:34 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B1E622C2A; Tue, 5 Mar 2019 22:54:34 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x25MsYgH087117; Tue, 5 Mar 2019 22:54:34 GMT (envelope-from rene@FreeBSD.org) Received: (from rene@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x25MsYCt087116; Tue, 5 Mar 2019 22:54:34 GMT (envelope-from rene@FreeBSD.org) Message-Id: <201903052254.x25MsYCt087116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rene set sender to rene@FreeBSD.org using -f From: Rene Ladan Date: Tue, 5 Mar 2019 22:54:34 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r494751 - head/Tools/scripts X-SVN-Group: ports-head X-SVN-Commit-Author: rene X-SVN-Commit-Paths: head/Tools/scripts X-SVN-Commit-Revision: 494751 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 95A598CBD9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 22:54:35 -0000 Author: rene Date: Tue Mar 5 22:54:34 2019 New Revision: 494751 URL: https://svnweb.freebsd.org/changeset/ports/494751 Log: 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) Modified: head/Tools/scripts/rmport Modified: head/Tools/scripts/rmport ============================================================================== --- head/Tools/scripts/rmport Tue Mar 5 22:00:40 2019 (r494750) +++ head/Tools/scripts/rmport Tue Mar 5 22:54:34 2019 (r494751) @@ -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 + 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 - 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 + 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