Date: Wed, 14 Jun 2006 19:00:18 +0200 From: Martin Kammerhofer <dada@pluto.tugraz.at> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/98950: [maintainer update] upgrade misc/portless to 0.2 Message-ID: <200606141700.k5EH0IST013695@pluto.tugraz.at> Resent-Message-ID: <200606141710.k5EHANOM030024@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 98950 >Category: ports >Synopsis: [maintainer update] upgrade misc/portless to 0.2 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Wed Jun 14 17:10:23 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 #6: Wed Jun 7 12:03:19 CEST 2006 toor@Martin.liebt.Susi:/usr/src/sys/i386/compile/P2B-S i386 >Description: Upgrade to 0.2. Make file selection options cumulative rather than mutually exclusive. >How-To-Repeat: >Fix: diff -ruN /usr/ports/misc/portless/Makefile misc/portless/Makefile --- /usr/ports/misc/portless/Makefile Tue Jun 13 02:21:54 2006 +++ misc/portless/Makefile Wed Jun 14 11:56:41 2006 @@ -6,7 +6,7 @@ # PORTNAME= portless -PORTVERSION= 0.1.1 +PORTVERSION= 0.2 CATEGORIES= misc MASTER_SITES= # empty DISTFILES= # none diff -ruN /usr/ports/misc/portless/files/portless.1 misc/portless/files/portless.1 --- /usr/ports/misc/portless/files/portless.1 Sun Jun 11 11:43:46 2006 +++ misc/portless/files/portless.1 Wed Jun 14 14:44:25 2006 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)portless.1,v 1.1 2006/06/08 10:10:56 martin Exp +.\" @(#)portless.1,v 1.2 2006/06/14 12:44:25 martin Exp .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. @@ -94,12 +94,13 @@ .It Pa /usr/ports/*/*/* .El .Sh EXAMPLES -The following is an example of a typical usage -of the +The following are examples of typical usage of the .Nm command: .Pp -.Dl "portless gcc\e*" +.Dl "portless cvsweb\e*" +.Dl "portless lang/\e*doc" +.Dl "portless 'www/*python*'" .Sh AUTHOR The .Nm diff -ruN /usr/ports/misc/portless/files/portless.sh misc/portless/files/portless.sh --- /usr/ports/misc/portless/files/portless.sh Tue Jun 13 02:21:54 2006 +++ misc/portless/files/portless.sh Wed Jun 14 15:02:37 2006 @@ -1,6 +1,6 @@ #! /bin/sh -- # (X)Emacs: -*- mode: Shell-Script; coding: iso8859-1; -*- -# @(#)portless.sh,v 1.3 2006/06/08 10:10:56 martin Exp +# @(#)portless.sh,v 1.7 2006/06/14 13:02:37 martin Exp # Show "pkg-descr" file of matching port(s). # # Copyright (c) 2006 Martin Kammerhofer <mkamm@gmx.net> @@ -29,10 +29,14 @@ Script=`basename $0` # name of this script # set defaults -opt_f="" +for opt in d f i M m p; do + eval opt_$opt="" +done PORTSDIR=${PORTSDIR:-/usr/ports} PAGER=${PAGER:-less -e} PKGDESCR="pkg-descr" +filelist="" +rc=0 # print usage message to stderr and exit usage() @@ -45,48 +49,76 @@ exit 64 # EX_USAGE } +fatal() { echo >&2 "$Script: $*"; exit 70; } # EX_SOFTWARE + +# Add file $2 corresponding to option $1 to $filelist. +# Do not add any file twice. +addopt() +{ + eval "[ -n \"\$opt_$1\" ] && return; opt_$1='$1' || fatal 'addopt $*'" + filelist="$filelist $2" +} + # process options -while getopts "D:dfiMmpP:" option +while getopts "D:dfiMmpP:x" option do case "$option" in - (D) PORTSDIR="$OPTARG";; - (d) PKGDESCR="pkg-descr";; + (D) PORTSDIR="$OPTARG";; # undocumented + (d) addopt d "$PKGDESCR";; (f) opt_f="f";; - (i) PKGDESCR="distinfo";; - (M) PKGDESCR="Makefile";; - (m) PKGDESCR="pkg-message";; - (p) PKGDESCR="pkg-plist";; + (i) addopt i "distinfo";; + (M) addopt M "Makefile";; + (m) addopt m "pkg-message";; + (p) addopt p "pkg-plist";; (P) PAGER="$OPTARG";; + (x) set -x;; # undocumented (*) usage;; esac done shift $(($OPTIND - 1)) +[ -d "$PORTSDIR" ] || fatal "No such directory '$PORTSDIR'" +[ -n "$filelist" ] || filelist="$PKGDESCR" # there must be at least one argument if [ $# = 0 ]; then usage fi +# View $PORTSDIR$1$2/{$filelist} with $PAGER. +# Always glob $1 but do not glob $2 when option -f was given. +# (Slightly complicated because /bin/sh may not understand +# csh-like {file1,file2} glob patterns.) +page() { + [ $# = 2 ] || fatal "page $*" + dirglob=$1 + portglob=$2 + shift 2 + for f in $filelist; do + if [ -n "$opt_f" ]; then + set -- "$@" "$PORTSDIR"$dirglob"$portglob/$f" + else + set -- "$@" "$PORTSDIR"$dirglob$portglob/"$f" + fi + done + $PAGER "$@" || { rc=$?; return $rc; } # remember last error code +} + # main for p in "$@"; do + set -- $p + [ $# != 1 ] && usage "portglob '$p' contains whitespace!" case "$p" in (*/*/*) usage "portglob '$p' contains more than one slash!";; (*/*) - if [ -n "$opt_f" ]; then - $PAGER "$PORTSDIR/$p/$PKGDESCR" - else - $PAGER "$PORTSDIR"/$p/"$PKGDESCR" - fi;; + page "/" "$p";; (*) - if [ -n "$opt_f" ]; then - $PAGER "$PORTSDIR"/[a-z]*/"$p/$PKGDESCR" - else - $PAGER "$PORTSDIR"/[a-z]*/$p/"$PKGDESCR" - fi;; + page "/[a-z]*/" "$p";; esac done + +exit $rc #EOF# diff -ruN /usr/ports/misc/portless/pkg-descr misc/portless/pkg-descr --- /usr/ports/misc/portless/pkg-descr Sun Jun 11 11:43:46 2006 +++ misc/portless/pkg-descr Wed Jun 14 14:44:23 2006 @@ -1,9 +1,11 @@ -portless is a small shell script which lets FreeBSD users quickly browse -port descriptions given the port's name or a glob. Basically to view -the descriptions of GCC (related) ports you type +The portless utility is a small shell script which lets FreeBSD users +quickly browse port descriptions given the port's name or a +glob. Basically to view the descriptions of GCC (related) ports you +simply type portless gcc\* -and portless will display the descriptions of all gcc* ports. -There are options to display the postinstall messages or Makefiles instead. +and it will display all descriptions of the gcc* ports. +There are options to display the port's postinstall message or +Makefile too. A manpage is included. - Martin Kammerhofer mkamm@gmx.net >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606141700.k5EH0IST013695>