[Yum-devel] Need to destroy and rebuild the ts?y

David Farning dfarning at sbcglobal.net
Thu Feb 26 22:19:01 UTC 2004


Just wrote this little test case.

Works like a charm:)  I'm I missing something?


[root at localhost ts_test]# rpm -q xmms
package xmms is not installed
[root at localhost ts_test]# ./ts_test.py
[(('xmms-skins', '1.2.9', '5.p'), ('xmms', None), 0, None, 0)]
[]
[root at localhost ts_test]# rpm -q xmms
xmms-1.2.9-5.p
[root at localhost ts_test]#

#!/bin/env python
import callback
import gzip
import rpm

def main():
  cb = callback.RPMInstallCallback()
  
  fd1 = gzip.open('xmms-skins-1-1.2.9-5.p.i386.hdr', 'r')
  h1 = rpm.headerLoad(fd1.read())
  fd1.close()

  fd2 = gzip.open('xmms-1-1.2.9-5.p.i386.hdr', 'r')
  h2 = rpm.headerLoad(fd2.read())
  fd2.close()


  ts = rpm.TransactionSet("/")
  ts.addInstall(h1,(h1, 'xmms-skins-1.2.9-5.p.i386.rpm'),'i')

  deps = ts.check()
  print deps

  if deps != None:
    ts.addInstall(h2,(h2, 'xmms-1.2.9-5.p.i386.rpm'),'i')

  deps = ts.check()

  ts.order()

  print deps

  ts.run(cb.callback, "")
main()






More information about the Yum-devel mailing list