mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
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>
16 lines
528 B
Bash
Executable File
16 lines
528 B
Bash
Executable File
#!/bin/sh
|
|
|
|
schema=$1
|
|
stamp=$2
|
|
|
|
cksumcheckpath=`dirname $0`
|
|
sum=`$cksumcheckpath/calculate-schema-cksum $schema`
|
|
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $schema`
|
|
if test "X$sum" = "X$expected"; then
|
|
touch $stamp
|
|
else
|
|
ln=`sed -n '/"cksum":/=' $schema`
|
|
echo >&2 "$schema:$ln: The checksum \"$sum\" was calculated from the schema file and does not match cksum field in the schema file - you should probably update the version number and the checksum in the schema file with the value listed here."
|
|
exit 1
|
|
fi
|