ports/102695: [patch] port misc/portless: 0.2.4 => 0.2.5

Martin Kammerhofer dada at pluto.tugraz.at
Wed Aug 30 13:20:32 UTC 2006


>Number:         102695
>Category:       ports
>Synopsis:       [patch] port misc/portless: from 0.2.4 to 0.2.5
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 30 13:20:22 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Martin Kammerhofer
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
Graz Uni
>Environment:
System: FreeBSD Martin.liebt.Susi 6.1-STABLE FreeBSD 6.1-STABLE #0: Tue Aug 29 17:21:39 CEST 2006 toor at Martin.liebt.Susi:/usr/obj/usr/src/sys/P2B-S i386
>Description:
Addition of -W option and minor bug fixed where whitespace at begin/end of
portglob argument was not properly rejected.
>How-To-Repeat:
>Fix:
diff -ru /usr/ports/misc/portless/Makefile portless/Makefile
--- /usr/ports/misc/portless/Makefile	Tue Aug 15 18:44:18 2006
+++ portless/Makefile	Wed Aug 30 11:21:22 2006
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	portless
-PORTVERSION=	0.2.4
+PORTVERSION=	0.2.5
 CATEGORIES=	misc
 MASTER_SITES=	# empty
 DISTFILES=	# none
diff -ru /usr/ports/misc/portless/files/portless.1 portless/files/portless.1
--- /usr/ports/misc/portless/files/portless.1	Tue Aug 15 18:44:19 2006
+++ portless/files/portless.1	Wed Aug 30 11:36:44 2006
@@ -22,11 +22,11 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" @(#)portless.1,v 1.7 2006/08/13 10:23:14 martin Exp
+.\" @(#)portless.1,v 1.10 2006/08/30 09:36:44 martin Exp
 .\"
 .\" Note: The date here should be updated whenever a non-trivial
 .\" change is made to the manual page.
-.Dd August 13, 2006
+.Dd August 30, 2006
 .Dt PORTLESS 1
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Op Fl P Ar pager
 .Ar portglob...
 .Nm
-.Op Fl w
+.Op Fl W | w
 .Ar portglob...
 .Sh DESCRIPTION
 .Nm
@@ -58,7 +58,7 @@
 .It Fl I
 Ignore case when matching
 .Ar portglob
-against the ports tree. This option is only effective when
+against the ports tree. This option is only effective if
 .Ar portglob
 contains at least one unquoted globbing meta-character (
 .Sq Li * ,
@@ -93,8 +93,19 @@
 of directories matching
 .Ar portglob
 to stdout.
-This option is incompatible with all other options.
+.It Fl W
+Like
+.Fl w
+but echoes just the last two components of the directory (i.e.\&
+.Em category/portname
+) to stdout.
 .El
+.Lp
+Options
+.Fl W
+and
+.Fl w
+are incompatible with all other options.
 .Sh ENVIRONMENT
 The
 .Nm
@@ -129,8 +140,4 @@
 .Nm
 utility and this manual page were written by
 .An Martin Kammerhofer Aq mkamm at gmx.net .
-.Sh BUGS
-The
-.Fl w
-option is a retrofitted hack.
 .\" EOF
diff -ru /usr/ports/misc/portless/files/portless.sh portless/files/portless.sh
--- /usr/ports/misc/portless/files/portless.sh	Tue Aug 15 18:44:19 2006
+++ portless/files/portless.sh	Wed Aug 30 11:21:22 2006
@@ -1,6 +1,6 @@
 #! @BASH@ --
 # (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*-
-# @(#)portless.sh,v 1.11 2006/08/13 10:23:14 martin Exp
+# @(#)portless.sh,v 1.12 2006/08/30 09:21:22 martin Exp
 # Show "pkg-descr" file of matching port(s).
 #
 # Copyright (c) 2006 Martin Kammerhofer <mkamm at gmx.net>
@@ -29,7 +29,7 @@
 Script=`basename $0` # name of this script
 
 # set defaults
-for opt in d f I i M m p w; do
+for opt in d f I i M m P p W w; do
     eval opt_$opt=""
 done
 PORTSDIR=${PORTSDIR:-/usr/ports}
@@ -45,7 +45,7 @@
 	echo >&2 "$Script: $1"
 	shift
     done
-    echo >&2 "usage: $Script [-dfIiMmpw] [-P pager] 'portglob'..."
+    echo >&2 "usage: $Script [-dfIiMmp | -Ww] [-P pager] 'portglob'..."
     exit 64	# EX_USAGE
 }
 
@@ -60,20 +60,21 @@
 }
 
 # process options
-while getopts "D:dfIiMmpP:wx" option
+while getopts "D:dfIiMmpP:Wwx" option
   do
   case "$option" in
       (D) PORTSDIR="$OPTARG";;		# undocumented
       (d) addopt d "$PKGDESCR";;
       (f) opt_f="f";;
       (I) shopt -s nocaseglob ||
-      usage "Option -I needs bash!"
+      usage "option -I needs bash!"
       opt_I="I";;
       (i) addopt i "distinfo";;
       (M) addopt M "Makefile";;
       (m) addopt m "pkg-message";;
       (p) addopt p "pkg-plist";;
-      (P) PAGER="$OPTARG";;
+      (P) PAGER="$OPTARG"; opt_P="P";;
+      (W) opt_W="W";;
       (w) opt_w="w";;
       (x) set -x;;			# undocumented
       (*) usage;;
@@ -81,12 +82,13 @@
 done
 shift $(($OPTIND - 1))
 [ -d "$PORTSDIR" ] || fatal "No such directory '$PORTSDIR'"
-if [ -n "$opt_w" ]; then
-    [ -n "$filelist" ] && usage "option -w not compatible with other options"
+if [ -n "$opt_W" -o -n "$opt_w" ]; then
+    [ -n "$filelist" -o -n "$opt_P" -o -n "$opt_W" -a -n "$opt_w" ] &&
+	usage "options -W and -w are not compatible with any other option!"
     PAGER="/bin/ls -1d"			# just echo directory name(s)
     filelist="."
 elif [ -n "$opt_f" -a -n "$opt_I" ]; then
-    usage "only one of options -f and -I is useful"
+    usage "only one of options -f and -I is useful!"
 else
     [ -n "$filelist" ] || filelist="$PKGDESCR"
 fi
@@ -105,7 +107,6 @@
     dirglob=$1
     portglob=$2
     shift 2
-    set +f
     for f in $filelist; do
 	if [ -n "$opt_f" ]; then
 	    set -- "$@" "$PORTSDIR"$dirglob"$portglob/$f"
@@ -113,14 +114,22 @@
 	    set -- "$@" "$PORTSDIR"$dirglob$portglob/"$f"
 	fi
     done
-    $PAGER "$@" || { rc=$?; return $rc; }	# remember last error code
+    if [ -n "$opt_W" -o -n "$opt_w" ]; then
+	lstrip=""
+	[ -n "$opt_W" ] && lstrip=-e\ 's;^.*/\([^/]*/[^/]*\)$;\1;'
+	{
+	    $PAGER "$@" | grep -Ev '/distfiles/|/packages/' |
+	    sed -e 's;/.$;;' $lstrip
+	} || { rc=$?; return $rc; }		# remember last error code
+    else
+	$PAGER "$@" || { rc=$?; return $rc; }	# remember last error code
+    fi
 }
 
 # main
 for p in "$@"; do
-    set -f
-    set -- $p
-    [ $# != 1 ] && usage "portglob '$p' contains whitespace!"
+    expr "$p" : ".*[$IFS]" >/dev/null &&
+	usage "portglob '$p' contains whitespace!"
     case "$p" in
 	(*/*/*)
 	usage "portglob '$p' contains more than one slash!";;
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list