Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2019 21:51:45 +0000 (UTC)
From:      Rene Ladan <rene@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r493983 - head/Tools/scripts
Message-ID:  <201902262151.x1QLpj8X088223@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rene
Date: Tue Feb 26 21:51:44 2019
New Revision: 493983
URL: https://svnweb.freebsd.org/changeset/ports/493983

Log:
  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)

Modified:
  head/Tools/scripts/rmport

Modified: head/Tools/scripts/rmport
==============================================================================
--- head/Tools/scripts/rmport	Tue Feb 26 21:13:33 2019	(r493982)
+++ head/Tools/scripts/rmport	Tue Feb 26 21:51:44 2019	(r493983)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902262151.x1QLpj8X088223>