update to version 0.9.0

ADDED: CVS_CHECKSUM field to pkg_src_summary. This gives a way to
   compare two pkgsrc trees by comparing their pkg_src_summaries
   comparing not only an information about package versions but also
   an information about CVS files and their revisions.

      new script added: 'cvs_checksum' that analyses local cvs
      repository and lists all files in it with their revisions and,
      optionally, calculates a checksum for all this. Run
      'cvs_checksum -h' for more information. CKSUM environment
      variable sets a checksum program, by default, standard 'cksum'.

      pkg_src_summary can generate new field: CVS_CHECKSUM, a checksum
      calculated by 'cvs_checksum' program for a package. By default
      CVS_CHECKSUM is NOT generated.

      'pkg_cmp_summary -c' prints '!' (this means "not equal") for
      packages with the same versions but different CVS_CHECKSUM provided
      that CVS_CHECKSUM is set in both compared packages.
This commit is contained in:
Aleksey Cheusov 2008-06-14 07:41:36 +00:00 committed by Thomas Klausner
parent c6b90e0259
commit 28945ad237
9 changed files with 146 additions and 27 deletions

View file

@ -1,4 +1,5 @@
@comment $NetBSD: PLIST,v 1.5 2008/05/10 20:03:11 cheusov Exp $ @comment $NetBSD: PLIST,v 1.6 2008/06/14 07:41:36 cheusov Exp $
bin/cvs_checksum
bin/pkg_cmp_summary bin/pkg_cmp_summary
bin/pkg_grep_summary bin/pkg_grep_summary
bin/pkg_list_all_pkgs bin/pkg_list_all_pkgs
@ -9,6 +10,7 @@ bin/pkg_src_summary
bin/pkg_summary4view bin/pkg_summary4view
bin/pkg_update_src_summary bin/pkg_update_src_summary
bin/pkg_update_summary bin/pkg_update_summary
man/man1/cvs_checksum.1
man/man1/pkg_cmp_summary.1 man/man1/pkg_cmp_summary.1
man/man1/pkg_list_all_pkgs.1 man/man1/pkg_list_all_pkgs.1
man/man1/pkg_micro_src_summary.1 man/man1/pkg_micro_src_summary.1

View file

@ -17,11 +17,13 @@ SCRIPTS+= pkg_refresh_summary pkg_src_fetch_var
SCRIPTS+= pkg_micro_src_summary pkg_src_summary SCRIPTS+= pkg_micro_src_summary pkg_src_summary
SCRIPTS+= pkg_update_src_summary pkg_summary4view SCRIPTS+= pkg_update_src_summary pkg_summary4view
SCRIPTS+= pkg_update_summary pkg_grep_summary SCRIPTS+= pkg_update_summary pkg_grep_summary
SCRIPTS+= cvs_checksum
MAN= pkg_cmp_summary.1 pkg_micro_src_summary.1 MAN= pkg_cmp_summary.1 pkg_micro_src_summary.1
MAN+= pkg_src_summary.1 pkg_update_src_summary.1 MAN+= pkg_src_summary.1 pkg_update_src_summary.1
MAN+= pkg_summary4view.1 pkg_update_summary.1 MAN+= pkg_summary4view.1 pkg_update_summary.1
MAN+= pkg_refresh_summary.1 pkg_list_all_pkgs.1 MAN+= pkg_refresh_summary.1 pkg_list_all_pkgs.1
MAN+= cvs_checksum.1
FILES= README NEWS TODO pkg_grep_summary.awk FILES= README NEWS TODO pkg_grep_summary.awk

View file

@ -1 +1 @@
VERSION= 0.8.1 VERSION= 0.9.0

View file

@ -1,3 +1,24 @@
Version 0.9.0, by Aleksey Cheusov, Sat, 14 Jun 2008 10:38:55 +0300
ADDED: CVS_CHECKSUM field to pkg_src_summary. This gives a way to
compare two pkgsrc trees by comparing their pkg_src_summaries
comparing not only an information about package versions but also
an information about CVS files and their revisions.
new script added: 'cvs_checksum' that analyses local cvs
repository and lists all files in it with their revisions and,
optionally, calculates a checksum for all this. Run
'cvs_checksum -h' for more information. CKSUM environment
variable sets a checksum program, by default, standard 'cksum'.
pkg_src_summary can generate new field: CVS_CHECKSUM, a checksum
calculated by 'cvs_checksum' program for a package. By default
CVS_CHECKSUM is NOT generated.
'pkg_cmp_summary -c' prints '!' (this means "not equal") for
packages with the same versions but different CVS_CHECKSUM provided
that CVS_CHECKSUM is set in both compared packages.
Version 0.8.0, by Aleksey Cheusov Version 0.8.0, by Aleksey Cheusov
FIXED: pkg_src_summary pkgpath FIXED: pkg_src_summary pkgpath

View file

@ -0,0 +1,48 @@
.\" $NetBSD: cvs_checksum.1,v 1.1 2008/06/14 07:41:36 cheusov Exp $
.\"
.\" Copyright (c) 2008 by Aleksey Cheusov (vle@gmx.net)
.\" Absolutely no warranty.
.\"
.Dd Jan 29, 2008
.Dt CVS_CHECKSUM 1
.Sh NAME
.Nm cvs_checksum
.Nd outputs a checksum of all files with their revisions
from the working directory
.Sh SYNOPSIS
.Nm
.Op Ar cvsdirs ...
.Sh DESCRIPTION
.Nm
analyses CVS/Entries file and (with -l option) outputs a list of all
files with their revisions in the working CVS directory. By default
checksum is output.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl h
display help message
.It Fl l
List of files with their revisions are output
.El
.Sh ENVIRONMENT
.Bd -literal
.Bl -tag -width Cm
.It Cm CKSUM
problem for calculating a checksum, By default
the standard utility cksum is used.
.El
.Ed
.Sh EXAMPLES
.Bd -literal
cvs_checksum /usr/src/bin/sh
cvs_checksum -l /usr/pkgsrc/devel/libjudy /usr/pkgsrc/x11/xxkb
env CKSUM=md5 cvs_checksum /usr/src/bin/sh
.Ed
.Sh SEE ALSO
.Xr cvs 1 ,
.Xr cksum 1 ,
.Xr md5 1
.Sh AUTHOR
.An Aleksey Cheusov
.Aq vle@gmx.net

View file

@ -30,33 +30,36 @@ function usage (){
printf "\ printf "\
pkg_cmp_summary - compares two summary files\n\ pkg_cmp_summary - compares two summary files\n\
usage: pkg_cmp_summary -h\n\ usage: pkg_cmp_summary -h\n\
pkg_cmp_summary [-p] summary1 summary2\n\ pkg_cmp_summary [OPTIONS] summary1 summary2\n\
OPTIONS:\n\ OPTIONS:\n\
-h|--help display this help\n\ -h|--help display this help\n\
-p|--with-pkgpath use PKGPATH:PKGBASE pair for identifing a package\n\ -p|--with-pkgpath use PKGPATH:PKGBASE pair for identifing a package\n\
-c|--use-checksum also use CVS_CHECKSUM field in comparing packages\n\
" > "/dev/stderr" " > "/dev/stderr"
} }
BEGIN { BEGIN {
if (ARGV [1] ~ /^(-h|--help)$/){ skip = 0
usage() for (i = 1; i <= ARGC; ++i){
exit 0 if (ARGV [i] ~ /^(-h|--help)$/){
usage()
exit 0
}else if (ARGV [i] ~ /^(-p|--with-pkgpath)$/){
with_pkgpath = 1
ARGV [i] = ""
++skip
}else if (ARGV [i] ~ /^(-c|--use-checksum)$/){
use_checksum = 1
ARGV [i] = ""
++skip
}
} }
if (ARGV [1] ~ /^(-p|--with-pkgpath)$/){
with_pkgpath = 1
ARGV [1] = ""
if (ARGC != 4){ if (ARGC-skip != 3){
usage() usage()
exit 1 exit 1
}
skip = 1
}else{
if (ARGC != 3){
usage()
exit 1
}
} }
file1 = ARGV [1 + skip] file1 = ARGV [1 + skip]
@ -74,6 +77,11 @@ $0 ~ /^PKGNAME=/ {
next next
} }
use_checksum && $0 ~ /^CVS_CHECKSUM=/ {
checksum = trim(substr($0, 14))
next
}
with_pkgpath && $0 ~ /^PKGPATH=/ { with_pkgpath && $0 ~ /^PKGPATH=/ {
pkgpath = trim(substr($0, 9)) pkgpath = trim(substr($0, 9))
next next
@ -93,6 +101,12 @@ NF == 0 {
pkgbase = pkgname pkgbase = pkgname
sub(/-[^-]+$/, "", pkgbase) sub(/-[^-]+$/, "", pkgbase)
# current checksum
curr_checksum = checksum
# cleaning...
pkgname = pkgpath = checksum = ""
# #
if (FILENAME == file1){ if (FILENAME == file1){
# first file! # first file!
@ -100,6 +114,10 @@ NF == 0 {
duplicates [pkgbase] += 1 duplicates [pkgbase] += 1
}else{ }else{
names [pkgbase] = ver names [pkgbase] = ver
if (use_checksum){
checksums [pkgbase] = curr_checksum
}
} }
}else{ }else{
# second file! # second file!
@ -116,6 +134,17 @@ NF == 0 {
ver1 = names [pkgbase] ver1 = names [pkgbase]
res = dewey_cmp(ver1, ver) res = dewey_cmp(ver1, ver)
if (use_checksum && res == "="){
prev_checksum = checksums [pkgbase]
if (prev_checksum != "" &&
curr_checksum != "" &&
prev_checksum != curr_checksum)
{
res = "!"
}
}
print res, pkgbase, ver1, ver print res, pkgbase, ver1, ver
} }

View file

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_cmp_summary.1,v 1.4 2008/04/27 11:40:50 cheusov Exp $ .\" $NetBSD: pkg_cmp_summary.1,v 1.5 2008/06/14 07:41:36 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.
@ -30,10 +30,12 @@ Format of the results:
< second file contains newer version < second file contains newer version
> second file contains earlier version > second file contains earlier version
? versions are incomparable (incorrect version, for example) ? versions are incomparable (incorrect version, for example)
! versions are not equal (versions themselves are the same but
CVS_CHECKSUMs are different)
. .
PKGBASE is PKGNAME with version stripped, PKGBASE is PKGNAME with version stripped,
VER1 and VER2 are package versions. VER2 is present only if VER1 and VER2 are package versions.
R is `<' or `>'. PKGPATH appears in output if -p option is specified. PKGPATH appears in output if -p option is specified.
.Pp .Pp
The options are as follows: The options are as follows:
.Bl -tag -width indent .Bl -tag -width indent
@ -42,6 +44,8 @@ display help message
.It Fl p .It Fl p
use PKGPATH:PKGBASE pair for identifing a package, by default only PKGBASE use PKGPATH:PKGBASE pair for identifing a package, by default only PKGBASE
is used to identify the package. is used to identify the package.
.It Fl c
use CVS_CHECKSUM field for comparing in addition to PKGNAME (and PKGPATH)
.El .El
.Sh AUTHOR .Sh AUTHOR
.An Aleksey Cheusov .An Aleksey Cheusov

View file

@ -56,7 +56,7 @@ EOF
# list of fields for default pkg_src_summary # list of fields for default pkg_src_summary
if test -z "$PSS_FIELDS"; then if test -z "$PSS_FIELDS"; then
PSS_FIELDS='PKGNAME PKGPATH DEPENDS BUILD_DEPENDS CONFLICTS HOMEPAGE COMMENT LICENSE ONLYFOR NOTFOR MAINTAINER CATEGORIES DESCRIPTION PLIST' PSS_FIELDS='PKGNAME PKGPATH DEPENDS BUILD_DEPENDS CONFLICTS HOMEPAGE COMMENT LICENSE ONLYFOR NOTFOR MAINTAINER CATEGORIES DESCRIPTION PLIST' # CVS_CHECKSUM'
fi fi
if test -z "$PSS_PPERS"; then if test -z "$PSS_PPERS"; then
@ -95,8 +95,12 @@ fi
if echo "$PSS_FIELDS" | grep PLIST > /dev/null; then if echo "$PSS_FIELDS" | grep PLIST > /dev/null; then
field_plist=1 field_plist=1
fi fi
if echo "$PSS_FIELDS" | grep CVS_CHECKSUM > /dev/null; then
field_cvs_checksum=1
fi
varnames="`echo $PSS_FIELDS | varnames="`echo $PSS_FIELDS |
awk '{gsub(/PLIST/, \"\") awk '{gsub(/PLIST/, \"\")
gsub(/CVS_CHECKSUM/, \"\")
gsub(/ONLYFOR/, \"ONLY_FOR_PLATFORM\") gsub(/ONLYFOR/, \"ONLY_FOR_PLATFORM\")
gsub(/NOTFOR/, \"NOT_FOR_PLATFORM\") gsub(/NOTFOR/, \"NOT_FOR_PLATFORM\")
gsub(/DESCRIPTION/, \"DESCR_SRC\") gsub(/DESCRIPTION/, \"DESCR_SRC\")
@ -159,6 +163,13 @@ cd_and_print_summary (){
enrich_summary "$tmpfn" >"$summaryfn" || return 1 enrich_summary "$tmpfn" >"$summaryfn" || return 1
# CVS_CHECKSUM
if test "$field_cvs_checksum"; then
cvs_checksum $1 > "$tmpfn" || return 1
read cksum < "$tmpfn" || return 1
printf "CVS_CHECKSUM=%s\n" "$cksum" >>"$summaryfn" || return 1
fi
# not expanding PLIST yet # not expanding PLIST yet
if test "$field_plist"; then if test "$field_plist"; then
plist_fn=$1/PLIST plist_fn=$1/PLIST
@ -253,7 +264,7 @@ if test "$PSS_SLAVES"; then
qfields="$PSS_FIELDS" qfields="$PSS_FIELDS"
fi fi
environ="PSS_SLAVES= BMAKE=$BMAKE PKGSRCDIR=$PKGSRCDIR" environ="PSS_SLAVES= BMAKE=$BMAKE CKSUM=$CKSUM PKGSRCDIR=$PKGSRCDIR"
runpipe0 \ runpipe0 \
packages2stdout "$@" '|' \ packages2stdout "$@" '|' \

View file

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_src_summary.1,v 1.7 2008/05/11 21:53:18 cheusov Exp $ .\" $NetBSD: pkg_src_summary.1,v 1.8 2008/06/14 07:41:36 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.
@ -27,7 +27,9 @@ display help message
A list of fields (separated by space character) to be generated. By A list of fields (separated by space character) to be generated. By
default the following fields are generated: PKGNAME, PKGPATH, DEPENDS, default the following fields are generated: PKGNAME, PKGPATH, DEPENDS,
BUILD_DEPENDS, CONFLICTS, HOMEPAGE, COMMENT, LICENSE, ONLYFOR, NOTFOR, BUILD_DEPENDS, CONFLICTS, HOMEPAGE, COMMENT, LICENSE, ONLYFOR, NOTFOR,
MAINTAINER, CATEGORIES, DESCRIPTION (multiline), PLIST(multiline). MAINTAINER, CATEGORIES,
DESCRIPTION (multiline), PLIST(multiline).
The following are NOT generated by default: CVS_CHECKSUM.
.It Fl p .It Fl p
use 'bmake plist' for obtaining PLIST use 'bmake plist' for obtaining PLIST
.El .El