[Distutils] buildout removes parts on any change

Jim Fulton jim at zope.com
Thu Sep 2 17:48:31 CEST 2010

On Thu, Sep 2, 2010 at 10:48 AM, felix <crucialfelix at gmail.com> wrote:
> hello,
> I'm quite fond of buildout, but a few things have taken me some months to
> really figure out.
> Buildout will remove any files installed by recipes when it senses that its
> top parts or eggs section has changed.
> I would love to avoid this as most of these removals are not needed, they
> just get the same thing reinstalled afterwards,
> lengthen the deploy time considerably and cause nasty surprises for the
> server if its actually running.
> Perhaps I'm not supposed to be using this for pushing changes to a live
> server ?  I'm using django and if anything changed
> on the top parts/eggs then it gets reinstalled
> (even from the download-cache this takes quite a while and causes bad
> burps on the server by removing templates)
> I see that there is a buildout::uninstall entry point for recipes to run
> extra code,  but no explicit uninstall method for the recipes.
> Would it be possible to allow the recipe to implement uninstall if it
> chooses to ?  My django deploy could then be made to be lightening quick.

It's not possible for a recipe to provide an uninstall method, but you
can provide an uninstall recipe, which I consider equivalent.  I'd be
open to allowing an uninstall method on a regular recipe, but this
wouldn't let you do anything you can't do now.

Buildout provides a default policy of removing installed files and
directories *reported by the install method*.  I think this is a
reasonable default policy.  It also allows a part to be uninstalled
even if the original recipe code is unavalable for some reason.

A recipe author can completely replace this default policy by:

- Not reporting any installed files in the install method of an
  install recipe, and by

- providing an uninstall recipe (entry point) that does whatever
  uninstall logic seems desireable.

As an aside, wrt production deployment:

- We use buildouts to build rpms used to deploy software. Deploying via a
  binary RPM (or a deb or whatever) is much faster than deploying via
  buildout, but there is still a small window in which files are replaced.
  This hasn't been a problem for us because our templates are held in
  memory (and reread from disk when changed).

- We use buildouts to install/update configuration files independent of
  software. Since the configuration files are written on process
  restarts, it's OK if they're missing for short periods of time.
  The recipes needed by this are installed as part of the software
  RPM, so there's no need to download anything and buildout is run in
  offline mode.


Jim Fulton

More information about the Distutils-SIG mailing list