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

Ben Pfaff blp at nicira.com
Mon Dec 6 17:52:58 UTC 2010


On Thu, Dec 02, 2010 at 12:24:32PM -0800, Justin Pettit wrote:
> 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.

I didn't know that Mac didn't have md5sum.  I see that FreeBSD and
OpenBSD don't have it either.

I changed this to use the standard POSIX "cksum" utility instead.

> > +	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.

Good point.

I changed $$sum to "$$sum" here.

> Thanks for adding this functionality!

Thanks for the helpful review.  I'll test my changes and then push this.




More information about the dev mailing list