Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Oct 2010 02:15:24 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r214582 - in user/dougb/portmaster: . files
Message-ID:  <201010310215.o9V2FOAv038648@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Sun Oct 31 02:15:23 2010
New Revision: 214582
URL: http://svn.freebsd.org/changeset/base/214582

Log:
  Clarify the problem described in the PR:
  
  The -e option can only deal with one port at a time so update the docs
  to reflect that more clearly, and update the code to use the various
  return values of find_glob_dirs() to make it more clear if the user
  specifies a pattern that matches more than one.
  
  PR:		ports/151824
  Submitted by:	Ben Grimm <freebsd-pr@bengrimm.net>

Modified:
  user/dougb/portmaster/files/portmaster.8
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/files/portmaster.8
==============================================================================
--- user/dougb/portmaster/files/portmaster.8	Sun Oct 31 01:57:13 2010	(r214581)
+++ user/dougb/portmaster/files/portmaster.8	Sun Oct 31 02:15:23 2010	(r214582)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 8, 2010
+.Dd October 30, 2010
 .Dt PORTMASTER 8
 .Os
 .Sh NAME
@@ -107,7 +107,7 @@ and/or multiple globs from /var/db/pkg
 .Fl [l|L]
 .Nm
 .Op Fl b [D|d]
-.Fl e Ar name/glob of port directory in /var/db/pkg
+.Fl e Ar name/glob of a single port directory in /var/db/pkg
 .Nm
 .Op Fl b [D|d]
 .Fl s
@@ -468,8 +468,8 @@ requirements.
 list all installed ports by category
 .It Fl L
 list all installed ports by category, and search for updates
-.It Fl e Ar name/glob of port directory in /var/db/pkg
-expunge port using
+.It Fl e Ar name/glob of a single port directory in /var/db/pkg
+expunge a port using
 .Xr pkg_delete 1 ,
 and optionally remove all distfiles.
 Calls

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sun Oct 31 01:57:13 2010	(r214581)
+++ user/dougb/portmaster/portmaster	Sun Oct 31 02:15:23 2010	(r214582)
@@ -291,7 +291,7 @@ usage () {
 	echo ''
 	echo "${0##*/} -[l|L]"
 	echo ''
-	echo "${0##*/} [-b D|d] -e <name/glob of port directory in $pdb>"
+	echo "${0##*/} [-b D|d] -e <name/glob of a single port directory in $pdb>"
 	echo "${0##*/} [-b D|d] -s"
 	echo ''
 	echo "${0##*/} [--force-config|-G] [-aftv] -F"
@@ -365,7 +365,7 @@ usage () {
 	echo '-l list installed ports by category'
 	echo '-L list installed ports by category, and search for updates'
 	echo ''
-	echo '-e expunge a port via pkg_delete, and remove its distfiles'
+	echo '-e expunge a single port via pkg_delete, and remove its distfiles'
 	echo '-s clean out stale ports that used to be depended on'
 	echo ''
 	echo '[--force-config|-G] [-aftv] -F fetch distfiles only'
@@ -1907,12 +1907,14 @@ fi
 
 if [ -n "$EXPUNGE" ]; then
 	if [ ! -d "$pdb/$EXPUNGE" ]; then
-		if find_glob_dirs $EXPUNGE; then
-			EXPUNGE=${glob_dirs#$pdb/}
-			unset glob_dirs
-		else
-			fail "No such directory/port: $pdb/$EXPUNGE"
-		fi
+		find_glob_dirs $EXPUNGE
+		case $? in
+		1)	fail "No such directory/port: $pdb/$EXPUNGE" ;;
+		2)	echo "===>>> $EXPUNGE matched multiple ports"
+			fail "The -e option works with only one port at a time" ;;
+		0)	EXPUNGE=${glob_dirs#$pdb/}
+			unset glob_dirs ;;
+		esac
 	fi
 
 	origin=`origin_from_pdb $EXPUNGE`



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