Rollback functionality for apt-rpm

Panu Matilainen pmatilai at laiskiainen.org
Thu Nov 30 04:33:52 PST 2006


On Wed, 29 Nov 2006, Vincent Danen wrote:
> * Gary L. Greene, Jr. <greeneg at phoenuxos.com> [2006-11-29 09:08:29 -0500]:
>
>>> I'm a developer with Caixa Mágica (the portuguese distribution of
>>> Linux!), where we use a customized version of apt-rpm as our main
>>> package manager. Our customizations amount to a "rollback" feature,
>>> which we'd like to contribute back into (your) mainline. To get the
>>> ball rolling, I've prepared a patch against current svn (revision 272)
>>> and hopefully, it's attached to this message... I'd like to hear your
>>> feedback on the patch and to understand what it'll take to merge the
>>> code.
>>
>> [snip]
>>
>> This looks like a rather interesting feature. While I can't speak for Panu, I
>> can definitely see adding this to PhoeNUX OS' build... (Now if only we could
>> get scriptlet postponing, looks like I have to add it as a lua hook for
>> now :| )

You can't really postpone scriptlets without breaking the rpm scriptlet
ordering assumptions - eg %preun needs to run with the old 
package still installed, which is it is not when the transaction has 
completed. I don't even want to think about triggers in that scenario :)

> ooh!  ooh!  You mean like postponing all %post scripts and such until
> after the entire transaction is complete?  Are you serious?  If you
> implement something like that *please* share!  With Annvix (and Mandriva
> and possibly other distros) we tend to restart apache on every new
> module that gets installed, but if you upgrade apache to a new version,
> that's a lot of modules and a lot of useless apache restarts.
>
> I've wanted a post-transaction handler in urpmi for ages but they never
> seemed to get how useful it would be, so if you have eyes to implement
> something like this in apt, I'm very very willing to use your work... =)
> Sorry, I'd be willing to help, but I don't know the first thing about
> lua and have very little time to learn.

There are already three different ways to execute stuff post-transaction:
1) post-transaction scriptlets in rpm itself (at least later rpm versions)
2) post-transaction scripts in apt-rpm (set via RPM::Post-Invoke config item)
3) post-transaction Lua scripts in apt-rpm where there's quite a bit more
    information available about the transaction etc compared to 2)

For a simple example of 3) check out the logger script in apt-rpm contrib:
http://svn.laiskiainen.org/apt-rpm/trunk/contrib/log/

Anyway, postponing scripts is going to require some distro-specific 
conventions in packaging, and when you're down that route ... you can 
already do that via various mechanisms. Especially with Lua hooks which 
have access to the actual transaction information, things like "was any 
package requiring apache restart installed/upgraded/removed in this 
transaction, do the restart if so" are quite feasible. Obviously those 
"service needs restart" etc items need to be stored someplace, and there's 
no readymade script-framework-whatever for it. But it's certainly possible 
(and if somebody writes something like that, it's more than welcome to the 
contrib script collection :)

 	- Panu -



More information about the Apt-Rpm mailing list