pkg_bin_summary: -k option was added for enriching
package summary with checksums using algorithms supported by digest(1)
This commit is contained in:
parent
615c12a711
commit
d645586a85
3 changed files with 68 additions and 15 deletions
|
@ -1,8 +1,5 @@
|
||||||
TODO list and thoughts
|
TODO list and thoughts
|
||||||
|
|
||||||
pkg_bin_summary: support for field CKSUMS with environment vatiable
|
|
||||||
XXX containing md5, sha1 etc.
|
|
||||||
|
|
||||||
existing tools:
|
existing tools:
|
||||||
|
|
||||||
pkg_cmp_summary:
|
pkg_cmp_summary:
|
||||||
|
@ -38,7 +35,6 @@ existing tools:
|
||||||
- checks for bad patterns like foobar<=1.1.1nb*
|
- checks for bad patterns like foobar<=1.1.1nb*
|
||||||
- improve REQUIRES/PROVIDES checks, i.e. use
|
- improve REQUIRES/PROVIDES checks, i.e. use
|
||||||
PROVIDES from dependencies only
|
PROVIDES from dependencies only
|
||||||
- CONFLICTS vs. actual PLISTs in packages
|
|
||||||
- distfiles checksums
|
- distfiles checksums
|
||||||
- check binaries and their REQUIRES and analyse Makefile
|
- check binaries and their REQUIRES and analyse Makefile
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: pkg_bin_summary.1,v 1.4 2011/08/13 10:55:15 cheusov Exp $
|
.\" $NetBSD: pkg_bin_summary.1,v 1.5 2011/08/27 17:13:03 cheusov Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2010 by Aleksey Cheusov (vle@gmx.net)
|
.\" Copyright (c) 2010 by Aleksey Cheusov (vle@gmx.net)
|
||||||
.\" Absolutely no warranty.
|
.\" Absolutely no warranty.
|
||||||
|
@ -43,18 +43,31 @@ is applied,
|
||||||
.B pkg_bin_summary
|
.B pkg_bin_summary
|
||||||
does nothing in this case and exits immediately.
|
does nothing in this case and exits immediately.
|
||||||
.TP
|
.TP
|
||||||
.B "-a <fields>"
|
.BI "-a " fields
|
||||||
add to the output the specified fields,
|
add to the output the specified fields,
|
||||||
fields are separated by space or comma.
|
fields are separated by space or comma.
|
||||||
.TP
|
.TP
|
||||||
.B "-f <fields>"
|
.BI "-f " fields
|
||||||
output only specified fields,
|
output only specified fields,
|
||||||
fields are separated by space or comma.
|
fields are separated by space or comma.
|
||||||
.TP
|
.TP
|
||||||
.B "-r <fields>"
|
.BI "-r " fields
|
||||||
remove from output the specified fields,
|
remove from output the specified fields,
|
||||||
fields are separated by space or comma.
|
fields are separated by space or comma.
|
||||||
.TP
|
.TP
|
||||||
|
.BI "-k " algorithms
|
||||||
|
Generate checksums for packages using digest(1)
|
||||||
|
and make them a part of output summary. CKSUM field is added to summary
|
||||||
|
that has the following format:
|
||||||
|
.br
|
||||||
|
.VB
|
||||||
|
CKSUMS=<ALGO> <CKSUM>
|
||||||
|
.VE
|
||||||
|
where ALGO is is an
|
||||||
|
.I algorithm
|
||||||
|
supported by digest(1), for example, md5, sha1 etc.,
|
||||||
|
and CKSUM is a checksum.
|
||||||
|
.TP
|
||||||
PKG_INFO_ARGS are
|
PKG_INFO_ARGS are
|
||||||
options passed to pkg_info(1) that default to -a.
|
options passed to pkg_info(1) that default to -a.
|
||||||
In addition to these options -X is always applied to pkg_info
|
In addition to these options -X is always applied to pkg_info
|
||||||
|
@ -79,9 +92,12 @@ if PKG_INFO_ARGS is not empty.
|
||||||
find /usr/pkgsrc/packages/All -name '*.tgz' |
|
find /usr/pkgsrc/packages/All -name '*.tgz' |
|
||||||
xargs pkg_bin_summary -e -a PLIST
|
xargs pkg_bin_summary -e -a PLIST
|
||||||
|
|
||||||
|
ls -1 | grep '[.]tgz$' | xargs pkg_bin_summary -e -k 'sha1 rmd160'
|
||||||
|
|
||||||
.VE
|
.VE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR pkg_summary-utils(7) ,
|
.BR pkg_summary-utils(7) ,
|
||||||
.BR pkg_summary(5) ,
|
.BR pkg_summary(5) ,
|
||||||
|
.BR digest(1)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Aleksey Cheusov <vle@gmx.net>
|
Aleksey Cheusov <vle@gmx.net>
|
||||||
|
|
|
@ -53,6 +53,8 @@ OPTIONS:
|
||||||
-r <fields> remove from output the specified fields,
|
-r <fields> remove from output the specified fields,
|
||||||
fields are output only specified fields
|
fields are output only specified fields
|
||||||
-e does nothing if no packages were specified
|
-e does nothing if no packages were specified
|
||||||
|
-k <algorithms> generate checksums for binary packages
|
||||||
|
and make them a part of summary (CKSUM)
|
||||||
PKG_INFO_ARGS:
|
PKG_INFO_ARGS:
|
||||||
Options passed to pkg_info(1) that default to -a.
|
Options passed to pkg_info(1) that default to -a.
|
||||||
In addition to these options -X is always applied to pkg_info
|
In addition to these options -X is always applied to pkg_info
|
||||||
|
@ -66,14 +68,16 @@ Samples of use:
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts hea:r:f: f; do
|
while getopts hea:r:f:k: f; do
|
||||||
case "$f" in
|
case "$f" in
|
||||||
'?') exit 1;;
|
'?') exit 1;;
|
||||||
h) usage; exit 0;;
|
h) usage; exit 0;;
|
||||||
a) add_fields="$OPTARG";;
|
a) add_fields="$add_fields $OPTARG";;
|
||||||
r) rem_fields="$OPTARG";;
|
r) rem_fields="$OPTARG";;
|
||||||
f) only_fields="$OPTARG";;
|
f) only_fields="$OPTARG";;
|
||||||
e) explicit_pkgs=1;;
|
e) explicit_pkgs=1;;
|
||||||
|
k) cksums="$OPTARG"
|
||||||
|
add_fields="$add_fields FILE_NAME";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift `expr $OPTIND - 1`
|
shift `expr $OPTIND - 1`
|
||||||
|
@ -97,4 +101,41 @@ if test -n "$explicit_pkgs"; then
|
||||||
else
|
else
|
||||||
$PKG_INFO_CMD $pkg_info_opts "$@"
|
$PKG_INFO_CMD $pkg_info_opts "$@"
|
||||||
fi |
|
fi |
|
||||||
$LIBEXECDIR/XB2bin_summary -a "$add_fields" -r "$rem_fields" -f "$only_fields"
|
$LIBEXECDIR/XB2bin_summary -a "$add_fields" -r "$rem_fields" -f "$only_fields" |
|
||||||
|
if test -z "$cksums"; then
|
||||||
|
cat
|
||||||
|
else
|
||||||
|
## Add CKSUM field to summary
|
||||||
|
tmpdir=`mktemp -d /tmp/bin_summary.XXXXXX`
|
||||||
|
test -n "$tmpdir" || exit 1
|
||||||
|
|
||||||
|
# generate checksums
|
||||||
|
for i in $cksums; do
|
||||||
|
digest $i "$@" >> $tmpdir/cksums
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
awk -v cksums="$cksums" '
|
||||||
|
BEGIN { cksums_cnt = split(cksums, cksums_arr) }
|
||||||
|
FILENAME != "-" && $3 == "=" {
|
||||||
|
fn = substr($2, 2, length($2)-2)
|
||||||
|
sub(/^.*\//, "", fn)
|
||||||
|
cksum [fn, tolower($1)] = $4
|
||||||
|
}
|
||||||
|
FILENAME == "-" {
|
||||||
|
if (/^FILE_NAME=/)
|
||||||
|
fn = substr($0, 11)
|
||||||
|
|
||||||
|
if (NF > 0) {
|
||||||
|
print
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=1; i <= cksums_cnt; ++i){
|
||||||
|
cksum_type = cksums_arr [i]
|
||||||
|
print "CKSUM=" cksum_type " " cksum [fn, cksum_type]
|
||||||
|
}
|
||||||
|
fn = ""
|
||||||
|
print ""
|
||||||
|
}' $tmpdir/cksums -
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue