[Yum-devel] reset transaction

James Antill james at fedoraproject.org
Tue Jun 29 17:31:26 UTC 2010


On Tue, 2010-06-29 at 12:31 -0400, Jack Neely wrote:
> Folks,
> 
> How does one reset the currently built transaction via the API?
> 
> I've called yb.install(foo) several times, run yb.buildTransaction() and
> I want to be able to start from scratch again if buildTransaction tells
> me the update will fail.
> 
> I found a patch to add transactionReset() to the rpmsack, but that's not
> in RHEL 5's yum and I need to be fairly backwards compatible.

 Note that .rpmdb.transactionReset() is about notifying .rpmdb that a
transaction reset has occurred ... not actually resetting the
transaction happening in the tsInfo.
 As far as I know if ".rpmdb.transactionReset" doesn't exist, then rpmdb
doesn't need to be notified when a transaction reset happens ... so all
you need to do is:

   del yb.ts
   del yb.tsInfo

...as Seth said calling yb.closeRpmDB() will do that, and delete a bunch
of other things (which _may_ be safer, but is certainly slower) but IMO
if you want to go the safest route I'd personally just do:

   yb = CreateNewYumBase()

...and start again.



More information about the Yum-devel mailing list