include more dummy code from seth

This commit is contained in:
Richard Hughes 2007-08-23 09:39:52 +01:00
parent 7ac8e0869d
commit 0c28d4fc33

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
#
# Copyright (C) 2007 Richard Hughes <richard@hughsie.com>
# Copyright (C) 2007 Red Hat Inc, Seth Vidal <skvidal@fedoraproject.org>
#
# Licensed under the GNU General Public License Version 2
#
@ -10,6 +11,7 @@
# (at your option) any later version.
import yum
from yum.rpmtrans import RPMBaseCallback, RPMTransaction
import sys
my = yum.YumBase()
@ -18,3 +20,34 @@ my.conf.cache = 1
sys.exit(1)
#DOES NOT WORK
class PackageKitCallback(RPMBaseCallback)
def __init__(self):
RPMBaseCallback.__init__()
self.pct = 0
def event(self, package, action, te_current, te_total, ts_current, ts_total):
val = (ts_current*100L)/ts_total
if val != self.pct:
self.pct = val
print >> sys.stderr, pct
def errorlog(self, msg):
# grrrrrrrr
pass
my = yum.YumBase()
term = sys.argv[1]
my.install(name=term)
my.buildTransaction()
# download pkgs
# check
# order
# run
cb = RPMTransaction(self, display=PackageKitCallback)
my.runTransaction(cb=cb)