yum transaction journal

August 17, 2007

I just got finished checking a useful feature into yum. It’s a transaction journal. I have talked about the idea before but I hadn’t really sat down to do the other infrastructure work to make it happen. This last week I did that and it really wasn’t very difficult. Here’s how it works:

When you setup a transaction yum writes out a complete list of each individual action that is going to occur. So if you say:

yum install foo
then the action is:

install foo-v-r.arch

or
yum remove bar

then the action is:

erase bar-v-r.arch

or

yum update baz

then the action is:

install baz-v-r.arch
remove baz-v-r.arch

That’s right – in rpm every update is actually an install of the new pkg and an erase of the files from the old pkg which don’t overlap.
So yum writes these out to a file before the transaction. Then once the transaction starts it writes out each of the items it has completed.
The idea is that if your computer dies, or X dies or the power goes out or yum aborts or rpm freezes or aliens invade – and any of these things kill your transaction – you can just look at what was proposed, look at what is left undone and do the rest. I’m currently working on some code to add to yum to check for undone transaction elements so it can prompt you to finish them.
Anyway – I hope this feature is completely useless to most of you b/c you never have an aborted transaction. But it seems like a nice thing to have just in case