[Rpm-maint] FSM hooks for rpm plugin
pmatilai at laiskiainen.org
Mon Feb 4 13:42:14 UTC 2013
On 02/04/2013 02:18 PM, Reshetova, Elena wrote:
>> I've started to wonder about the hook names though: "open" and "close"
>> seem out of place especially here (and to lesser degree elsewhere).
>> Perhaps these hooks should simply follow the pre/post pattern even in the
>> names, ie FILE_PRE and FILE_POST. I think it'd be more descriptive wrt what
>> they actually do, and leave open and close free for possible later use for
>> the cases where a kind of open+close (files from payload
>> stream) is actually occurring.
> Sure, this is an easy change and I just did it. But the one below has made me
> a headache :(
>> This gets quite ugly indeed, better refactor the surrounding code (which is
>> ugly in itself) to allow for nice clean pairing. Oh and btw, this version of
>> the patch introduces a new asymmetry case: if the open-hook fails, close-hook
>> wont get called. It'll need something like open-hook just flagging postpone
>>> without terminating the loop, and adjusting the rest of the code to deal
>> with it. I'll have a look at this, how hard can it be ;)
> I have written and rewritten now this part and still it looks ugly or even
> worse :( Flagging postpone is actually easy as well as not breaking out of
> loop in the beginning, but the early return is a small nightmare. If you
> introduce a variable tracking this, smth like "hardbreak" and setting it at
> that point, then you have a number of stupid if() causes, which make the whole
> constructions completely unreadable in addition to handling postpone and rc
> status (I have to walk thought this with pen and big white sheet to track the
> cases). Other option is "goto xyz" to bypass this.... but I am not sure this
> is any better, but might be easier to read. What do you think is better?
I meant that I'll have a look at streamlining this particular jungle
first in a way that (hopefully) makes adding the hooks easy or at least
easier. There are all sorts of suspicious spots in there...
> I have also fixed the other two issues you pointed in the other email.
Ok, good... but the patch seems to be missing from your mail :)
- Panu -
More information about the Rpm-maint