aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2006-05-02 11:31:54 +0000
committerVasil Dimov <vd@FreeBSD.org>2006-05-02 11:31:54 +0000
commit12dda3240e1bdf3d698ef177a10194b544b1fcd8 (patch)
tree5c18e7843bc1c1269c5d5127b9495ac3d59811a9 /Tools
parent37ce4e710ff48750135eb291a7ab91b56d25f8f8 (diff)
downloadports-12dda3240e1bdf3d698ef177a10194b544b1fcd8.tar.gz
ports-12dda3240e1bdf3d698ef177a10194b544b1fcd8.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
Notes
Notes: svn path=/head/; revision=161185
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