[Zope3-dev] Re: zc.buildout: When is recipe.install run?
Martijn Faassen
faassen at infrae.com
Tue Sep 12 09:03:45 EDT 2006
Hey,
[posting this to zope3-dev too so the discussion thread there is
somewhat intact]
Jim Fulton wrote:
>
> On Sep 12, 2006, at 8:32 AM, Daniel Nouri wrote:
>
>> While using buildout in our recent project[1] we have discovered that
>> some recipe's `install` method is being run although neither the
>> recipe nor the configuration has changed.
>
> The install method is always called. Clever install methods can usually
> decode how much work to do depending on the presense of installed files.
Why should install methods have to be this clever? Having this
capability also puts a bit of a burden on the install method, which
wouldn't be the case if this would be handled by an 'update' method.
[snip]
>> And shouldn't the parts directory be cleaned up everytime I am run?
>
> No. The buildout software never cleans out the parts directory. It
> removes paths returned from prior calls to install if and only if the
> configuration or recipe has changed,
>
>> I was thinking that an `update` method would be useful for recipes to
>> check if they need to do something even if recipe and configuration
>> are the same. Any recipe that checks out from SVN would be using that
>> update method.
>
> If you want to do an svn update, do it in install.
We actually didn't have the goal of doing an svn update at all. In fact,
we have a buildout that really shouldn't do anything if it's already
installed, and we were forced to add code to our buildout that checks
for the part being already present and bailing out if so. The 'svn
update' usecase is the reason we could think of why install is always
called, even if recipe and buildout config hasn't changed.
Right now the install method can be called in a number of different cases:
a) when the part isn't there yet
b) when the part is there, and the configuration or recipe has changed.
In this case the part is removed again automatically, so this is
equivalent to a).
c) when the part is there, and the recipe and configuration have not
changed. In this case there needs to be code that bails out if the part
is there and looks okay, or alternatively update code that updates the
part (svn up).
Case c) looks different. If there was an update method that got called
in case c), the install method wouldn't need to be called anymore, and:
* the install method can *always* assume the part isn't there and that
it needs to freshly install it.
* the update method can *always* assume the part is already there and it
needs to be updated (if necessary).
* we don't need to implement our 'bail-out' method in install anymore.
Regards,
Martijn
More information about the Zope3-dev
mailing list