From 0c28d4fc33f0ec7f062c70e15057f4829b01ba6c Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 23 Aug 2007 09:39:52 +0100 Subject: [PATCH] include more dummy code from seth --- helpers/yum-install.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/helpers/yum-install.py b/helpers/yum-install.py index 424106bf2..466b759c6 100755 --- a/helpers/yum-install.py +++ b/helpers/yum-install.py @@ -1,6 +1,7 @@ #!/usr/bin/python # # Copyright (C) 2007 Richard Hughes +# Copyright (C) 2007 Red Hat Inc, Seth Vidal # # 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) +