[Yum-devel] Qs regarding YUM code
Creative Innovative
innovative_c at yahoo.com
Thu Apr 23 00:36:56 UTC 2009
Hi ,
I have been looking into YUM code(yum version 3.2.21), for sometime now.
Have 2 Qs below::
Qs1) In cli.py after running a RPM test transaction. What is the need to create a new transaction, and re-populate ts, for running real RPM transaction.
Isnt this a performance hit.
Unless, there is any strange RPM side-effect, I think it would be better performance-wise, to just use the same transaction object used for RPM test , for the real transaction.
I have cut-paste RELEVANT YUM code below from cli.py.
.....//MY_COMMENTS:: creating ts for RPM Test transaction.
testcb = RPMTransaction(self, test=True)
self.initActionTs()
...
self.populateTs(keepold=0) # sigh
tserrors = self.ts.test(testcb)
.....
.....//MY_COMMENTS:: creating NEW ts for real RPM transaction.
self.initActionTs() # make a new, blank ts to populate
self.populateTs(keepold=0) # populate the ts
self.ts.check() #required for ordering
self.ts.order() # order
...
resultobject = self.runTransaction(cb=cb)
Qs2) Also I noticed that in rpmtrans.py, prior to running transaction, the transaction elements, are dumped to a transaction file under /var/lib/yum.
I was exploring this further, to see if I can leverage for one of the work projects that I have been looking into. The idea is to write a program in C, which takes the latest yum transaction file, parse it and for each entry, uses RPM's C apis to add transaction elements, and then calls rpmtsRun() to run the transaction.
Based on preliminary prototyping it seems to work fine.
If you have any further inputs/suggestions/concerns please let me know.
I have cut-paste RELEVANT YUM code below..from rpmtrans.py
def callback( self, what, bytes, total, h, user ):
if what == rpm.RPMCALLBACK_TRANS_START:
self._transStart( bytes, total, h )
def _transStart(self, bytes, total, h):
if bytes == 6:
self.total_actions = total
if self.test: return
self.trans_running = True
self.ts_all() # write out what transaction will do
def ts_all(self):
"""write out what our transaction will do"""
Thanks,
Sudha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20090422/ab752e1f/attachment.htm>
More information about the Yum-devel
mailing list