aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2006-12-13 07:32:58 +0000
committerVasil Dimov <vd@FreeBSD.org>2006-12-13 07:32:58 +0000
commite2f1d375a7bc108eaae92556add3ae79829e3cac (patch)
tree7ff31e7b5c8c4a40e64481d4d1991cc3644d71da /Tools
parent65c25b0646341f7c22ac1f6388abccda3ad1c41d (diff)
downloadports-e2f1d375a7bc108eaae92556add3ae79829e3cac.tar.gz
ports-e2f1d375a7bc108eaae92556add3ae79829e3cac.zip
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/rmport66
1 files changed, 65 insertions, 1 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport
index 8f9961e1893d..37339efe13d8 100755
--- a/Tools/scripts/rmport
+++ b/Tools/scripts/rmport
@@ -178,6 +178,55 @@ check_dep()
done
}
+# query GNATS, format and return the result
+get_PRs()
+{
+ 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}"
+
+ raw="`fetch -q -T 20 -o - "${url}"`"
+
+ if [ -z "${raw}" ] ; then
+ log "${catport}: empty result from URL: ${url}"
+ exit 1
+ fi
+
+ printf "%s" "${raw}" \
+ |sed -nE "s|.*>(${date_re})<.*>(${prnum_re})<.*>(${synopsis_re})</td.*|\1 \2 \3|p" \
+ |sort
+}
+
+# check if any PRs exist that are related to the port
+check_PRs()
+{
+ catport=${1}
+ synopsis=${2}
+
+ PRs="`get_PRs ${catport} "${synopsis}"`" || exit
+
+ if [ -n "${PRs}" ] ; then
+ log "${catport}: PRs found, related to ${synopsis}:"
+ printf "%s\n" "${PRs}" >&2
+
+ echo "you can skip ${catport} and continue with the rest or remove it anyway" >&2
+ answer=`ask "do you want to skip ${catport}?"`
+ if [ "${answer}" = "y" ] ; then
+ return 1
+ else
+ return 0
+ fi
+ fi
+
+ return 0
+}
+
# checkout port's specific files from the repository
co_port()
{
@@ -353,6 +402,9 @@ usage()
echo "" >&2
echo "just check dependencies:" >&2
echo "${0} -d category/port" >&2
+ echo "" >&2
+ echo "just check if any related PRs exist:" >&2
+ echo "${0} -p synopsis" >&2
exit 64
}
@@ -372,6 +424,14 @@ if [ ${1} = "-d" ] ; then
exit
fi
+if [ ${1} = "-p" ] ; then
+ if [ ${#} -ne 2 ] ; then
+ usage
+ fi
+ get_PRs "dummy" ${2}
+ exit
+fi
+
if [ ${1} = "-F" ] ; then
if [ ${#} -ne 1 ] ; then
usage
@@ -404,6 +464,10 @@ for catport in $* ; do
check_dep ${catport} 1 "${*}"
+ if ! check_PRs ${catport} ${port} ; then
+ continue
+ fi
+
co_port ${cat} ${port}
check_LEGAL ${catport} ${pkgname}
@@ -430,7 +494,7 @@ while [ "${answer}" = "y" ] ; do
# EDITOR instead of PAGER because vim has nice syntax highlighting ;-)
${EDITOR} ${diffout}
- echo "you can now edit files under ${codir}/ by hand"
+ echo "you can now edit files under ${codir}/ by hand" >&2
answer=`ask "do you want to recreate the diff?"`
done