Two new option was added to pkg_grep_summary: -s and -m
which make it easier for use Manual page was updated. More regression tests for pkg_grep_summary.
This commit is contained in:
parent
f596be3e97
commit
eb572c2d1b
4 changed files with 143 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: pkg_grep_summary.1,v 1.7 2008/11/07 17:55:46 cheusov Exp $
|
.\" $NetBSD: pkg_grep_summary.1,v 1.8 2009/03/31 18:48:01 cheusov Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2008 by Aleksey Cheusov (vle@gmx.net)
|
.\" Copyright (c) 2008 by Aleksey Cheusov (vle@gmx.net)
|
||||||
.\" Absolutely no warranty.
|
.\" Absolutely no warranty.
|
||||||
|
@ -24,6 +24,10 @@ pkg_grep_summary \- tool for grepping pkgsrc summary file
|
||||||
.br
|
.br
|
||||||
.BI "pkg_grep_summary -e" " field"
|
.BI "pkg_grep_summary -e" " field"
|
||||||
.br
|
.br
|
||||||
|
.BI "pkg_grep_summary -m" " field regexp"
|
||||||
|
.br
|
||||||
|
.BI "pkg_grep_summary -s" " field string"
|
||||||
|
.br
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B pkg_grep_summary
|
.B pkg_grep_summary
|
||||||
outputs a summary information about packages that matches
|
outputs a summary information about packages that matches
|
||||||
|
@ -45,10 +49,24 @@ display help message
|
||||||
.TP
|
.TP
|
||||||
.BI "-e" " field"
|
.BI "-e" " field"
|
||||||
outputs summaries in which
|
outputs summaries in which
|
||||||
.B "field"
|
.I "field"
|
||||||
is either empty or absent
|
is either empty or absent
|
||||||
|
.TP
|
||||||
|
.BI "-m" " field regexp"
|
||||||
|
outputs summary if
|
||||||
|
.I "regexp"
|
||||||
|
matches the
|
||||||
|
.I "field"
|
||||||
|
.TP
|
||||||
|
.BI "-s" " field string"
|
||||||
|
outputs summary if
|
||||||
|
.I "field"
|
||||||
|
is equal to
|
||||||
|
.I "string"
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.VB
|
.VB
|
||||||
|
pkg_grep_summary -s 'PKGPATH' 'devel/libjudy'
|
||||||
|
pkg_grep_summary -m 'PKGPATH' '^wip/'
|
||||||
pkg_grep_summary 'PKGNAME' 'fvalue ~ /judy/' \\
|
pkg_grep_summary 'PKGNAME' 'fvalue ~ /judy/' \\
|
||||||
< /usr/pkgsrc/packages/pkg_summary.txt
|
< /usr/pkgsrc/packages/pkg_summary.txt
|
||||||
pkg_grep_summary 'PKGPATH' 'fvalue ~ /^lang\\//' \\
|
pkg_grep_summary 'PKGPATH' 'fvalue ~ /^lang\\//' \\
|
||||||
|
|
|
@ -30,26 +30,32 @@ pkg_grep_summary - output summaries about packages that matches
|
||||||
the specified condition.
|
the specified condition.
|
||||||
|
|
||||||
USAGE: pkg_grep_summary -h
|
USAGE: pkg_grep_summary -h
|
||||||
pkg_grep_summary <FIELD> <AWK_CONDITION>
|
pkg_grep_summary -e <field>
|
||||||
pkg_grep_summary -e <FIELD>
|
pkg_grep_summary -m <field> <regexp>
|
||||||
<FIELD> - PKGNAME, PKGPATH, DEPENDS etc.
|
pkg_grep_summary -s <field> <string>
|
||||||
<AWK_CONDITION> - boolean expression written in AWK language
|
pkg_grep_summary <field> <awk_condition>
|
||||||
|
<field> - PKGNAME, PKGPATH, DEPENDS etc.
|
||||||
|
<awk_condition> - boolean expression written in AWK language
|
||||||
|
<regexp> - AWK regular expression
|
||||||
|
<string> - text string
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-h|--help display this message
|
-h|--help display this message
|
||||||
-e|--empty <field> matches empty and absent fields only
|
-e|--empty matches empty and absent fields only
|
||||||
(equivalent to '<field>' 'fvalue == ""')
|
(equivalent to '<field>' 'fvalue == ""')
|
||||||
|
-m matches <field> against regular expression <regexp>
|
||||||
|
-s matches <field> equal to <string>
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
|
pkg_grep_summary -s 'PKGPATH' 'devel/libjudy'
|
||||||
|
pkg_grep_summary -m 'PKGPATH' '^wip/'
|
||||||
pkg_grep_summary 'PKGNAME' 'fvalue ~ /judy/' \\
|
pkg_grep_summary 'PKGNAME' 'fvalue ~ /judy/' \\
|
||||||
< /usr/pkgsrc/packages/pkg_summary.txt
|
|
||||||
pkg_grep_summary 'PKGPATH' 'fvalue ~ /^lang\//' \\
|
pkg_grep_summary 'PKGPATH' 'fvalue ~ /^lang\//' \\
|
||||||
< /usr/pkgsrc/packages/pkg_summary.txt
|
< /usr/pkgsrc/packages/pkg_summary.txt
|
||||||
pkg_grep_summary 'DEPENDS' 'fvalue ~ /libX/' \\
|
pkg_grep_summary 'DEPENDS' 'fvalue ~ /libX/' \\
|
||||||
< /usr/pkgsrc/pkg_src_summary.txt
|
|
||||||
pkg_grep_summary 'COMMENT' 'toupper(fvalue) ~ /DNS/' \\
|
pkg_grep_summary 'COMMENT' 'toupper(fvalue) ~ /DNS/' \\
|
||||||
< /usr/pkgsrc/pkg_src_summary.txt
|
|
||||||
pkg_grep_summary -e 'NO_BIN_ON_FTP' \\
|
pkg_grep_summary -e 'NO_BIN_ON_FTP' \\
|
||||||
< /usr/pkgsrc/pkg_src_summary.txt
|
< /usr/pkgsrc/pkg_src_summary.txt
|
||||||
|
pkg_grep_summary -e 'NO_BIN_ON_CDROM'
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +65,18 @@ while test $# -ne 0; do
|
||||||
usage
|
usage
|
||||||
exit 0;;
|
exit 0;;
|
||||||
-e|--empty)
|
-e|--empty)
|
||||||
empty_field=$2
|
empty=1
|
||||||
|
field=$2
|
||||||
|
shift;;
|
||||||
|
-s)
|
||||||
|
field=$2
|
||||||
|
string=$3
|
||||||
|
shift
|
||||||
|
shift;;
|
||||||
|
-m)
|
||||||
|
field=$2
|
||||||
|
regex=$3
|
||||||
|
shift
|
||||||
shift;;
|
shift;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
|
@ -73,21 +90,23 @@ while test $# -ne 0; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$empty_field" -a $# -ne 2 ||
|
if test -n "$empty"; then
|
||||||
test -n "$empty_field" -a $# -ne 0
|
condition='fvalue == ""'
|
||||||
then
|
elif test -n "$string"; then
|
||||||
usage
|
condition="fvalue == \"$string\""
|
||||||
exit 1
|
elif test -n "$regex"; then
|
||||||
fi
|
re=`echo $regex | sed 's|/|\\\/|g'`
|
||||||
|
condition="fvalue ~ /$re/"
|
||||||
if test -z "$empty_field"; then
|
elif test $# -eq 2; then
|
||||||
field=$1
|
field="$1"
|
||||||
condition="$2"
|
condition="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
else
|
fi
|
||||||
field="$empty_field"
|
|
||||||
condition='fvalue == ""'
|
if test -z "$condition" -o $# -ne 0; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runawk -e '
|
runawk -e '
|
||||||
|
|
|
@ -79,6 +79,82 @@ PKGNAME=png-1.2.32beta01
|
||||||
PKGNAME=netcat-1.10nb2
|
PKGNAME=netcat-1.10nb2
|
||||||
PKGNAME=pkg-config-0.23
|
PKGNAME=pkg-config-0.23
|
||||||
PKGNAME=jpeg-6bnb4
|
PKGNAME=jpeg-6bnb4
|
||||||
|
------- args: 'pkg_grep_summary' '-m' 'MAINTAINER' 'cheusov|vle@gmx.net'
|
||||||
|
PKGNAME=distbb-0.22.0
|
||||||
|
PKGPATH=wip/distbb
|
||||||
|
COMMENT=DISTributed Bulk Build tool for pkgsrc
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGPATH=textproc/dictem
|
||||||
|
COMMENT=Dictionary client (RFC-2229) for [X]Emacs
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
PKGNAME=dictem-0.82
|
||||||
|
|
||||||
|
COMMENT=Client/Server search in pkgsrc packages
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
PKGNAME=pkg_online-0.5.0nb2
|
||||||
|
PKGPATH=wip/pkg_online
|
||||||
|
|
||||||
|
PKGNAME=dict-server-1.10.11nb2
|
||||||
|
PKGPATH=wip/dict-server
|
||||||
|
COMMENT=Dictionary Service Protocol server
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=pkg_online-server-0.5.0
|
||||||
|
PKGPATH=wip/pkg_online-server
|
||||||
|
COMMENT=Client/Server search in pkgsrc packages (server tools)
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=pkg_online-client-0.5.0
|
||||||
|
PKGPATH=wip/pkg_online-client
|
||||||
|
COMMENT=Client/Server search in pkgsrc packages (client tools)
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=libmaa-1.0.1nb1
|
||||||
|
PKGPATH=devel/libmaa
|
||||||
|
COMMENT=Provides a few data structures and helpful functions
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=paexec-0.10.0nb1
|
||||||
|
PKGPATH=wip/paexec
|
||||||
|
COMMENT=Parallel executor, distributes tasks over network
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=runawk-0.14.3
|
||||||
|
PKGPATH=wip/runawk
|
||||||
|
COMMENT=Wrapper that impelements modules for AWK
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=pkg_summary-utils-0.18.1
|
||||||
|
PKGPATH=wip/pkg_summary-utils
|
||||||
|
COMMENT=Utilities for manipulating pkg_summary(5) files
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=dict-client-1.10.11nb2
|
||||||
|
PKGPATH=wip/dict-client
|
||||||
|
COMMENT=Dictionary Service Protocol client
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=pipestatus-0.4.0
|
||||||
|
PKGPATH=wip/pipestatus
|
||||||
|
COMMENT=UNIX/POSIX shell helper for running pipes safely
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
PKGNAME=awk-pkgsrc-dewey-0.5.6
|
||||||
|
PKGPATH=wip/awk-pkgsrc-dewey
|
||||||
|
COMMENT=Pkgsrc dewey module for AWK programming language
|
||||||
|
MAINTAINER=cheusov@tut.by
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
------- args: 'pkg_grep_summary' '-s' 'PKGPATH' 'graphics/png'
|
||||||
|
PKGNAME=png-1.2.32beta01
|
||||||
|
PKGPATH=graphics/png
|
||||||
|
BUILD_DEPENDS= libtool-base>=1.5.18nb5:../../devel/libtool-base checkperms>=1.1:../../sysutils/checkperms
|
||||||
|
HOMEPAGE=http://www.libpng.org/pub/png/
|
||||||
|
COMMENT=Library for manipulating PNG images
|
||||||
|
MAINTAINER=wiz@NetBSD.org
|
||||||
|
CATEGORIES=graphics
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
------- pkg_cmp_summary #1.1
|
------- pkg_cmp_summary #1.1
|
||||||
= awk-pkgsrc-dewey 0.5.6 0.5.6
|
= awk-pkgsrc-dewey 0.5.6 0.5.6
|
||||||
|
|
|
@ -49,6 +49,10 @@ runtest pkg_grep_summary COMMENT \
|
||||||
grep -E 'PKGNAME|---'
|
grep -E 'PKGNAME|---'
|
||||||
runtest pkg_grep_summary -e EXFIELD < src_summary.txt | \
|
runtest pkg_grep_summary -e EXFIELD < src_summary.txt | \
|
||||||
grep -E 'PKGNAME|---'
|
grep -E 'PKGNAME|---'
|
||||||
|
runtest pkg_grep_summary -m MAINTAINER 'cheusov|vle@gmx.net' < src_summary.txt |
|
||||||
|
grep -E 'PKGNAME|PKGPATH|^$|MAINTAINER|COMMENT'
|
||||||
|
|
||||||
|
runtest pkg_grep_summary -s PKGPATH graphics/png < src_summary.txt
|
||||||
|
|
||||||
# pkg_cmp_summary
|
# pkg_cmp_summary
|
||||||
echo '--------------------------------------------------'
|
echo '--------------------------------------------------'
|
||||||
|
@ -123,7 +127,7 @@ grep -v '^='
|
||||||
# pkg_summary4view
|
# pkg_summary4view
|
||||||
echo '--------------------------------------------------'
|
echo '--------------------------------------------------'
|
||||||
echo '------- pkg_summary4view #8'
|
echo '------- pkg_summary4view #8'
|
||||||
pkg_grep_summary PKGPATH 'fvalue == "wip/pkg_summary-utils"' \
|
pkg_grep_summary -s PKGPATH 'wip/pkg_summary-utils' \
|
||||||
< src_summary.txt | pkg_summary4view
|
< src_summary.txt | pkg_summary4view
|
||||||
|
|
||||||
echo '--------------------------------------------------'
|
echo '--------------------------------------------------'
|
||||||
|
@ -168,7 +172,7 @@ echo '------- pkg_src_summary #11'
|
||||||
pkg_src_summary -A -f PKGNAME,PKGPATH \
|
pkg_src_summary -A -f PKGNAME,PKGPATH \
|
||||||
graphics/py-cairo:PYTHON_VERSION_REQD=25 |
|
graphics/py-cairo:PYTHON_VERSION_REQD=25 |
|
||||||
grep -v DEPENDS |
|
grep -v DEPENDS |
|
||||||
pkg_grep_summary PKGPATH 'fvalue ~ /gmake|py-Numeric|py-cairo/' |
|
pkg_grep_summary -m PKGPATH 'gmake|py-Numeric|py-cairo' |
|
||||||
normalize_version
|
normalize_version
|
||||||
|
|
||||||
echo '--------------------------------------------------'
|
echo '--------------------------------------------------'
|
||||||
|
|
Loading…
Reference in a new issue