From e60fbf78042736dfe3ecd2f062a2dece089e6b60 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 24 Aug 2007 16:05:47 +0100 Subject: [PATCH] commit the first half of tims patch --- helpers/packagekit.py | 2 +- helpers/yum-install.py | 43 +++++------------------------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/helpers/packagekit.py b/helpers/packagekit.py index 2361fc701..619f69164 100644 --- a/helpers/packagekit.py +++ b/helpers/packagekit.py @@ -83,7 +83,7 @@ class PackageKitBaseBackend: send 'status' signal @param state: STATE_DOWNLOAD, STATE_INSTALL, STATE_UPDATE, STATE_REMOVE ''' - print >> sys.stderr,"status\t%s" % (status) + print >> sys.stderr,"status\t%s" % (state) def data(self,data): ''' diff --git a/helpers/yum-install.py b/helpers/yum-install.py index 466b759c6..14d1b020c 100755 --- a/helpers/yum-install.py +++ b/helpers/yum-install.py @@ -10,44 +10,11 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -import yum -from yum.rpmtrans import RPMBaseCallback, RPMTransaction import sys -my = yum.YumBase() -#my.doConfigSetup() -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) +from yumBackend import PackageKitYumBackend +package = sys.argv[1] +backend = PackageKitYumBackend(sys.argv[1:]) +backend.install(package) +sys.exit(1) \ No newline at end of file