[ovs-dev] [PATCH] docs: Only regenerate vswitch.pic when the schema really changes.

Justin Pettit jpettit at nicira.com
Thu Dec 2 20:24:32 UTC 2010


On Dec 1, 2010, at 5:08 PM, Ben Pfaff wrote:

> +# 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 the md5sum 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
> +	touch $@
> +endif
> +$(srcdir)/vswitchd/vswitch.pic: $(srcdir)/vswitchd/vswitch.gv ovsdb/dot2pic
> +if HAVE_DOT
> +	sum=`md5sum $(srcdir)/vswitchd/vswitch.gv | awk '{print $$1}'`;	\

Do we want to have some sort of check that md5sum actually exists?  For example, the (somewhat) equivalent called "md5" on my Mac.

> +	if grep $$sum $@ >/dev/null 2>&1; then		

I'm not sure how much of a concern this is, but if $sum is empty (e.g., there is no md5sum or the file vswitch.gv didn't exist), I think this could cause grep to hang.

Thanks for adding this functionality!

--Justin






More information about the dev mailing list