added: -a and -r options

added: PSS_OPTIONS environment variable
minor fixes in man page
This commit is contained in:
Aleksey Cheusov 2008-06-14 09:26:09 +00:00 committed by Thomas Klausner
parent d11c345409
commit 0063ab1c53
2 changed files with 75 additions and 32 deletions

View file

@ -47,10 +47,15 @@ usage:
OPTIONS:
-h|--help display this help message
-p|--make-plist generate PLIST using 'bmake plist'
-f|--fields <filename>
-f|--fields=<filename> fields to be included too summary,
-f|--fields <fields>
-f|--fields=<fields> list of fields (separated by space or comma)
to be included to summary,
by default FULL summary is generated
-s|--slave-mode ready for use as paexec slave/remote program
-a|--add-fields <fields> add the specified fields to the list
of default ones
-r|--rem-fields <fields> remove the specified fields from the list
of default ones
EOF
}
@ -63,31 +68,59 @@ if test -z "$PSS_PPERS"; then
PSS_PPERS=10
fi
while test $# -ne 0; do
case "$1" in
-h|--help)
usage
exit 0;;
-f|--fields)
PSS_FIELDS="$2"
shift;;
-f=*|--fields=*)
PSS_FIELDS="$(echo $1 | cut -f2 -d=)";;
-s|--slave-mode)
slave=1;;
-p|--make-plist)
make_plist=1;;
--)
shift
break;;
-*)
echo "Unrecognized option " $1 ". Type --help to see usage" 1>&2
exit 1;;
*)
break;;
esac
shift
done
add_fields (){
for f in "$@"; do
PSS_FIELDS="$PSS_FIELDS $f"
done
}
rem_fields (){
for f in "$@"; do
PSS_FIELDS="$(echo $PSS_FIELDS | sed s,$f,,g)"
done
}
process_options (){
while test $# -ne 0; do
case "$1" in
-h|--help)
usage
exit 0;;
-f|--fields)
PSS_FIELDS="$(echo $2 | tr , ' ')"
shift;;
-f=*|--fields=*)
PSS_FIELDS="$(echo $1 | cut -f2 -d= | tr , ' ')";;
-a|--add-fields)
add_fields $(echo $2 | tr , ' ')
shift;;
-a=*|--add-fields=*)
add_fields $(echo $1 | cut -f2 -d= | tr , ' ');;
-r|--rem-fields)
rem_fields $(echo $2 | tr , ' ')
shift;;
-r=*|--rem-fields=*)
rem_fields $(echo $1 | cut -f2 -d= | tr , ' ');;
-s|--slave-mode)
slave=1;;
-p|--make-plist)
make_plist=1;;
--)
shift
break;;
-*)
echo "Unrecognized option " $1 ". Type --help to see usage" 1>&2
exit 1;;
*)
break;;
esac
shift
done
pkgpaths="$@"
}
process_options $PSS_OPTIONS "$@"
if echo "$PSS_FIELDS" | grep DESCRIPTION > /dev/null; then
field_descr=1
@ -267,7 +300,7 @@ if test "$PSS_SLAVES"; then
environ="PSS_SLAVES= BMAKE=$BMAKE CKSUM=$CKSUM PKGSRCDIR=$PKGSRCDIR"
runpipe0 \
packages2stdout "$@" '|' \
packages2stdout $pkgpaths '|' \
paexec -l -n "$PSS_SLAVES" $PSS_TRANSPORT \
-c "env $environ $0 -s -f '$qfields'" > "$tempsummaryfn"
@ -279,6 +312,6 @@ else
PSS_PPERS=1 # one package per line for local running
runpipe0 \
packages2stdout "$@" '|' \
packages2stdout $pkgpaths '|' \
process_one_by_one
fi

View file

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_src_summary.1,v 1.8 2008/06/14 07:41:36 cheusov Exp $
.\" $NetBSD: pkg_src_summary.1,v 1.9 2008/06/14 09:26:09 cheusov Exp $
.\"
.\" Copyright (c) 2008 by Aleksey Cheusov (vle@gmx.net)
.\" Absolutely no warranty.
@ -24,12 +24,16 @@ The options are as follows:
.It Fl h
display help message
.It Fl f Ar fields
A list of fields (separated by space character) to be generated. By
A list of fields (separated by space character or comma) to be generated. By
default the following fields are generated: PKGNAME, PKGPATH, DEPENDS,
BUILD_DEPENDS, CONFLICTS, HOMEPAGE, COMMENT, LICENSE, ONLYFOR, NOTFOR,
MAINTAINER, CATEGORIES,
DESCRIPTION (multiline), PLIST(multiline).
The following are NOT generated by default: CVS_CHECKSUM.
The following fields are NOT generated by default: CVS_CHECKSUM.
.It Fl a Ar fields
Add the specified fields to the list of fields generated by default
.It Fl r Ar fields
Remove the specified fields from the list of fields generated by default
.It Fl p
use 'bmake plist' for obtaining PLIST
.El
@ -48,6 +52,9 @@ are run, this is useful for SMP machines.
Transport program like ssh or rsh to communicate with remote/slave hosts.
.It Cm PSS_PPERS
A number of packages per slave that are built at once, defaults to 10.
.It Cm PSS_OPTIONS
This variable specifies default options to be placed in front of
any explicit options.
.El
.Ed
.Sh EXAMPLES
@ -61,6 +68,9 @@ env BMAKE=/usr/pkg/bin/bmake \\
-f 'PKGNAME PKGPATH DEPENDS BUILD_DEPENDS' \\
< /tmp/packages.txt \\
pkg_list_all_pkgs | env PSS_SLAVES='+6' pkg_src_summary
env PSS_OPTIONS=-p pkg_update_src_summary /path/to/pkg_src_summary.txt
pkg_src_summary -a CVS_CHECKSUM x11/xxkb wip/distbb
pkg_src_summary -r LICENSE,PLIST,DESCR x11/xxkb wip/distbb
.Ed
.Sh SEE ALSO
.Xr pkg_summary 5 ,