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

Richard Hughes hughsient at kemper.freedesktop.org
Tue Oct 16 09:57:40 PDT 2007


 backends/apt/Makefile.am           |    9 ++-
 backends/apt/helpers/aptBackend.py |    4 +
 backends/apt/pk-backend-apt.cpp    |    2 
 backends/yum/helpers/yumBackend.py |  109 +++++++++++++++++++++++++++----------
 configure.ac                       |    4 -
 python/packagekit/backend.py       |    6 +-
 python/packagekit/frontend.py      |   12 +++-
 python/pk-frontend-test.py         |   26 ++++++--
 src/pk-transaction-id.c            |    4 -
 9 files changed, 130 insertions(+), 46 deletions(-)

New commits:
commit 851ab91ea9e4ea34db2534688de5ec028ef4d88a
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Oct 16 17:51:17 2007 +0100

    dist the header files in the apt backend

diff --git a/backends/apt/Makefile.am b/backends/apt/Makefile.am
index b651273..be27e19 100644
--- a/backends/apt/Makefile.am
+++ b/backends/apt/Makefile.am
@@ -2,7 +2,14 @@ SUBDIRS = helpers
 plugindir = @PK_PLUGIN_DIR@
 plugin_LTLIBRARIES = libpk_backend_apt.la
 libpk_backend_apt_la_INCLUDES = $(APT_CFLAGS) $(SQLITE_CFLAGS)
-libpk_backend_apt_la_SOURCES = pk-backend-apt.cpp sqlite-pkg-cache.c apt-build-db.cpp python-backend-common.c
+libpk_backend_apt_la_SOURCES =		\
+	pk-backend-apt.h		\
+	pk-backend-apt.cpp		\
+	sqlite-pkg-cache.h		\
+	sqlite-pkg-cache.c		\
+	apt-build-db.cpp		\
+	python-backend-common.h		\
+	python-backend-common.c
 libpk_backend_apt_la_LIBADD = @PK_PLUGIN_LIBS@ $(APT_LIBS) $(SQLITE_LIBS)
 libpk_backend_apt_la_LDFLAGS = -module -avoid-version
 libpk_backend_apt_la_CFLAGS = @PK_PLUGIN_CFLAGS@ -DDATABASEDIR=\""$(PK_DB_DIR)"\"
commit e38d836f99a4698ae772b2b9e978f8d10d2ddf8d
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Oct 16 17:44:28 2007 +0100

    post release bump to 0.1.1

diff --git a/configure.ac b/configure.ac
index 1e4b4c9..8360141 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(PackageKit, 0.1.0)
+AC_INIT(PackageKit, 0.1.1)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)
commit ddfa95a7122f0ed30304cdaeee0d9aeb48ec5e6b
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Tue Oct 16 11:29:34 2007 -0400

    Fix License and copyright notices.

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 59ba4f8..3981486 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1,18 +1,19 @@
-#!/usr/bin/python -tt
+# Licensed under the GNU General Public License Version 2
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
-# (at your filtersion) any later version.
+# (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # 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>
 #    Seth Vidal <skvidal at fedoraproject.org>
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 7c6d4c6..0bbccbe 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -1,3 +1,5 @@
+# Licensed under the GNU General Public License Version 2
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -6,12 +8,12 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # 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>
 
 #
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 2c00e68..891f856 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -1,3 +1,5 @@
+# Licensed under the GNU General Public License Version 2
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -6,12 +8,16 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # 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>
+#    Tom Parker <palfrey at tevp.net>
+#    Robin Norwood <rnorwood at redhat.com>
 
 from types import *
 import dbus
diff --git a/python/pk-frontend-test.py b/python/pk-frontend-test.py
index 4761b4f..afa594d 100755
--- a/python/pk-frontend-test.py
+++ b/python/pk-frontend-test.py
@@ -1,17 +1,27 @@
 #!/usr/bin/python
 #
-# "pkt" python test program for PackageKit
+# Licensed under the GNU General Public License Version 2
 #
-# pkt serves both as a simple PackageKit client, and as an example user of the
-# PackageKit python API
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 #
-# Copyright (C) 2007 Tom Parker <palfrey at tevp.net>
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-# Licensed under the GNU General Public License Version 2
+# You should have received a copy of the GNU General Public License
+# 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 Tom Parker <palfrey at tevp.net>
+
+# "pkt" python test program for PackageKit
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License v2 as published by
-# the Free Software Foundation.
+# pkt serves both as a simple PackageKit client, and as an example user of the
+# PackageKit python API
 
 from sys import argv,exit
 from optparse import OptionParser
diff --git a/src/pk-transaction-id.c b/src/pk-transaction-id.c
index 876f985..0b7d285 100644
--- a/src/pk-transaction-id.c
+++ b/src/pk-transaction-id.c
@@ -6,8 +6,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either identifier 2 of the License, or
- * (at your option) any later identifier.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
commit 9741cc2159e9038739bec38313914d853e20b405
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Tue Oct 16 08:45:10 2007 -0400

    Store db in /var/lib rather than /var/db

diff --git a/configure.ac b/configure.ac
index 4a4661e..1e4b4c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -348,7 +348,7 @@ fi
     
 
 AC_SUBST(PK_CONF_DIR, "\$(sysconfdir)/PackageKit")
-AC_SUBST(PK_DB_DIR, "\$(localstatedir)/db/PackageKit")
+AC_SUBST(PK_DB_DIR, "\$(localstatedir)/lib/PackageKit")
 AC_SUBST(PK_PLUGIN_DIR, "\$(libdir)/packagekit-backend")
 AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/libpackagekit $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS")
 AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS")
commit c5d2f71cf9b82c31c7dcacf131d7cc7cab4f6211
Author: Tim Lauridsen <tim at localhost.localdomain>
Date:   Tue Oct 16 14:26:48 2007 +0200

    yum: make install-file install local rpms

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 9641816..59ba4f8 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -425,6 +425,81 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
         else:
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
+
+    def _localInstall(self, inst_file):
+        """handles installs/updates of rpms provided on the filesystem in a 
+           local dir (ie: not from a repo)"""
+           
+        # Slightly modified localInstall from yum's cli.py
+           
+        # read in each package into a YumLocalPackage Object
+        # append it to self.yumbase.localPackages
+        # check if it can be installed or updated based on nevra versus rpmdb
+        # don't import the repos until we absolutely need them for depsolving
+        
+        oldcount = len(self.yumbase.tsInfo)
+               
+        installpkgs = []
+        updatepkgs = []
+        
+        pkg = inst_file
+        try:
+            po = yum.packages.YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=pkg)
+        except yum.Errors.MiscError:
+            self.error(ERROR_INTERNAL_ERROR,'Cannot open file: %s. Skipping.' % pkg)
+
+        # everything installed that matches the name
+        installedByKey = self.yumbase.rpmdb.searchNevra(name=po.name)
+        # go through each package 
+        if len(installedByKey) == 0: # nothing installed by that name
+            installpkgs.append(po)
+        else:
+            for installed_pkg in installedByKey:
+                if po.EVR > installed_pkg.EVR: # we're newer - this is an update, pass to them
+                    if installed_pkg.name in self.yumbase.conf.exactarchlist:
+                        if po.arch == installed_pkg.arch:
+                            updatepkgs.append((po, installed_pkg))
+                            continue
+                        else:
+                            continue
+                    else:
+                        updatepkgs.append((po, installed_pkg))
+                        continue
+                elif po.EVR == installed_pkg.EVR:
+                    if po.arch != installed_pkg.arch and (isMultiLibArch(po.arch) or
+                              isMultiLibArch(installed_pkg.arch)):
+                        installpkgs.append(po)
+                        continue
+                    else:
+                        continue
+                else:
+                    continue
+        
+        # handle excludes for a localinstall
+        toexc = []
+        if len(self.yumbase.conf.exclude) > 0:
+           exactmatch, matched, unmatched = \
+                   yum.packages.parsePackages(installpkgs + map(lambda x: x[0], updatepkgs),
+                                 self.yumbase.conf.exclude, casematch=1)
+           toexc = exactmatch + matched
+       
+        # Process potential installs   
+        for po in installpkgs:
+            if po in toexc:
+               continue     # Exclude package
+            # Add package to transaction for installation
+            self.yumbase.localPackages.append(po)
+            self.yumbase.install(po=po)
+        # Process potential updates
+        for (po, oldpo) in updatepkgs:
+            if po in toexc:
+               continue # Excludeing package
+            # Add Package to transaction for updating
+            self.yumbase.localPackages.append(po)
+            self.yumbase.tsInfo.addUpdate(po, oldpo)
+        
+
+
             
     def install_file (self, inst_file):
         '''
@@ -437,31 +512,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         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
+        self.yumbase.conf.gpgcheck=0
+        self._localInstall(inst_file)
         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:
commit 54116001f8d7be1c77fd78743a104b77cf60a0fe
Author: Tom Parker <palfrey at tevp.net>
Date:   Tue Oct 16 12:31:05 2007 +0200

    Handle "Locked" signals in packagekit.frontend

diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index a1bc3e6..2c00e68 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -128,7 +128,7 @@ class PackageKit:
 		elif kwargs['member'] == "Transaction":
 			self.Transaction(args[0],args[1],args[2],args[3],args[4],args[5])
 		elif kwargs['member'] in ["NoPercentageUpdates","TransactionListChanged",
-					  "AllowInterrupt","JobListChanged"]:
+					  "AllowInterrupt","JobListChanged", "Locked"]:
 			pass
 		else:
 			print "Caught unhandled signal %s"% kwargs['member']
commit cd66c7dea0b84f999154a99a8a2c3b2e01eb8855
Author: Tom Parker <palfrey at tevp.net>
Date:   Tue Oct 16 12:30:23 2007 +0200

    Fix use of C items with C++ module

diff --git a/backends/apt/pk-backend-apt.cpp b/backends/apt/pk-backend-apt.cpp
index 985fea8..2c5e159 100644
--- a/backends/apt/pk-backend-apt.cpp
+++ b/backends/apt/pk-backend-apt.cpp
@@ -36,8 +36,10 @@
 #include <apt-pkg/init.h>
 
 #include "pk-backend-apt.h"
+extern "C" {
 #include "sqlite-pkg-cache.h"
 #include "python-backend-common.h"
+}
 
 static gboolean inited = FALSE;
 
commit 86f37da265fa8f1704c75a8e062d7298c9a8ba94
Author: Tom Parker <palfrey at tevp.net>
Date:   Tue Oct 16 12:34:34 2007 +0200

    Fix aptBackend.py to GPLv2+

diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index b2ca5cc..d0f370a 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -1,7 +1,9 @@
 #!/usr/bin/python
+
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of


More information about the PackageKit mailing list