svn commit: r415399 - head/Tools/scripts

Rene Ladan rene at FreeBSD.org
Tue May 17 17:52:00 UTC 2016


Author: rene
Date: Tue May 17 17:51:59 2016
New Revision: 415399
URL: https://svnweb.freebsd.org/changeset/ports/415399

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

Modified:
  head/Tools/scripts/rmport

Modified: head/Tools/scripts/rmport
==============================================================================
--- head/Tools/scripts/rmport	Tue May 17 17:51:03 2016	(r415398)
+++ head/Tools/scripts/rmport	Tue May 17 17:51:59 2016	(r415399)
@@ -31,6 +31,7 @@
 # Originally written by Vasil Dimov <vd at FreeBSD.org>
 # Others:
 # Chris Rees <crees at FreeBSD.org>
+# Rene Ladan <rene at FreeBSD.org>
 #
 # $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})</td.*|\1 \2 \3|p" \
+	|sed -ne 's,^[[:space:]]*.a href="show_bug.cgi?id=\([0-9][0-9]*\)".\([^0-9][^<]*\).*,\1: \2,p' \
 	|sort
 }
 
-# query GNATS via query-pr on freefall and return the result
-get_PRs_freefall()
-{
-	catport=${1}
-	synopsis=${2}
-
-	log "${catport}: getting PRs having ${synopsis} in the synopsis"
-
-	ssh freefall.freebsd.org "query-pr -qx -y '${synopsis}' || :"
-}
-
 # query GNATS and return the result
 get_PRs()
 {
 	catport=${1}
 	synopsis=${2}
 
-	get_PRs_freefall ${catport} ${synopsis}
+	get_PRs_www ${catport} ${synopsis}
 }
 
 # check if any PRs exist that are related to the port
@@ -419,7 +408,7 @@ cleanup()
 	rm svnlog
 
 	# release ports directories
-	rm -r ports
+	rm -rf ports
 
 	cd /
 	rmdir ${codir}


More information about the svn-ports-all mailing list