[packagekit] packagekit: Branch 'master' - 7 commits

Richard Hughes hughsient at kemper.freedesktop.org
Mon Oct 15 10:43:49 PDT 2007


 backends/yum/helpers/yumBackend.py |   69 +++++++++++++++++++++++++++++++------
 backends/yum/pk-backend-yum.c      |    1 
 data/transactions.db               |binary
 python/packagekit/backend.py       |    8 ++++
 4 files changed, 67 insertions(+), 11 deletions(-)

New commits:
commit 51d1bdff73155ad6723f2150ddd4fca0ff7706a5
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Oct 15 18:33:16 2007 +0100

    make sure transactions.db has the correct fields

diff --git a/data/transactions.db b/data/transactions.db
index 2a780e0..e0e28b4 100644
Binary files a/data/transactions.db and b/data/transactions.db differ
commit de6555d58ef041ebb7bd575b06e0ec9ef8ac4d33
Merge: fbaea5f... ef0604d...
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Mon Oct 15 10:37:32 2007 -0400

    Merge branch 'master' of git+ssh://rnorwood@git.packagekit.org/srv/git/PackageKit

commit fbaea5fea95aec046a4dce2acea2ae4d3a288fab
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Mon Oct 15 10:37:13 2007 -0400

    set no_percentage_updates for 'get updates' command in yum backend

diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 71cba29..b324454 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -103,6 +103,7 @@ static void
 backend_get_updates (PkBackend *backend)
 {
 	g_return_if_fail (backend != NULL);
+	pk_backend_no_percentage_updates (backend);
 	pk_backend_spawn_helper (backend, "get-updates.py", NULL);
 }
 
commit ef0604dc45aef563a97c4c85377c4e4f48dfc6a1
Author: Ken VanDine <ken at vandine.org>
Date:   Mon Oct 15 08:30:24 2007 -0400

    Removed install-file.py from distfiles for the yum backend, it is missing and breaks make dist

diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index 117f242..e9bd526 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -16,7 +16,6 @@ dist_helper_DATA = 			\
 	remove.py			\
 	resolve.py			\
 	update.py			\
-	install-file.py     \
 	refresh-cache.py		\
 	update-system.py		\
 	yumBackend.py			\
commit 30eb7b84e9c6329fc765ca2f382ba1749616f5e2
Author: Tim Lauridsen <tim at localhost.localdomain>
Date:   Mon Oct 15 10:18:43 2007 +0200

    yum: Added James Bowes to Authors

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index f60811d..e09fcf6 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -13,9 +13,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright (C) 2007 Tim Lauridsen <timlau at fedoraproject.org>
-# Copyright (C) 2007 Red Hat Inc, Seth Vidal <skvidal at fedoraproject.org>
-# Copyright (C) 2007 Luke Macken <lmacken at redhat.com>
+# Copyright (C) 2007 
+#    Tim Lauridsen <timlau at fedoraproject.org>
+#    Seth Vidal <skvidal at fedoraproject.org>
+#    Luke Macken <lmacken at redhat.com>
+#    James Bowes <jbowes at dangerouslyinc.com>
 
 
 # imports
commit d8de50f29d9e75e0765b376e4dac48b0138d99d5
Author: Tim Lauridsen <tim at localhost.localdomain>
Date:   Mon Oct 15 10:16:04 2007 +0200

    yum: Added install-file.py to Makefile

diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index e9bd526..117f242 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -16,6 +16,7 @@ dist_helper_DATA = 			\
 	remove.py			\
 	resolve.py			\
 	update.py			\
+	install-file.py     \
 	refresh-cache.py		\
 	update-system.py		\
 	yumBackend.py			\
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 3a2d63f..f60811d 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -583,7 +583,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             except:
                 pass # No updateinfo.xml.gz in repo
 
-        self.percentage(0)
+        self.percentage() # emit no-percentage-updates signal
         ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
         for pkg in ygl.updates:
             # Get info about package in updates info
@@ -596,10 +596,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
 
     def _setup_yum(self):
-        self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0) # Setup Yum Config
-        self.yumbase.conf.throttle = "40%"    # Set bandwidth throttle to 40%
-        self.dnlCallback = DownloadCallback(self,showNames=True)      # Download callback
-        self.yumbase.repos.setProgressBar( self.dnlCallback )         # Setup the download callback class
+        self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)     # Setup Yum Config
+        self.yumbase.conf.throttle = "40%"                        # Set bandwidth throttle to 40%
+        self.dnlCallback = DownloadCallback(self,showNames=True)  # Download callback
+        self.yumbase.repos.setProgressBar( self.dnlCallback )     # Setup the download callback class
 
 class DownloadCallback( BaseMeter ):
     """ Customized version of urlgrabber.progress.BaseMeter class """
commit eeda6632f4e9fcab5c45b34d726ac5af218ecf0b
Author: Tim Lauridsen <tim at localhost.localdomain>
Date:   Mon Oct 15 09:53:39 2007 +0200

    * Implemented install-file in yum backend
    * Show the full package id when installing/updating.
    * Removed some duplicate code

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index e18b183..3a2d63f 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -32,6 +32,7 @@ from yum.callbacks import *
 from yum.misc import prco_tuple_to_string, unique
 import rpmUtils
 import exceptions
+import types
 
 class GPGKeyNotImported(exceptions.Exception):
     pass
@@ -393,6 +394,46 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
         else:
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
+            
+    def install_file (self, inst_file):
+        '''
+        Implement the {backend}-install_file functionality
+        Install the package containing the inst_file file
+        Needed to be implemented in a sub class
+        '''
+        pkgs_to_inst = []
+        self._setup_yum()
+        # Check if the inst_file is already installed
+        try:
+            my_inst_pkgs = self.yumbase.returnInstalledPackagesByDep(inst_file)
+        except yum.Errors.YumBaseError, e:
+            my_inst_pkgs = []
+        if my_inst_pkgs:
+            self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"File %s is already installed" % inst_file)
+        
+        # Find packages there is providing inst_file
+        try:
+            mypkgs = self.yumbase.returnPackagesByDep(inst_file)
+        except yum.Errors.YumBaseError, e:
+            msgs = ';'.join(e)
+            self.error(ERROR_INTERNAL_ERROR,msgs)
+        else:
+            mybestpkgs = self.yumbase.bestPackagesFromList(mypkgs)
+            for mypkg in mybestpkgs:
+                if self._installable(mypkg, True):
+                    self._show_package(mypkg, INFO_AVAILABLE)                    
+                    pkgs_to_inst.append(mypkg)
+                    break
+        try:
+            # Added the package to the transaction set
+            for pkg in pkgs_to_inst:
+                txmbr = self.yumbase.install(name=pkg.name)
+            if len(self.yumbase.tsInfo) > 0:
+                self._runYumTransaction()
+        except yum.Errors.InstallError,e:
+            print e
+            msgs = ';'.join(e)
+            self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
 
     def update(self, package):
         '''
@@ -669,13 +710,17 @@ class PackageKitCallback(RPMBaseCallback):
         return pct
 
     def _showName(self,status):
-        id = self.base.get_package_id(self.curpkg, '', '', '')
+        if type(self.curpkg) in types.StringTypes:
+            id = self.base.get_package_id(self.curpkg,'','','')
+        else:
+            pkgver = self.base._get_package_ver(self.curpkg)
+            id = self.base.get_package_id(self.curpkg.name, pkgver, self.curpkg.arch, self.curpkg.repo)
         self.base.package(id,status, "")
 
 
     def event(self, package, action, te_current, te_total, ts_current, ts_total):
-        if str(package) != self.curpkg:
-            self.curpkg = str(package)
+        if str(package) != str(self.curpkg):
+            self.curpkg = package
             if action in TS_INSTALL_STATES:
                 self.base.status(STATE_INSTALL)
                 status = INFO_INSTALLING
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 73654da..92ab711 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -255,6 +255,14 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
+    def install_file (self, inst_file):
+        '''
+        Implement the {backend}-install_file functionality
+        Install the package containing the inst_file file
+        Needed to be implemented in a sub class
+        '''
+        self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+
     def resolve(self, name):
         '''
         Implement the {backend}-resolve functionality



More information about the PackageKit mailing list