2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

cksum: Refine schema cksum validation

Calculates the cksum removing the cksum line using a more
strict regex than the used previously.
It fixes a problem when calculating the cksum of a schema that
has fields with the substring cksum (e.g.: a checksum column),
lines that the previous cksum calculation incorrectly removes
before running cksum.
Also, the tool calculate-schema-cksum is introduced. This tool
calculates the cksum of a schema file. It could be used in other
programs, instead of calculating the cksum in an eventually
different way than the expected by cksum-schema-check and other
tools.

Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Rodriguez Betancourt, Esteban 2016-04-15 23:08:47 +00:00 committed by Ben Pfaff
parent 7ab0b62b34
commit 3991685855
3 changed files with 7 additions and 1 deletions

View File

@ -107,6 +107,7 @@ EXTRA_DIST = \
boot.sh \ boot.sh \
build-aux/cccl \ build-aux/cccl \
build-aux/cksum-schema-check \ build-aux/cksum-schema-check \
build-aux/calculate-schema-cksum \
build-aux/dist-docs \ build-aux/dist-docs \
build-aux/sodepends.pl \ build-aux/sodepends.pl \
build-aux/soexpand.pl \ build-aux/soexpand.pl \

View File

@ -0,0 +1,4 @@
#!/bin/sh
schema=$1
sed '/"cksum": *"[0-9][0-9]* [0-9][0-9]*",/d' $schema | cksum

View File

@ -3,7 +3,8 @@
schema=$1 schema=$1
stamp=$2 stamp=$2
sum=`sed '/cksum/d' $schema | cksum` cksumcheckpath=`dirname $0`
sum=`$cksumcheckpath/calculate-schema-cksum $schema`
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $schema` expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $schema`
if test "X$sum" = "X$expected"; then if test "X$sum" = "X$expected"; then
touch $stamp touch $stamp