[Buildbot-devel] Factories and filters

Brian Warner warner-buildbot at lothar.com
Thu Aug 4 00:29:31 UTC 2005

> Currently I'm subclassing Build and overriding isFileImportant(). 
> Unfortunately, this means that each time I reload the master config,
> it thinks that all the factories have changed.
> This happens because the build class is being defined in master.cfg,
> so each time master.cfg is re-loaded, the class is re-defined and is
> no longer equal to the old class.

A lot of buildbot classes inherit from a little utility class called
ComparableMixin, which lets you specify a list of attributes that should be
compared when trying to decide if something has been changed or not.

BuildFactory is one of these, so the comparison will take place in the
__cmp__ and __hash__ methods. You might be able to modify these methods to
compare (self.buildClass.__name__ and self.buildClass.version) instead of
just self.buildClass, and add a .version attribute to your Build subclass
which you increment each time you actually change something.

Stephen's approach is pretty clever, and might actually work too :). It
certainly would be easier than manually updating a .version stamp each time
you change anything.

> I'm not sure whether this will still be relevant with the new
> sceduler, but I'm having an annoying problem with the filtering of the
> build.

This particular problem (changes to isFileImportant) will go away, because
that method will be part of the Scheduler instead of the Build (in fact, most
of the need to subclass Build will go away). The same issue of how to tell
when a Scheduler has changed will remain, but the Builders will be tracked
independently, so changing isFileImportant won't touch the Builders at all.

hope that helps,

More information about the devel mailing list