Skip to content

Commit

Permalink
automake: Consolidate schema checksum check.
Browse files Browse the repository at this point in the history
Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg committed Oct 2, 2015
1 parent 2db1b5d commit abc67c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 36 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ EXTRA_DIST = \
.travis/prepare.sh \
boot.sh \
build-aux/cccl \
build-aux/cksum-schema-check \
build-aux/dist-docs \
build-aux/sodepends.pl \
build-aux/soexpand.pl \
Expand Down
14 changes: 14 additions & 0 deletions build-aux/cksum-schema-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

schema=$1
stamp=$2

sum=`sed '/cksum/d' $schema | cksum`
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
20 changes: 2 additions & 18 deletions ovn/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,13 @@ EXTRA_DIST += \
# Version checking for ovn-nb.ovsschema.
ALL_LOCAL += ovn/ovn-nb.ovsschema.stamp
ovn/ovn-nb.ovsschema.stamp: ovn/ovn-nb.ovsschema
@sum=`sed '/cksum/d' $? | cksum`; \
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
if test "X$$sum" = "X$$expected"; then \
touch $@; \
else \
ln=`sed -n '/"cksum":/=' $?`; \
echo >&2 "$?:$$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
$(srcdir)/build-aux/cksum-schema-check $? $@
CLEANFILES += ovn/ovn-nb.ovsschema.stamp

# Version checking for ovn-sb.ovsschema.
ALL_LOCAL += ovn/ovn-sb.ovsschema.stamp
ovn/ovn-sb.ovsschema.stamp: ovn/ovn-sb.ovsschema
@sum=`sed '/cksum/d' $? | cksum`; \
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
if test "X$$sum" = "X$$expected"; then \
touch $@; \
else \
ln=`sed -n '/"cksum":/=' $?`; \
echo >&2 "$?:$$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
$(srcdir)/build-aux/cksum-schema-check $? $@
CLEANFILES += ovn/ovn-sb.ovsschema.stamp

include ovn/controller/automake.mk
Expand Down
10 changes: 1 addition & 9 deletions vswitchd/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,7 @@ vswitchd/ovs-vswitchd.conf.db.5: \
# Version checking for vswitch.ovsschema.
ALL_LOCAL += vswitchd/vswitch.ovsschema.stamp
vswitchd/vswitch.ovsschema.stamp: vswitchd/vswitch.ovsschema
@sum=`sed '/cksum/d' $? | cksum`; \
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
if test "X$$sum" = "X$$expected"; then \
touch $@; \
else \
ln=`sed -n '/"cksum":/=' $?`; \
echo >&2 "$?:$$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
$(srcdir)/build-aux/cksum-schema-check $? $@
CLEANFILES += vswitchd/vswitch.ovsschema.stamp

# Clean up generated files from older OVS versions. (This is important so that
Expand Down
10 changes: 1 addition & 9 deletions vtep/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,5 @@ vtep/vtep.5: \
# Version checking for vtep.ovsschema.
ALL_LOCAL += vtep/vtep.ovsschema.stamp
vtep/vtep.ovsschema.stamp: vtep/vtep.ovsschema
@sum=`sed '/cksum/d' $? | cksum`; \
expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
if test "X$$sum" = "X$$expected"; then \
touch $@; \
else \
ln=`sed -n '/"cksum":/=' $?`; \
echo >&2 "$?:$$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
$(srcdir)/build-aux/cksum-schema-check $? $@
CLEANFILES += vtep/vtep.ovsschema.stamp

0 comments on commit abc67c1

Please sign in to comment.