X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fautomake.mk;h=5c8ab3c23b97151edb82fa8105c47b47e7e48972;hb=748e066e5d23c4d6220f2d5702e3272f61bfb70c;hp=93c6f92eaf6dfe7ac1eb0d8a88b4fa7b7cc48152;hpb=fca426efdad5e21a55f4a106ce7b2f0d1c4a5875;p=openvswitch diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 93c6f92e..5c8ab3c2 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -49,20 +49,36 @@ vswitchd/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES) mv $@.tmp $@ # vswitch E-R diagram -if BUILD_ER_DIAGRAMS -$(srcdir)/vswitchd/vswitch.pic: ovsdb/ovsdb-dot.in vswitchd/vswitch.ovsschema - $(OVSDB_DOT) $(srcdir)/vswitchd/vswitch.ovsschema \ - | dot -T pic \ - | sed -e "/^'/d" \ - -e '/^box attrs0/d' \ - -e 's/linethick = 0;/linethick = 1;/' \ - > $@.tmp - mv $@.tmp $@ +# +# There are two complications here. First, if "python" or "dot" is not +# available, then we have to just use the existing diagram. Second, different +# "dot" versions produce slightly different output for the same input, but we +# don't want to gratuitously change vswitch.pic if someone tweaks the schema in +# some minor way that doesn't affect the table structure. To avoid that we +# store a checksum of vswitch.gv in vswitch.pic and only regenerate vswitch.pic +# if vswitch.gv actually changes. +$(srcdir)/vswitchd/vswitch.gv: ovsdb/ovsdb-dot.in vswitchd/vswitch.ovsschema +if HAVE_PYTHON + $(OVSDB_DOT) $(srcdir)/vswitchd/vswitch.ovsschema > $@ else -$(srcdir)/vswitchd/vswitch.pic: ovsdb/ovsdb-dot.in vswitchd/vswitch.ovsschema touch $@ endif -EXTRA_DIST += vswitchd/vswitch.pic +$(srcdir)/vswitchd/vswitch.pic: $(srcdir)/vswitchd/vswitch.gv ovsdb/dot2pic +if HAVE_DOT + sum=`cksum < $(srcdir)/vswitchd/vswitch.gv`; \ + if grep "$$sum" $@ >/dev/null 2>&1; then \ + echo "vswitch.gv unchanged, not regenerating vswitch.pic"; \ + touch $@; \ + else \ + echo "regenerating vswitch.pic"; \ + (echo ".\\\" Generated from vswitch.gv with cksum \"$$sum\""; \ + dot -T plain < $(srcdir)/vswitchd/vswitch.gv \ + | $(srcdir)/ovsdb/dot2pic) > $@; \ + fi +else + touch $@ +endif +EXTRA_DIST += vswitchd/vswitch.gv vswitchd/vswitch.pic # vswitch schema documentation EXTRA_DIST += vswitchd/vswitch.xml @@ -76,3 +92,17 @@ vswitchd/ovs-vswitchd.conf.db.5: \ $(srcdir)/vswitchd/vswitch.ovsschema \ $(srcdir)/vswitchd/vswitch.xml > $@.tmp mv $@.tmp $@ + +# 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 "$?:$$ln: checksum \"$$sum\" does not match (you should probably update the version number and fix the checksum)"; \ + exit 1; \ + fi +CLEANFILES += vswitchd/vswitch.ovsschema.stamp