aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorvd <vd@FreeBSD.org>2006-05-02 19:31:54 +0800
committervd <vd@FreeBSD.org>2006-05-02 19:31:54 +0800
commitd4c640ec3934fd108f3d413f0c06e947172b3456 (patch)
tree625a7f6c8c091486ddebf4d111fbd70769e1933d /Tools
parentf8d029383e7fa41cb06987ed562ca5943c2b6220 (diff)
downloadfreebsd-ports-gnome-d4c640ec3934fd108f3d413f0c06e947172b3456.tar.gz
freebsd-ports-gnome-d4c640ec3934fd108f3d413f0c06e947172b3456.tar.zst
freebsd-ports-gnome-d4c640ec3934fd108f3d413f0c06e947172b3456.zip
Add support for specifying ports to be removed as directories on the
filesystem (either absolute or relative) in addition to `category/port'. PR: ports/96649 Submitted by: Cheng-Lung Sung <clsung@freebsd.org> Reworked by: vd
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/rmport28
1 files changed, 27 insertions, 1 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport
index 7013cacebb1e..dc5ffbcd4456 100755
--- a/Tools/scripts/rmport
+++ b/Tools/scripts/rmport
@@ -54,6 +54,30 @@ pkgname()
make -C ${PORTSDIR}/${1} -V PKGNAME
}
+# return category/port if arg is directly port's directory on the filesystem
+find_catport()
+{
+ arg=${1}
+
+ if [ -d "${PORTSDIR}/${arg}" ] ; then
+ # arg is category/port
+ echo ${arg}
+ elif [ -d "${arg}" ] ; then
+ # arg is the port's directory somewhere in the filesystem
+ # either absolute or relative
+
+ # get the full path
+ rp=`realpath ${arg}`
+
+ category=`basename \`dirname ${rp}\``
+ port=`basename ${rp}`
+ echo ${category}/${port}
+ else
+ echo "What do you mean by \`${arg}'?" >&2
+ exit 1
+ fi
+}
+
find_expired()
{
EXPVAR=EXPIRATION_DATE
@@ -274,7 +298,7 @@ if [ ${1} = "-d" ] ; then
if [ ${#} -ne 2 ] ; then
usage
fi
- catport=${2}
+ catport=`find_catport ${2}`
check_dep ${catport} 0 ${catport}
exit
fi
@@ -293,6 +317,8 @@ cd ${codir}
co_common
for catport in $* ; do
+ # convert to category/port
+ catport=`find_catport ${catport}`
cat=`dirname ${catport}`
port=`basename ${catport}`
# remove any trailing slashes