[PackageKit-commit] packagekit: Branch 'master' - 49 commits

Richard Hughes hughsient at kemper.freedesktop.org
Tue Aug 12 01:52:03 PDT 2008


 RELEASE                                    |   14 
 backends/apt/HACKING                       |    8 
 backends/apt/README                        |    2 
 backends/apt/TODO                          |    5 
 backends/apt/aptDBUSBackend.py             |  523 ++++++++++++++++++++++++-----
 backends/apt/hotshot-analyze.py            |   39 ++
 backends/apt/pk-backend-apt.c              |   43 ++
 backends/yum/helpers/yumBackend.py         |    1 
 backends/yum/helpers/yumFilter.py          |    2 
 backends/yum2/helpers/yumDBUSBackend.py    |    2 
 client/pk-generate-pack.c                  |   52 ++
 configure.ac                               |    2 
 contrib/PackageKit.spec.in                 |   22 +
 contrib/packagekit-plugin/src/contents.cpp |    4 
 contrib/packagekit-plugin/src/contents.h   |    2 
 docs/html/pk-faq.html                      |   11 
 docs/html/pk-matrix.html                   |    8 
 docs/html/pk-using.html                    |   34 +
 man/Makefile.am                            |   10 
 man/pkgenpack.xml                          |  150 ++++++++
 po/pl.po                                   |  303 ++++++++++++----
 python/packagekit/daemonBackend.py         |   38 +-
 python/packagekitwrapper.py                |  121 ++++--
 23 files changed, 1132 insertions(+), 264 deletions(-)

New commits:
commit 649d694353d07c25f715130f1bd972a1412967a8
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Aug 12 09:48:33 2008 +0100

    trivial: include the right headers in the packagekit browser plugin, else the rpmbuild fails

diff --git a/RELEASE b/RELEASE
index 40cace6..8a1dc83 100644
--- a/RELEASE
+++ b/RELEASE
@@ -3,7 +3,7 @@ PackageKit Release Notes
 1. Write NEWS entries for PackageKit and gnome-packagekit in the same
    format as usual. Ignore any trivial commits.
 
-$ git-shortlog PACKAGEKIT_0_2_2.. | grep -v trivial | grep -v Merge > NEWS.new
+$ git-shortlog PACKAGEKIT_0_2_4.. | grep -v trivial | grep -v Merge > NEWS.new
 
 2. Add download date to docs/html/pk-download.html, save file.
 
@@ -11,8 +11,8 @@ $ git-shortlog PACKAGEKIT_0_2_2.. | grep -v trivial | grep -v Merge > NEWS.new
 
 4. Commit changes in PackageKit git:
 
-$ git commit -a -m "Release version 0.2.3"
-$ git tag -a -f -m "Release 0.2.3" PACKAGEKIT_0_2_3
+$ git commit -a -m "Release version 0.3.0"
+$ git tag -a -f -m "Release 0.3.0" PACKAGEKIT_0_3_0
 $ git push --tags
 $ git push
 $ git push git+ssh://username@git.freedesktop.org/git/packagekit
@@ -20,8 +20,8 @@ $ git push --tags git+ssh://username@git.freedesktop.org/git/packagekit
 
 5. Commit changes in gnome-packagekit git:
 
-$ git commit -a -m "Release version 0.2.3"
-$ git-tag GNOME_PACKAGEKIT_0_2_3
+$ git commit -a -m "Release version 0.3.0"
+$ git-tag GNOME_PACKAGEKIT_0_3_0
 $ git push --tags
 $ git push
 
@@ -41,9 +41,9 @@ $ git push
 10. Send an email to packagekit at lists.freedesktop.org
 
 =================================================
-Subject: PackageKit and gnome-packagekit 0.2.3 released!
+Subject: PackageKit and gnome-packagekit 0.3.0 released!
 
-Today I released PackageKit and gnome-packagekit 0.2.3.
+Today I released PackageKit and gnome-packagekit 0.3.0.
 
 PackageKit release notes: http://gitweb.freedesktop.org/?p=packagekit.git;a=blob;f=NEWS
 
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 6d27c72..7100756 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -18,9 +18,11 @@ Source0:   http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires: dbus >= %{dbus_version}
+Requires: dbus-glib >= %{dbus_glib_version}
 Requires: PackageKit-libs = %{epoch}:%{version}-%{release}
 Requires: yum-packagekit = %{epoch}:%{version}-%{release}
 Requires: yum >= 3.2.6
+Requires: libtar
 Requires: shared-mime-info
 
 BuildRequires: glib2-devel >= %{glib2_version}
@@ -40,6 +42,8 @@ BuildRequires: python-devel
 BuildRequires: perl(XML::Parser)
 BuildRequires: intltool
 BuildRequires: gettext
+BuildRequires: xulrunner-devel
+BuildRequires: libtar-devel
 
 %description 
 PackageKit is a D-Bus abstraction layer that allows the session user
@@ -97,6 +101,17 @@ Requires: sqlite-devel
 %description devel
 Headers and libraries for PackageKit.
 
+%package browser-plugin
+Summary: Browser Plugin for PackageKit
+Group: Development/Libraries
+Requires: gtk2
+Requires: PackageKit-libs = %{epoch}:%{version}-%{release}
+
+%description browser-plugin
+The PackageKit browser plugin allows web sites to offer the ability to
+users to install and update packages from configured repositories
+using PackageKit.
+
 %prep
 %setup -q
 
@@ -113,6 +128,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpackagekit*.a
 rm -f $RPM_BUILD_ROOT%{_libdir}/libpackagekit*.la
 rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-backend/*.la
 rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-backend/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/packagekit-plugin.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/packagekit-plugin.la
 
 chmod 755 $RPM_BUILD_ROOT%{_libexecdir}/yumDBUSBackend.py
 chmod 755 $RPM_BUILD_ROOT%{_libexecdir}/PackageKitDbusTest.py
@@ -191,6 +208,11 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 %files devel
 %defattr(-,root,root,-)
 
+%files browser-plugin
+%dir %{_libdir}/mozilla
+%dir %{_libdir}/mozilla/plugins
+%{_libdir}/mozilla/plugins/packagekit-plugin.so
+
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*
 %{_includedir}/*
diff --git a/contrib/packagekit-plugin/src/contents.cpp b/contrib/packagekit-plugin/src/contents.cpp
index b12ba75..9d51ac9 100644
--- a/contrib/packagekit-plugin/src/contents.cpp
+++ b/contrib/packagekit-plugin/src/contents.cpp
@@ -50,8 +50,8 @@
 #include <gdk/gdkx.h>
 #include <gio/gdesktopappinfo.h>
 
-#include "pk-package-id.h"
-#include "pk-package-ids.h"
+#include <pk-package-id.h>
+#include <pk-package-ids.h>
 
 #include "plugin.h"
 
diff --git a/contrib/packagekit-plugin/src/contents.h b/contrib/packagekit-plugin/src/contents.h
index 0d465a6..5a97339 100644
--- a/contrib/packagekit-plugin/src/contents.h
+++ b/contrib/packagekit-plugin/src/contents.h
@@ -42,7 +42,7 @@
 #include <X11/Xlib.h>
 #include <gio/gio.h>
 #include <pango/pango.h>
-#include <packagekit/pk-client.h>
+#include <pk-client.h>
 #include <cairo.h>
 #include <dbus/dbus-glib.h>
 #include <gtk/gtk.h>
commit 26e0771b4e848969a615ae056aa6df79a8d07124
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Tue Aug 12 09:39:50 2008 +0200

    APT: Provide more details about updates (security, enhancement, bugfix)

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index d3bf1cd..59d62ad 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -333,8 +333,23 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                 self._canceled.clear()
                 return
             else:
-                self._emit_package(pkg)
-        self._open_cache(progress=False)
+                info = INFO_NORMAL
+                archive = pkg.candidateOrigin[0].archive
+                origin = pkg.candidateOrigin[0].origin
+                trusted = pkg.candidateOrigin[0].trusted
+                label = pkg.candidateOrigin[0].label
+                if origin in ["Debian", "Ubuntu"] and trusted == True:
+                    if archive.endswith("-security") or \
+                       label == "Debian-Security":
+                        info = INFO_SECURITY
+                    elif archive.endswith("-backports"):
+                        info = INFO_ENHANCEMENT
+                    elif archive.endswith("-updates"):
+                        info = INFO_BUGFIX
+                if origin in ["Backports.org archive"] and trusted == True:
+                        info = INFO_ENHANCEMENT
+                self._emit_package(pkg, info)
+        self._cache._depcache.Init()
         self.Finished(EXIT_SUCCESS)
 
     @threaded
commit dea53e04fe74c6e7322efb6b6da64edfd681e351
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Tue Aug 12 08:44:53 2008 +0200

    APT: Allow to override info in _emit_package()

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 4b95cee..d3bf1cd 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -909,17 +909,18 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         id = self._get_package_id(pkg.name, pkgver, pkg.architecture, origin)
         return id
 
-    def _emit_package(self, pkg):
+    def _emit_package(self, pkg, info=None):
         '''
         Send the Package signal for a given apt package
         '''
         id = self.get_id_from_package(pkg)
-        if pkg.isInstalled:
-            status = INFO_INSTALLED
-        else:
-            status = INFO_AVAILABLE
+        if info == None:
+            if pkg.isInstalled:
+                info = INFO_INSTALLED
+            else:
+                info = INFO_AVAILABLE
         summary = pkg.summary
-        self.Package(status, id, summary)
+        self.Package(info, id, summary)
 
     def _is_package_visible(self, pkg, filters):
         '''
commit 0663f96b0e8030fd47514145978001002139ca5b
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Tue Aug 12 00:57:45 2008 +0200

    APT: improve some error messages. trivial.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index f1cf711..4b95cee 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -649,10 +649,10 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             pkgs.append(pkg.name[:])
             try:
                 pkg.markInstall()
-            except:
+            except Exception, e:
                 self._open_cache(prange=(90,100))
                 self.ErrorCode(ERROR_UNKNOWN, "%s could not be queued for "
-                                              "installation" % pkg.name)
+                                              "installation: %s" % (pkg.name,e))
                 self.Finished(EXIT_FAILED)
                 return
         try:
@@ -698,9 +698,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             self.ErrorCode(ERROR_TRANSACTION_CANCELLED, "Download was canceled")
             self.Finished(EXIT_KILLED)
             return
-        except:
+        except Exception, e:
             self._open_cache(prange=(95,100))
-            self.ErrorCode(ERROR_UNKNOWN, "Refreshing cache failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Refreshing cache failed: %s" % e)
             self.Finished(EXIT_FAILED)
             return
         self.PercentageChanged(100)
@@ -836,7 +836,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             return
         if self._cache._depcache.BrokenCount > 0:
             self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,
-                           "Not all dependecies can be satisfied")
+                           "There are broken dependecies on your system. "
+                           "Please use an advanced package manage e.g. "
+                           "Synaptic or aptitude to resolve this situation.")
             self.Finished(EXIT_FAILED)
             self.Exit()
             return
commit 5e9e8b9b1de498a9687e3a7f2adae2248aac102c
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Tue Aug 12 00:52:18 2008 +0200

    Update feature chart for apt

diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index 53c9ff7..44d365b 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -201,7 +201,7 @@
 </tr>
 <tr>
 <td><b>UpdatePackages</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
 <td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
 <td><img src="img/status-good.png" alt="[yes]"/></td><!-- conary -->
@@ -216,7 +216,7 @@
 </tr>
 <tr>
 <td><b>GetDepends</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
 <td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -276,7 +276,7 @@
 </tr>
 <tr>
 <td><b>GetUpdateDetail</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -336,7 +336,7 @@
 </tr>
 <tr>
 <td><b>Cancel</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
 <td><img src="img/status-good.png" alt="[yes]"/></td><!-- conary -->
commit 886d5af4d68b87d9e0a4538a624cb5d90fa706fc
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Tue Aug 12 00:46:45 2008 +0200

    APT: Finally implement doDownloadPackages() using the "new" acquire interface

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 5bf7909..f1cf711 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -24,6 +24,7 @@ import os
 import pty
 import re
 import signal
+import shutil
 import sys
 import time
 import threading
@@ -556,26 +557,68 @@ class PackageKitAptBackend(PackageKitBaseBackend):
 
     @threaded
     @async
-    def doDownloadPackages(self, ids, dir):
+    def doDownloadPackages(self, ids, dest):
         '''
         Implement the {backend}-download-packages functionality
-
-        Does not work yet. Need to find a way to get the package uri
         '''
         pklog.info("Downloading packages: %s" % ids)
-        self.StatusChanged(STATUS_INSTALL)
-        self.AllowCancel(False)
+        self.StatusChanged(STATUS_DOWNLOAD)
+        self.AllowCancel(True)
         self.PercentageChanged(0)
+        # Check the destination directory
+        if not os.path.isdir(dest) or not os.access(dest, os.W_OK):
+            self.ErrorCode(ERROR_UNKOWN,
+                           "The directory '%s' is not writable" % dest)
+            self.Finished(EXIT_FAILED)
+            return
+        # Setup the fetcher
         self._check_init(prange=(0,10))
+        self._cache._depcache.Init()
         progress = PackageKitFetchProgress(self, prange=(10,90))
         fetcher = apt_pkg.GetAcquire(progress)
+        pm = apt_pkg.GetPackageManager(self._cache._depcache)
+        recs = apt_pkg.GetPkgRecords(self._cache._cache)
+        list = apt_pkg.GetPkgSourceList()
+        list.ReadMainList()
+        # Mark installed packages for reinstallation and not installed packages
+        # for installation without dependencies
         for id in ids:
+            if self._is_canceled(): return
             pkg = self._find_package_by_id(id)
-            apt_pkg.GetPkgAcqFile(fetcher,
-                                  "http://www.glatzor.de/index.php")
+            if pkg == None:
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "There is no package %s" % id)
+                self.Finished(EXIT_FAILED)
+                return
+            if pkg.isInstalled:
+                self._cache._depcache.SetReInstall(pkg._pkg, True)
+            else:
+                self._cache._depcache.MarkInstall(pkg._pkg, False)
+        # Download 
+        pm.GetArchives(fetcher, list, recs)
+        res = fetcher.Run()
+        self._cache._depcache.Init()
+        self.PercentageChanged(95)
+        # Copy files from cache to final destination
         for item in fetcher.Items:
+            if self._is_canceled(): return
             pklog.debug("Download item: %s" % item)
-        res = fetcher.Run()
+            if (item.Status != item.StatDone and not item.StatIdle) or \
+                res == fetcher.ResultCancelled:
+                self.ErrorCode(ERROR_PACKAGE_DOWNLOAD_FAILED,
+                               "Failed to download %s" % item.DescURI)
+                self.Finished(EXIT_FAILED)
+                return
+            pklog.debug("Copying %s to %s ..." % (item.DestFile, dest))
+            try:
+                shutil.copy(item.DestFile, dest)
+            except Exception, e:
+                self.ErrorCode(ERROR_INTERNAL_ERROR,
+                               "Failed to copy %s to %s: %s" % (pkg_path,
+                                                                dest, e))
+                self.Finished(EXIT_FAILED)
+                return
+        self.PercentageChanged(100)
         pklog.debug("Sending success signal")
         self.Finished(EXIT_SUCCESS)
  
commit ce7566bbd3aa456f991983f5d704641e6036ca44
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 23:10:27 2008 +0200

    APT: Replace EXIT_KILL by EXIT_KILLED

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 0ae947a..5bf7909 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -259,7 +259,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             if self._canceled.isSet():
                 self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
                                "The search was canceled")
-                self.Finished(EXIT_KILL)
+                self.Finished(EXIT_KILLED)
                 self._canceled.clear()
                 return
             elif search in pkg.name and self._is_package_visible(pkg, filters):
@@ -328,7 +328,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             if self._canceled.isSet():
                 self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
                                "Calculating updates was canceled")
-                self.Finished(EXIT_KILL)
+                self.Finished(EXIT_KILLED)
                 self._canceled.clear()
                 return
             else:
@@ -440,7 +440,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         except apt.cache.FetchCancelledException:
             self._open_cache(prange=(95,100))
             self.ErrorCode(ERROR_TRANSACTION_CANCELLED, "Download was canceled")
-            self.Finished(EXIT_KILL)
+            self.Finished(EXIT_KILLED)
             self._canceled.clear()
             return
         except:
@@ -653,7 +653,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         except apt.cache.FetchCancelledException:
             self._canceled.clear()
             self.ErrorCode(ERROR_TRANSACTION_CANCELLED, "Download was canceled")
-            self.Finished(EXIT_KILL)
+            self.Finished(EXIT_KILLED)
             return
         except:
             self._open_cache(prange=(95,100))
@@ -678,7 +678,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             if self._canceled.isSet():
                 self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
                                "The search was canceled")
-                self.Finished(EXIT_KILL)
+                self.Finished(EXIT_KILLED)
                 self._canceled.clear()
                 return
             elif self._is_package_visible(pkg, filters):
@@ -813,7 +813,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         if self._canceled.isSet():
             self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
                            "The search was canceled")
-            self.Finished(EXIT_KILL)
+            self.Finished(EXIT_KILLED)
             self._canceled.clear()
             return True
         else:
@@ -843,7 +843,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         '''
         if self._canceled.isSet():
              self.ErrorCode(ERROR_TRANSACTION_CANCELLED, msg)
-             self.Finished(EXIT_KILL)
+             self.Finished(EXIT_KILLED)
              self._canceled.clear()
              return True
         return False
commit f3352bc5a63b4c64a996aada3cf6f07d81e9b9c6
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 23:08:04 2008 +0200

    APT: Add a first try to implement DownloadPackages. Does not work yet

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 5ec1f93..0ae947a 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -556,6 +556,31 @@ class PackageKitAptBackend(PackageKitBaseBackend):
 
     @threaded
     @async
+    def doDownloadPackages(self, ids, dir):
+        '''
+        Implement the {backend}-download-packages functionality
+
+        Does not work yet. Need to find a way to get the package uri
+        '''
+        pklog.info("Downloading packages: %s" % ids)
+        self.StatusChanged(STATUS_INSTALL)
+        self.AllowCancel(False)
+        self.PercentageChanged(0)
+        self._check_init(prange=(0,10))
+        progress = PackageKitFetchProgress(self, prange=(10,90))
+        fetcher = apt_pkg.GetAcquire(progress)
+        for id in ids:
+            pkg = self._find_package_by_id(id)
+            apt_pkg.GetPkgAcqFile(fetcher,
+                                  "http://www.glatzor.de/index.php")
+        for item in fetcher.Items:
+            pklog.debug("Download item: %s" % item)
+        res = fetcher.Run()
+        pklog.debug("Sending success signal")
+        self.Finished(EXIT_SUCCESS)
+ 
+    @threaded
+    @async
     def doInstallPackages(self, ids):
         '''
         Implement the {backend}-install functionality
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index da16602..ac4e42e 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -212,7 +212,14 @@ backend_get_depends (PkBackend *backend, PkFilterEnum filters, gchar **package_i
 	        pk_backend_dbus_get_depends (dbus, filters, package_ids, recursive);
 }
 
-
+/**
+ *  * pk_backend_download_packages
+ *   */
+static void
+backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+{
+	        pk_backend_dbus_download_packages (dbus, package_ids, directory);
+}
 
 
 PK_BACKEND_OPTIONS (
@@ -223,7 +230,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_groups,			/* get_groups */
 	backend_get_filters,			/* get_filters */
 	backend_cancel,				/* cancel */
-	NULL,					/* download_packages */
+	backend_download_packages,		/* download_packages */
 	backend_get_depends,			/* get_depends */
 	backend_get_details,			/* get_details */
 	NULL,					/* get_files */
commit de6d4c0229bbc93a4cdfb7600090b896d1a307e7
Merge: b3e5fdf... 171d683...
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 19:40:18 2008 +0200

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

commit b3e5fdf22ac6c2c888674ab64c91cec1ecc36af5
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 19:37:14 2008 +0200

    APT: detect xapian earlier and rename variables more readable

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 95a94bd..5ec1f93 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -44,9 +44,19 @@ warnings.filterwarnings(action='ignore', category=FutureWarning)
 
 PACKAGEKIT_DBUS_SERVICE = 'org.freedesktop.PackageKitAptBackend'
 
-XAPIANDBPATH = os.environ.get("AXI_DB_PATH", "/var/lib/apt-xapian-index")
-XAPIANDB = XAPIANDBPATH + "/index"
-XAPIANDBVALUES = XAPIANDBPATH + "/values"
+# Xapian database is optionally used to speed up package description search
+XAPIAN_DB_PATH = os.environ.get("AXI_DB_PATH", "/var/lib/apt-xapian-index")
+XAPIAN_DB = XAPIAN_DB_PATH + "/index"
+XAPIAN_DB_VALUES = XAPIAN_DB_PATH + "/values"
+XAPIAN_SUPPORT = False
+try:
+    import xapian
+except ImportError:
+    pass
+else:
+    if os.access(XAPIAN_DB, os.R_OK):
+        pklog.debug("Use XAPIAN for the search")
+        XAPIAN_SUPPORT = True
 
 # Required for daemon mode
 os.putenv("PATH",
@@ -213,15 +223,6 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self._canceled = threading.Event()
         self._canceled.clear()
         self._lock = threading.Lock()
-        # Check for xapian support
-        self._use_xapian = False
-        try:
-            import xapian
-        except ImportError:
-            pass
-        else:
-            if os.access(XAPIANDB, os.R_OK):
-                self._use_xapian = True
         PackageKitBaseBackend.__init__(self, bus_name, dbus_path)
 
     # Methods ( client -> engine -> backend )
@@ -277,13 +278,13 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.AllowCancel(True)
         results = []
 
-        if self._use_xapian == True:
+        if XAPIAN_SUPPORT == True:
             search_flags = (xapian.QueryParser.FLAG_BOOLEAN |
                             xapian.QueryParser.FLAG_PHRASE |
                             xapian.QueryParser.FLAG_LOVEHATE |
                             xapian.QueryParser.FLAG_BOOLEAN_ANY_CASE)
             pklog.debug("Performing xapian db based search")
-            db = xapian.Database(XAPIANDB)
+            db = xapian.Database(XAPIAN_DB)
             parser = xapian.QueryParser()
             query = parser.parse_query(unicode(search),
                                        search_flags)
commit 599df9bc026e56ea8108e3729d916c27c8a9ec3c
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 19:22:10 2008 +0200

    APT: trivial code clean ups

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 63035d1..95a94bd 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -903,14 +903,13 @@ def takeover():
     try:
         bus = dbus.SystemBus()
     except dbus.DBusException, e:
-        print  "Unable to connect to dbus"
-        print "%s" %(e,)
+        pklog.critical("Unable to connect to dbus: %s" % e)
         sys.exit(1)
     proxy = bus.get_object(PACKAGEKIT_DBUS_SERVICE, PACKAGEKIT_DBUS_PATH)
     iface = dbus.Interface(proxy, PACKAGEKIT_DBUS_INTERFACE)
     try:
         iface.Exit()
-    except dbus.exceptions.DBusException:
+    except dbus.DBusException:
         pass
 
 def run():
commit 11688106787f8266d7441f94b2b9b5346c8b8920
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 19:03:28 2008 +0200

    APT: Fix a typo. trivial

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index aaa0847..63035d1 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -702,7 +702,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         pklog.info("Get depends (%s,%s,%s)" % (filters, ids, recursive))
         #FIXME: recursive is not yet implemented
         if recursive == True:
-            pkglog.warn("Recursive dependencies are not implemented")
+            pklog.warn("Recursive dependencies are not implemented")
         self.StatusChanged(STATUS_QUERY)
         self.NoPercentageUpdates()
         self._check_init(progress=False)
commit 0b199625cd881a843c8618c77d652bdd377253ba
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 18:56:07 2008 +0200

    APT: Fix the takeover command line switch. It should be a boolean.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index a29d1d9..aaa0847 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -925,7 +925,7 @@ def run():
 def main():
     parser = optparse.OptionParser(description="APT backend for PackageKit")
     parser.add_option("-t", "--takeover",
-                      action="store", type="string", dest="takeover",
+                      action="store_true", dest="takeover",
                       help="Exit the currently running backend "
                            "(Only needed by developers)")
     parser.add_option("-p", "--profile",
commit deb466d10f7990fc644037f928d959b7538bc4c7
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 18:54:38 2008 +0200

    APT: takeover should not fail on DBus errors

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 790771b..a29d1d9 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -908,7 +908,10 @@ def takeover():
         sys.exit(1)
     proxy = bus.get_object(PACKAGEKIT_DBUS_SERVICE, PACKAGEKIT_DBUS_PATH)
     iface = dbus.Interface(proxy, PACKAGEKIT_DBUS_INTERFACE)
-    iface.Exit()
+    try:
+        iface.Exit()
+    except dbus.exceptions.DBusException:
+        pass
 
 def run():
     """
commit 56ce28599585b357d1cdbde2db84fbfe7a3a7d02
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 18:52:01 2008 +0200

    APT: Reimplement doGetDepends after a short irc discussion with richard, since GetDepends is used like a preview for the installation. The whole dependency resoltion is now done by the package manager itself.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index d15cab3..790771b 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -686,54 +686,69 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                 self.Finished(EXIT_FAILED)
 
     @threaded
-    def doGetDepends(self, filters, pkg_ids, recursive=False):
+    def doGetDepends(self, filters, ids, recursive=False):
         '''
         Implement the apt2-get-depends functionality
+
+        Emit all packages that need to be installed or updated to install
+        the given package ids. It behaves like a preview of the changes
+        required for the installation. An error will be emitted if the 
+        dependecies cannot be satisfied.
+        In contrast to the yum backend the whole dependency resoltions is done 
+        by the package manager. Therefor the list of satisfied packages cannot
+        be computed easily. GDebi features this. Perhaps this should be moved
+        to python-apt.
         '''
-        pklog.info("Get depends (%s,%s,%s)" % (filters, pkg_ids, recursive))
+        pklog.info("Get depends (%s,%s,%s)" % (filters, ids, recursive))
         #FIXME: recursive is not yet implemented
         if recursive == True:
-            pkglog.warn("Recursive dependencies are not yet implemented")
+            pkglog.warn("Recursive dependencies are not implemented")
         self.StatusChanged(STATUS_QUERY)
         self.NoPercentageUpdates()
         self._check_init(progress=False)
         self.AllowCancel(True)
 
-        for pkg_id in pkg_ids:
+        # Mark all packages for installation
+        self._cache._depcache.Init()
+        for id in ids:
             if self._is_canceled(): return
-            pkg = self._find_package_by_id(pkg_id)
+            pkg = self._find_package_by_id(id)
             if pkg == None:
                 self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
                                "Package %s isn't available" % name)
                 self.Finished(EXIT_FAILED)
                 return
-            for dep in pkg.candidateDependencies:
-                # FIXME: Support or dependencies
-                # FIXME: Support provides
-                for b_dep in dep.or_dependencies:
-                    if self._cache.has_key(b_dep.name):
-                        dep_pkg = self._cache[b_dep.name]
-                        # Check if the required version is available
-                        if b_dep.version != "" and \
-                           apt_pkg.CheckDep(dep_pkg.candidateVersion,
-                                            b_dep.relation,
-                                            b_dep.version) != 1:
-                            self.Package(INFO_UNKNOWN,
-                                        "%s;%s;%s;" % (b_dep.name, 
-                                                       b_dep.version,
-                                                       dep_pkg.architecture),
-                                        dep_pkg.summary)
-                            continue
-                        if self._is_package_visible(dep_pkg, filters):
-                            self._emit_package(dep_pkg)
-                    else:
-                        self.Package(INFO_UNKNOWN,
-                                     "%s;%s;%s;" % (b_dep.name, b_dep.version,
-                                                    pkg.architecture),
-                                     "Unknown package")
+            try:
+                pkg.markInstall()
+            except Exception, e:
+                #FIXME: Introduce a new info enumerate PK_INFO_MISSING for
+                #       missing dependecies
+                self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,
+                               "Dependecies for %s cannot be satisfied: %s" % e)
+                self.Finished(EXIT_FAILED)
+                return
+        # Check the status of the resulting changes
+        for p in self._cache.getChanges():
+            if self._is_canceled(): return
+            if p.markedDelete:
+                # Packagekit policy forbids removing packages for installation
+                self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,
+                               "Remove the package %s before" % p.name)
+                self.Finished(EXIT_FAILED)
+                return
+            elif p.markedUpgrade or p.markedUpgrade:
+                self._emit_package(p)
+            else:
+                self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,
+                               "Please use an advanced package management tool "
+                               "e.g. Synaptic or aptitude, since there is a "
+                               "complex dependency situation.")
+                self.Finished(EXIT_FAILED)
+                return
+        # Clean up
+        self._cache._depcache.Init()
         self.Finished(EXIT_SUCCESS)
 
-
     # Helpers
 
     def _open_cache(self, prange=(0,100), progress=True):
commit 3843b74a1ed3d85a2a9d7bb2fa8da2659d1c3e91
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 15:34:43 2008 +0200

    APT: Update the HACKING document accordingly. trivial.

diff --git a/backends/apt/HACKING b/backends/apt/HACKING
index e0bf8b9..435bbcc 100644
--- a/backends/apt/HACKING
+++ b/backends/apt/HACKING
@@ -1,8 +1,7 @@
 The backend can be tested by running it as root from the source code
-repository. Make sure to kill packagekitd before to force a reintializing
-of the cache:
+repository. Use the -t/--takeover command line switch to kill a perhaps already
+running apt backend before:
 
-  killall packagekitd; python aptDBUSBackend.py --debug
+  sudo python aptDBUSBackend.py --debug --takeover
 
-The backend provides command line options. See "aptDBusBackend.py --help" for
-more details.
+Use the --help command line switch for more details.
commit 223ef1a0af4b25eb15e4217964527df71bb4788f
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 15:32:05 2008 +0200

    APT: add -t/--takeover command line switch to the backend which kills the currently running apt backend before starting the new one.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index f3d651f..d15cab3 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -878,7 +878,27 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         else:
             return None
 
+def takeover():
+    """
+    Exit the currently running backend
+    """
+    PACKAGEKIT_DBUS_SERVICE = 'org.freedesktop.PackageKitAptBackend'
+    PACKAGEKIT_DBUS_INTERFACE = 'org.freedesktop.PackageKitBackend'
+    PACKAGEKIT_DBUS_PATH = '/org/freedesktop/PackageKitBackend'
+    try:
+        bus = dbus.SystemBus()
+    except dbus.DBusException, e:
+        print  "Unable to connect to dbus"
+        print "%s" %(e,)
+        sys.exit(1)
+    proxy = bus.get_object(PACKAGEKIT_DBUS_SERVICE, PACKAGEKIT_DBUS_PATH)
+    iface = dbus.Interface(proxy, PACKAGEKIT_DBUS_INTERFACE)
+    iface.Exit()
+
 def run():
+    """
+    Start the apt backend
+    """
     loop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     bus = dbus.SystemBus(mainloop=loop)
     bus_name = dbus.service.BusName(PACKAGEKIT_DBUS_SERVICE, bus=bus)
@@ -886,6 +906,10 @@ def run():
 
 def main():
     parser = optparse.OptionParser(description="APT backend for PackageKit")
+    parser.add_option("-t", "--takeover",
+                      action="store", type="string", dest="takeover",
+                      help="Exit the currently running backend "
+                           "(Only needed by developers)")
     parser.add_option("-p", "--profile",
                       action="store", type="string", dest="profile",
                       help="Store profiling stats in the given file "
@@ -900,6 +924,9 @@ def main():
         pklog.setLevel(logging.DEBUG)
         sys.excepthook = debug_exception
 
+    if options.takeover:
+        takeover()
+
     if options.profile:
         import hotshot
         prof = hotshot.Profile(options.profile)
commit 171d683540effd3bacacb82b860be756153eb4ac
Author: Shishir Goel <crazyontheedge at gmail.com>
Date:   Mon Aug 11 14:30:23 2008 +0100

    add a metadata.conf file while creating the pack (slightly refactored by Richard Hughes)

diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index 8d604e9..08c80ab 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -188,6 +188,32 @@ out:
 }
 
 /**
+ * pk_generate_pack_get_metadata:
+ **/
+static gchar *
+pk_generate_pack_get_metadata (void)
+{
+	gchar *distro_id = NULL;
+	gchar *datetime = NULL;
+	gchar *contents = NULL;
+
+	/* get needed data */
+	distro_id = pk_get_distro_id ();
+	if (distro_id == NULL)
+		goto out;
+	datetime = pk_iso8601_present ();
+	if (datetime == NULL)
+		goto out;
+
+	/* whole file */
+	contents = g_strdup_printf ("distro_id=%s\ncreated=%s\n", distro_id, datetime);
+out:
+	g_free (distro_id);
+	g_free (datetime);
+	return contents;
+}
+
+/**
  * pk_generate_pack_create:
  **/
 static gboolean
@@ -200,7 +226,19 @@ pk_generate_pack_create (const gchar *tarfilename, GPtrArray *file_array, GError
 	guint i;
 	gchar *src;
 	gchar *dest;
+	gchar *meta_src;
+	gchar *meta_dest;
+	gchar *meta_contents;
+
+	/* create a file with metadata in it */
+	meta_contents = pk_generate_pack_get_metadata ();
+	meta_src = g_build_filename (g_get_tmp_dir (), "metadata.conf", NULL);
+	meta_dest = g_path_get_basename (meta_src);
+	ret = g_file_set_contents (meta_src, meta_contents, -1, error);
+	if (!ret)
+		goto out;
 
+	/* create the tar file */
 	file = g_fopen (tarfilename, "a+");
 	retval = tar_open (&t, (gchar *)tarfilename, NULL, O_WRONLY, 0, TAR_GNU);
 	if (retval != 0) {
@@ -209,6 +247,13 @@ pk_generate_pack_create (const gchar *tarfilename, GPtrArray *file_array, GError
 		goto out;
 	}
 
+	/* add the metadata first */
+	retval = tar_append_file(t, (gchar *)meta_src, meta_dest);
+	if (retval != 0) {
+		 *error = g_error_new (1, 0, "failed to copy %s into %s", meta_src, meta_dest);
+		ret = FALSE;
+	}
+
 	/* add each of the files */
 	for (i=0; i<file_array->len; i++) {
 		src = (gchar *) g_ptr_array_index (file_array, i);
@@ -237,6 +282,11 @@ pk_generate_pack_create (const gchar *tarfilename, GPtrArray *file_array, GError
 	tar_close (t);
 	fclose (file);
 out:
+	/* delete metadata file */
+	g_remove (meta_contents);
+	g_remove (meta_src);
+	g_free (meta_src);
+	g_free (meta_dest);
 	return ret;
 }
 
commit da98b84cafc8f9f74147288cc1215bb8914992e9
Merge: eb3a224... c8d5d94...
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Aug 11 14:18:05 2008 +0100

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

commit eb3a22441a242f9261ec48d0ab28ce3d0a3b274f
Author: Shishir Goel <crazyontheedge at gmail.com>
Date:   Mon Aug 11 14:11:57 2008 +0100

    add a man page for pkgenpack

diff --git a/man/Makefile.am b/man/Makefile.am
index c6a7640..673a847 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,11 +1,13 @@
 EXTRA_DIST =				\
 	pkcon.xml			\
-	pkmon.xml
+	pkmon.xml			\
+	pkgenpack.xml
 
 if HAVE_DOCBOOK2MAN
 man_MANS =				\
 	pkcon.1				\
-	pkmon.1
+	pkmon.1				\
+	pkgenpack.1
 endif
 
 if HAVE_DOCBOOK2MAN
@@ -14,6 +16,10 @@ pkcon.1: pkcon.xml
 
 pkmon.1: pkmon.xml
 	xsltproc http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $? &> /dev/null
+
+pkgenpack.1: pkgenpack.xml
+	xsltproc http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $? &> /dev/null
+
 endif
 
 clean-local :
diff --git a/man/pkgenpack.xml b/man/pkgenpack.xml
new file mode 100644
index 0000000..b516fd5
--- /dev/null
+++ b/man/pkgenpack.xml
@@ -0,0 +1,150 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.xml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.xml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.xml
+	docbook-to-man $< > $@
+
+	The docbook-to-man binary is found in the docbook-to-man package.
+	Please remember that if you create the nroff version in one of the
+	debian/rules file targets (such as build), you will need to include
+	docbook-to-man in your Build-Depends control field.
+  -->
+
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY date        "<date>31 July,2008</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY package     "pkgenpack">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <copyright>
+      <year>2008</year>
+      <holder>Shishir Goel</holder>
+    </copyright>
+    &date;
+  </refentryinfo>
+  <refmeta>
+    <refentrytitle>pkgenpack</refentrytitle>
+    <manvolnum>1</manvolnum>
+  </refmeta>
+  <refnamediv>
+    <refname>&package;</refname>
+    <refpurpose>PackageKit Pack Generator</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&package;</command>
+      <arg><option>options</option></arg>
+      <arg><option>path</option></arg>
+      <arg><option>package ..</option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>Description</title>
+    <para>
+      This manual page documents briefly the <command>&package;</command> command.
+    </para>
+    <para>
+      <command>&package;</command> is the command line client for PackageKit for creating service packs.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>What is a Service Pack?</title>
+    <para>
+      A service pack is a tarball which contains the particular package and its dependencies.
+      The user can select the dependencies to be packed using the --with-package-list option.
+      Along with the dependencies, a service pack has a file named metadata.conf which contains
+      the information like distro_id and date of creation of the pack.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Creating a Service Pack?</title>
+    <para>
+      A service pack can be created using pkgenpack. When creating a pack, the user needs to specify
+      a valid path for the service pack and the package for which the pack has to be created.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Options</title>
+    <para>
+      --with-package-list
+    </para>
+    <para>
+      allows the user to explicitly specify the file list of packages from which the dependencies
+        are to be excluded. Generally, the file list of packages is generated using
+      pk-generate-package-list on the target system. If not used, pkgenpack
+        uses /var/lib/PackageKit/package-list.txt by default.
+    </para>
+    <para>
+      --verbose or -v
+    </para>
+    <para>
+      presents the debugging details to the user.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Naming a Service Pack</title>
+    <para>
+     The only valid extension for a service pack is ".pack". The user needs to specify
+     the full path of the pack, when using pkgenpack to generate a service pack.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Examples</title>
+    <para>
+      1. Tim is facing problems with his Internet connection at home. He needs a service pack
+      with valgrind and it's dependancies for his system. He asks James to generate a pack for him. Both know
+      James's system should contain similar packages as Tim's system, as both of them
+      have installed Fedora 9 two days ago. James simply runs:
+    </para>
+    <para>
+      [james at jamesbook:~]$pkgenpack /media/USB/TimPacks/valgrind.pack valgrind
+    </para>
+    <para>
+     This generates a file valgrind.pack on the USB key Tim gave to James. Tim can now go home,
+     insert the USB key and double click on the valgrind.pack to be prompted to install these packages.
+    </para>
+    <para>
+      2. Bill wants to create a service pack named kdegames.pack for his new system which does not have
+      an internet connection. He generates a list of packages on his system using pk-generate-package-list
+      and copies that list to his USB key. He then gives that USB to Rishi who has a good internet connectivity.
+      Rishi runs the following command on his system:
+    </para>
+    <para>
+      [rishi at devils-temple:~]$pkgenpack --with-package-list /media/USB/package-list.txt /home/rishi/Desktop/kdegames.pack kdegames
+    </para>
+    <para>
+      This generates a service pack, kdegames.pack, on Rishi's Desktop, which can be distributed
+      to Bill and users with similar requirements.
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Installing A Service Pack</title>
+    <para>
+      Service Packs can be installed using pkcon by specifying the valid path. For example:
+    </para>
+    <para>
+      [hacker at tim-lounge:~]$pkcon install /home/USB/TimPacks/valgrind.pack
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>See Also</title>
+    <para>pkmon (1). pkcon(1).</para>
+  </refsect1>
+  <refsect1>
+    <title>Author</title>
+    <para>
+      This manual page was written by Shishir Goel <email>crazyontheedge at gmail.com</email>.
+    </para>
+  </refsect1>
+</refentry>
commit f2367e57327b807ad593624c155ea37aa77072c5
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Aug 11 14:05:21 2008 +0100

    yum: trivial: fix the development files regex

diff --git a/backends/yum/helpers/yumFilter.py b/backends/yum/helpers/yumFilter.py
index 1aae192..8dde207 100644
--- a/backends/yum/helpers/yumFilter.py
+++ b/backends/yum/helpers/yumFilter.py
@@ -190,7 +190,7 @@ class YumFilter(object):
             wantDevel = True
         else:
             wantDevel = False
-        regex =  re.compile(r'(-devel)|(-dgb)|(-static)')
+        regex =  re.compile(r'(-devel)|(-debuginfo)|(-static)|(-libs)')
         if regex.search(pkg.name):
             isDevel = True
         return isDevel == wantDevel
commit c3318fa5f4e5d97efb0b91c1280242df7fdb086f
Author: Shishir Goel <crazyontheedge at gmail.com>
Date:   Mon Aug 11 14:03:35 2008 +0100

    add information about service packs and pkgenpack in faqs and usage on the website

diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index ffd15f9..813c47e 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -42,6 +42,7 @@
 <li><a href="#how-fast">How fast is PackageKit?</a></li>
 <li><a href="#multiple-users">How does PackageKit work with multiple users?</a></li>
 <li><a href="#use-existing-tools">Can users still use their normal package managers?</a></li>
+<li><a href="#service-pack">What is a Service Pack?</a></li>
 <li><a href="#hughsies-law">What is Hughsie's law?</a></li>
 <li><a href="#translation">How do I translate gnome-packagekit?</a></li>
 <li><a href="#corporate-sponsor">Is there an organization sponsoring development of PackageKit?</a></li>
@@ -511,6 +512,16 @@ No more fighting over <code>yum</code>, <code>yum-updatesd</code>,
 </p>
 
 <hr>
+<h3><a name="service-pack">What is a Service Pack?</a></h3>
+<p>
+A service pack is a tarball which contains the particular package and its dependencies.
+The user can select the dependencies to be packed using the --with-package-list option.
+Along with the dependencies, a service pack has a file named metadata.conf which contains
+the distribution name and version and the date of creation of the pack.
+Service packs are generated using the command line client <code>pkgenpack</code>.
+</p>
+
+<hr>
 <h3><a name="hughsies-law">What is Hughsie's law?</a></h3>
 <p>
 A joke that started on IRC late one night in '07.
diff --git a/docs/html/pk-using.html b/docs/html/pk-using.html
index b2b028e..a7026b9 100644
--- a/docs/html/pk-using.html
+++ b/docs/html/pk-using.html
@@ -26,26 +26,36 @@ PackageKit on the command. For example:
 </p>
 <pre>
 [hughsie at laptop ~]$ pkcon get updates
-normal       powertop             i386    1.8-1.fc8       fedora    Power consumption monitor
-security     kernel               i386    2.6.23-0.115.rc3.git1.fc8 installed The Linux kernel
-security     gtkhtml2             i386    2.19.1-4.fc8    fedora    An HTML widget for GTK+ 2.0
-Runtime was 0 seconds
+[hughsie at hughsie-work PackageKit]$ pkcon get-updates
+security    	bluez-utils-3.35-3.fc9                  	Bluetooth utilities
+bugfix      	xterm-236-1.fc9                         	Terminal emulator for the X Window System
+bugfix      	kernel-devel-2.6.25.14-108.fc9          	Development package for building kernel modules to match the kernel
+enhancement 	kde-filesystem-4-17.fc9                 	KDE filesystem layout
+enhancement 	subversion-1.5.1-1.fc9                  	Modern Version Control System designed to replace CVS
 </pre>
 <p>or</p>
 <pre>
-[hughsie at laptop ~]$ pkcon search name power
-installed    powerman             i386    1.0.25-2.fc7    installed   PowerMan - Power to the Cluster
-installed    powertop             i386    1.8-1.fc8       installed   Power consumption monitor
-installed    gnome-power-manager  i386    2.20.0-5.fc8    installed   GNOME Power Manager
-available    kpowersave           i386    0.7.3-0.2svn20070828.fc8 development KPowersave is the KDE frontend for powermanagement
-available    kadu-powerkadu       i386    0.5.0-4.fc8     development Powerkadu module for Kadu
-available    powermanga           i386    0.90-1          development Arcade 2D shoot-them-up game
-Runtime was 2 seconds
+[hughsie at hughsie-work PackageKit]$ pkcon --filter=~devel search name power
+installed   	DeviceKit-power-001-0.8.20080811git.fc9 	Power Management Service
+installed   	gnome-power-manager-2.23.4-1.118.20080801svn.fc9.hughsie	GNOME Power Manager
+installed   	powerman-2.1-1.fc9                      	PowerMan - Power to the Cluster
+installed   	powertop-1.9-3.fc9                      	Power consumption monitor
+available   	gnome-power-manager-2.22.1-1.fc9        	GNOME Power Manager
+available   	kadu-powerkadu-0.6.0-3.fc9              	PowerKadu
+available   	kadu-powerkadu-0.6.0.1-1.fc9            	PowerKadu
+available   	kpowersave-0.7.3-3.fc9                  	KPowersave is the KDE frontend for powermanagement
+available   	powerman-1.0.32-5.fc9                   	PowerMan - Power to the Cluster
+available   	powermanga-0.90-3                       	Arcade 2D shoot-them-up game
 </pre>
 <p>
 The <code>pkmon</code> program allows you to monitor what PackageKit is
 doing on the command line and is mainly used for debugging.
 </p>
+<p>
+The <code>pkgenpack</code> program allows you to generate
+<a href="pk-faq.html#service-pack">Service Packs</a> with a package and its dependencies.
+</p>
+
 
 <h2>Using graphical tools:</h2>
 <p>
commit c8d5d94f8b3668c285140db6b411c97f059fd013
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 13:42:43 2008 +0200

    Make sure ret in pk-generate-pack can not be used uninitialised

diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index 60bc9de..8d604e9 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -286,7 +286,7 @@ pk_generate_pack_main (const gchar *pack_filename, const gchar *directory, const
 	GPtrArray *file_array = NULL;
 	PkClient *client;
 	GError *error_local;
-	gboolean ret;
+	gboolean ret = FALSE;
 	gchar *text;
 
 	client = pk_client_new ();
commit 1527ae73d11d9169eb6543057569469d574da96e
Merge: 3f4a9c3... 7b360a1...
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 13:33:28 2008 +0200

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

commit 3f4a9c31cd78d89e198185ae4d4288837ed823e1
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 13:18:14 2008 +0200

    APT: Show license information based on the component of Ubuntu and Debian repositories

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index d257996..f3d651f 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -404,8 +404,15 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             # replace all multiple spaces by newlines
             p = re.compile(r'\s\s+', re.MULTILINE)
             desc = p.sub('\n', desc)
-            #FIXME: group and licence information missing
-            self.Details(pkg_id, 'unknown', 'unknown', desc,
+            #FIXME: group information missing
+            #FIXME: We need more fine grained license information!
+            origin = pkg.candidateOrigin
+            if origin[0].component in ["main", "universe"] and \
+               origin[0].origin in ["Debian", "Ubuntu"]:
+                license = "free"
+            else:
+                license = "unknown"
+            self.Details(pkg_id, license, 'unknown', desc,
                          pkg.homepage, pkg.packageSize)
             self.Finished(EXIT_SUCCESS)
 
commit 7b360a1d6835bc05988483dc6ea3e0b89bc3fdc9
Author: Shishir Goel <crazyontheedge at gmail.com>
Date:   Mon Aug 11 11:21:23 2008 +0100

    remove the temporary directory after installing the pack

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 5a39b3a..2837574 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -954,6 +954,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                         self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % inst_file)
             except yum.Errors.InstallError,e:
                 self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
+	shutil.rmtree(tempdir)
 
     def _check_local_file(self, pkg):
         """
commit 4d8670c5bc7891326d3fda76abc78ceec2fd655a
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 11:45:26 2008 +0200

    APT: GetDepends(): Take version requirements into account.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 2fa5d75..d257996 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -704,11 +704,21 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                 # FIXME: Support or dependencies
                 # FIXME: Support provides
                 for b_dep in dep.or_dependencies:
-                    # FIXME: Take version numbers into account
                     if self._cache.has_key(b_dep.name):
-                        if self._is_package_visible(self._cache[b_dep.name],
-                                                    filters):
-                            self._emit_package(self._cache[b_dep.name])
+                        dep_pkg = self._cache[b_dep.name]
+                        # Check if the required version is available
+                        if b_dep.version != "" and \
+                           apt_pkg.CheckDep(dep_pkg.candidateVersion,
+                                            b_dep.relation,
+                                            b_dep.version) != 1:
+                            self.Package(INFO_UNKNOWN,
+                                        "%s;%s;%s;" % (b_dep.name, 
+                                                       b_dep.version,
+                                                       dep_pkg.architecture),
+                                        dep_pkg.summary)
+                            continue
+                        if self._is_package_visible(dep_pkg, filters):
+                            self._emit_package(dep_pkg)
                     else:
                         self.Package(INFO_UNKNOWN,
                                      "%s;%s;%s;" % (b_dep.name, b_dep.version,
commit b2e4cdead9b18aafa8981c5b525fa96e11ba87d6
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 10:51:54 2008 +0200

    APT: Clean up error messages in doUpdatePackages (). Make the method available from packagekitd. Check isUpgradable after committing changes.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 40cd65c..2fa5d75 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -499,7 +499,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         Implement the {backend}-update functionality
         '''
         pklog.info("Updating package with id %s" % ids)
-        self.StatusChanged(STATUS_INSTALL)
+        self.StatusChanged(STATUS_UPDATE)
         self.AllowCancel(False)
         self.PercentageChanged(0)
         self.StatusChanged(STATUS_RUNNING)
@@ -513,7 +513,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                 return
             if not pkg.isUpgradable:
                 self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,
-                               "Package %s is already installed" % pkg.name)
+                               "Package %s is already up-to-date" % pkg.name)
                 self.Finished(EXIT_FAILED)
                 return
             pkgs.append(pkg.name[:])
@@ -522,24 +522,25 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             except:
                 self._open_cache(prange=(90,100))
                 self.ErrorCode(ERROR_UNKNOWN, "%s could not be queued for "
-                                              "installation" % pkg.name)
+                                              "update" % pkg.name)
                 self.Finished(EXIT_FAILED)
                 return
         try:
             self._cache.commit(PackageKitFetchProgress(self, prange=(10,50)),
                                PackageKitInstallProgress(self, prange=(50,90)))
         except Exception, e:
-            pklog.warning("exception %s during commit()" % e)
+            pklog.warning("Exception during commit(): %s" % e)
             self._open_cache(prange=(90,100))
-            self.ErrorCode(ERROR_UNKNOWN, "Installation failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Update failed")
             self.Finished(EXIT_FAILED)
             return
         self._open_cache(prange=(90,100))
         self.PercentageChanged(100)
         pklog.debug("Checking success of operation")
         for p in pkgs:
-            if not self._cache.has_key(p) or not self._cache[p].isInstalled:
-                self.ErrorCode(ERROR_UNKNOWN, "%s was not installed" % p)
+            if not self._cache.has_key(p) or not self._cache[p].isInstalled \
+               or self._cache[p].isUpgradable:
+                self.ErrorCode(ERROR_UNKNOWN, "%s was not updated" % p)
                 self.Finished(EXIT_FAILED)
                 return
         pklog.debug("Sending success signal")
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index ed22ab2..da16602 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -114,6 +114,15 @@ backend_update_system (PkBackend *backend)
 }
 
 /**
+ * backend_update_packages
+ *  */
+static void
+backend_update_packages (PkBackend *backend, gchar **package_ids)
+{
+	pk_backend_dbus_update_packages (dbus, package_ids);
+}
+
+/**
  * backend_install_packages
  *  */
 static void
@@ -237,7 +246,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	backend_search_name,			/* search_name */
 	NULL,					/* service_pack */
-	NULL,					/* update_packages */
+	backend_update_packages,		/* update_packages */
 	backend_update_system,			/* update_system */
 	NULL					/* what_provides */
 );
commit ad09db6765b5c1e3056862049bc9328bb0f97005
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 09:51:03 2008 +0200

    APT: trivial updates to the documentation

diff --git a/backends/apt/README b/backends/apt/README
index 0a3da6e..c1932ff 100644
--- a/backends/apt/README
+++ b/backends/apt/README
@@ -1,4 +1,4 @@
-The name of this backend is apt2.
+The name of this backend is apt
 
 It supports apt which is mainly used by Debian and its derivates. In contrast to
 the backend called apt this one uses DBus for the communication with the 
diff --git a/backends/apt/TODO b/backends/apt/TODO
index bee2f3d..0ff4a49 100644
--- a/backends/apt/TODO
+++ b/backends/apt/TODO
@@ -9,7 +9,7 @@ http://wiki.debian.org/PackageKit
 TODO:
 
  * Implement all open backend methods. A list of implemented backend methods 
-   can be found in PackageKit FAQ or in pk-backend-apt2.c.
+   can be found in PackageKit FAQ or in pk-backend-apt.c.
 
  * Blacklist packages requiring input on the terminal and try to change
    the Debian policy in the long run. Way of automation?
@@ -65,6 +65,3 @@ TODO:
   The following could not be maped: science, documentation, electronics
   Are there any derivates with additional sections?
 
- * Fix the dbus policy. Should we require at_console for searching?
- 
-DONE:
commit 5c0d25ed4b43940084d8abfef9b9abff93b48429
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 09:47:10 2008 +0200

    APT: trvial. Add some more information to HACKING and the command line description

diff --git a/backends/apt/HACKING b/backends/apt/HACKING
index 2b99c5d..e0bf8b9 100644
--- a/backends/apt/HACKING
+++ b/backends/apt/HACKING
@@ -2,4 +2,7 @@ The backend can be tested by running it as root from the source code
 repository. Make sure to kill packagekitd before to force a reintializing
 of the cache:
 
-  killall packagekitd; python aptDBUSBackend.py 
+  killall packagekitd; python aptDBUSBackend.py --debug
+
+The backend provides command line options. See "aptDBusBackend.py --help" for
+more details.
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 4747e90..40cd65c 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -874,7 +874,8 @@ def main():
                            "(Only needed by developers)")
     parser.add_option("-d", "--debug",
                       action="store_true", dest="debug",
-                      help="Show a lot of additional information "
+                      help="Show a lot of additional information and drop to "
+                           "a debugging console on unhandled exceptions "
                            "(Only needed by developers)")
     (options, args) = parser.parse_args()
     if options.debug:
commit 12f2ac2fb45c27f9f162b6b4d28f45d2ba7b42cc
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 09:43:56 2008 +0200

    APT: Add a small script to analyze the HotShot profiling stats

diff --git a/backends/apt/hotshot-analyze.py b/backends/apt/hotshot-analyze.py
new file mode 100755
index 0000000..733442c
--- /dev/null
+++ b/backends/apt/hotshot-analyze.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+Provides an apt backend to PackageKit
+
+Copyright (C) 2008 Sebastian Heinlein <glatzor at ubuntu.com>
+
+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 option) any later version.
+"""
+
+__author__  = "Sebastian Heinlein <devel at glatzor.de>"
+
+import hotshot
+import hotshot.stats
+import optparse
+import sys
+
+def main():
+    parser = optparse.OptionParser(usage="hotshot-analyze.py "
+                                         "PATH_TO_STATS_FILE",
+                                   description="Statistics analyzer for the "
+                                               "HotShot Python profiler")
+    (options, args) = parser.parse_args()
+    if len(args) != 1:
+        parser.print_help()
+        sys.exit(1)
+
+    stats = hotshot.stats.load(args[0])
+    stats.strip_dirs()
+    stats.sort_stats('time', 'calls')
+    stats.print_stats(20)
+
+if __name__ == "__main__":
+    main()
commit 7ddcee3a08c1d9c12741438a2e03bebb90b428be
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 09:42:17 2008 +0200

    APT: Add new command line options to the backend:
     - profile: create a hotshots stats file
     - debug: drop to debugger on unhandeled exceptions and set log level to DEBUG

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index b1cf8e5..4747e90 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -18,10 +18,13 @@ the Free Software Foundation; either version 2 of the License, or
 __author__  = "Sebastian Heinlein <devel at glatzor.de>"
 __state__   = "experimental"
 
+import logging
+import optparse
 import os
 import pty
 import re
 import signal
+import sys
 import time
 import threading
 import warnings
@@ -56,6 +59,23 @@ os.putenv("APT_LISTCHANGES_FRONTEND", "none")
 gobject.threads_init()
 dbus.glib.threads_init()
 
+def debug_exception(type, value, tb):
+    """
+    Provides an interactive debugging session on unhandled exceptions
+    See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287
+    """
+    if hasattr(sys, 'ps1') or not sys.stderr.isatty() or \
+       not sys.stdin.isatty() or not sys.stdout.isatty() or type==SyntaxError:
+        # Calls the default handler in interactive mode, if output is·
+        # redirected or on syntax errors
+        sys.__excepthook__(type, value, tb)
+    else:
+       import traceback, pdb
+       traceback.print_exception(type, value, tb)
+       print
+       pdb.pm()
+
+
 class PackageKitOpProgress(apt.progress.OpProgress):
     '''
     Handle the cache opening process
@@ -840,13 +860,35 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         else:
             return None
 
-
-def main():
+def run():
     loop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     bus = dbus.SystemBus(mainloop=loop)
     bus_name = dbus.service.BusName(PACKAGEKIT_DBUS_SERVICE, bus=bus)
     manager = PackageKitAptBackend(bus_name, PACKAGEKIT_DBUS_PATH)
 
+def main():
+    parser = optparse.OptionParser(description="APT backend for PackageKit")
+    parser.add_option("-p", "--profile",
+                      action="store", type="string", dest="profile",
+                      help="Store profiling stats in the given file "
+                           "(Only needed by developers)")
+    parser.add_option("-d", "--debug",
+                      action="store_true", dest="debug",
+                      help="Show a lot of additional information "
+                           "(Only needed by developers)")
+    (options, args) = parser.parse_args()
+    if options.debug:
+        pklog.setLevel(logging.DEBUG)
+        sys.excepthook = debug_exception
+
+    if options.profile:
+        import hotshot
+        prof = hotshot.Profile(options.profile)
+        prof.runcall(run)
+        prof.close()
+    else:
+        run()
+
 if __name__ == '__main__':
     main()
 
commit 86e4bb6a5d05bd87659462d716f488947ffa8e4e
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 09:41:54 2008 +0200

    Set the default logging level to INFO in the dbus python backend.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 7c88dc2..a9337ce 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -42,7 +42,7 @@ from pkexceptions import *
 
 logging.basicConfig(format="%(levelname)s:%(message)s")
 pklog = logging.getLogger("PackageKitBackend")
-pklog.setLevel(logging.DEBUG)
+pklog.setLevel(logging.INFO)
 
 syslog = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON,address='/dev/log')
 formatter = logging.Formatter('PackageKit: %(levelname)s: %(message)s')
commit 26dad816b503c84c7f1fde34e4af566a204986ce
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 01:42:51 2008 +0200

    APT: Support string array of package names in doResolve() API-Change

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 2d894b1..b1cf8e5 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -632,7 +632,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.Finished(EXIT_SUCCESS)
 
     @threaded
-    def doResolve(self, filters, name):
+    def doResolve(self, filters, names):
         '''
         Implement the apt2-resolve functionality
         '''
@@ -643,18 +643,19 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.AllowCancel(False)
 
         #FIXME: Support candidates
-        pkg = None
-        if self._cache.has_key(name):
-            pkg = self._cache[name]
-            if not self._is_package_visible(pkg, filters):
-                pkg = None
-        if pkg:
-            self._emit_package(pkg)
-            self.Finished(EXIT_SUCCESS)
-        else:
-            self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
-                           "Package name %s could not be resolved" % name)
-            self.Finished(EXIT_FAILED)
+        for name in names:
+            pkg = None
+            if self._cache.has_key(name):
+                pkg = self._cache[name]
+                if not self._is_package_visible(pkg, filters):
+                    pkg = None
+            if pkg:
+                self._emit_package(pkg)
+                self.Finished(EXIT_SUCCESS)
+            else:
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "Package name %s could not be resolved" % name)
+                self.Finished(EXIT_FAILED)
 
     @threaded
     def doGetDepends(self, filters, pkg_ids, recursive=False):
commit a6a7533dffcb47eb79a3d3679684545c8a2634de
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 01:40:14 2008 +0200

    APT: Implement a basic doGetDepends(). Lakes support for or dependecies, version requirements or provides.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index c152253..2d894b1 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -656,6 +656,45 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                            "Package name %s could not be resolved" % name)
             self.Finished(EXIT_FAILED)
 
+    @threaded
+    def doGetDepends(self, filters, pkg_ids, recursive=False):
+        '''
+        Implement the apt2-get-depends functionality
+        '''
+        pklog.info("Get depends (%s,%s,%s)" % (filters, pkg_ids, recursive))
+        #FIXME: recursive is not yet implemented
+        if recursive == True:
+            pkglog.warn("Recursive dependencies are not yet implemented")
+        self.StatusChanged(STATUS_QUERY)
+        self.NoPercentageUpdates()
+        self._check_init(progress=False)
+        self.AllowCancel(True)
+
+        for pkg_id in pkg_ids:
+            if self._is_canceled(): return
+            pkg = self._find_package_by_id(pkg_id)
+            if pkg == None:
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "Package %s isn't available" % name)
+                self.Finished(EXIT_FAILED)
+                return
+            for dep in pkg.candidateDependencies:
+                # FIXME: Support or dependencies
+                # FIXME: Support provides
+                for b_dep in dep.or_dependencies:
+                    # FIXME: Take version numbers into account
+                    if self._cache.has_key(b_dep.name):
+                        if self._is_package_visible(self._cache[b_dep.name],
+                                                    filters):
+                            self._emit_package(self._cache[b_dep.name])
+                    else:
+                        self.Package(INFO_UNKNOWN,
+                                     "%s;%s;%s;" % (b_dep.name, b_dep.version,
+                                                    pkg.architecture),
+                                     "Unknown package")
+        self.Finished(EXIT_SUCCESS)
+
+
     # Helpers
 
     def _open_cache(self, prange=(0,100), progress=True):
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 4423d3f..ed22ab2 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -194,6 +194,16 @@ backend_get_packages (PkBackend *backend, PkFilterEnum filters)
 	        pk_backend_dbus_get_packages (dbus, filters);
 }
 
+/**
+ *  * pk_backend_get_depends:
+ *   */
+static void
+backend_get_depends (PkBackend *backend, PkFilterEnum filters, gchar **package_ids, gboolean recursive)
+{
+	        pk_backend_dbus_get_depends (dbus, filters, package_ids, recursive);
+}
+
+
 
 
 PK_BACKEND_OPTIONS (
@@ -205,7 +215,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_filters,			/* get_filters */
 	backend_cancel,				/* cancel */
 	NULL,					/* download_packages */
-	NULL,					/* get_depends */
+	backend_get_depends,			/* get_depends */
 	backend_get_details,			/* get_details */
 	NULL,					/* get_files */
 	backend_get_packages,			/* get_packages */
commit 7e1cc0101ddae67c76a09de2b5666db53e0d1dd7
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Mon Aug 11 01:29:46 2008 +0200

    Fix: Submit the filters to the doGetDepends method in the python dbus backend.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index df15b98..c7c0bfe 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -591,7 +591,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
     @threaded
     @async
-    def doGetDepends(self,package,recursive):
+    def doGetDepends(self,filters,package,recursive):
         '''
         Print a list of depends for a given package
         '''
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index f7beed3..7c88dc2 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -538,9 +538,9 @@ class PackageKitBaseBackend(dbus.service.Object):
         Print a list of depends for a given package
         '''
         pklog.info("GetDepends(%s,%s,%s)" % (filters,package_ids,recursive))
-        self.doGetDepends(package_ids,recursive)
+        self.doGetDepends(filters,package_ids,recursive)
 
-    def doGetDepends(self,package_ids,recursive):
+    def doGetDepends(self,filters,package_ids,recursive):
         '''
         Should be replaced in the corresponding backend sub class
         '''
commit 7447312993b7c71f988816d609dac8d0e330108b
Merge: c1f115b... d6c2800...
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Sun Aug 10 23:46:56 2008 +0200

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

commit c1f115bab473c958d7c7e9d81ab20acd3e512f15
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Sun Aug 10 23:45:46 2008 +0200

    APT: trivial. fix a tyo in the doGetUpdateDetail method

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 90fb306..1fce831 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -291,7 +291,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.Finished(EXIT_SUCCESS)
 
     @threaded
-    def doGetUpdateDetails(self, pkg_ids):
+    def doGetUpdateDetail(self, pkg_ids):
         '''
         Implement the {backend}-get-update-details functionality
         '''
commit d6c28007cd1083525841d5a624eef78971514b1f
Author: Piotr DrÄ…g <piotrdrag at gmail.com>
Date:   Sat Aug 9 23:51:21 2008 +0000

    Updated Polish translation
    
    Transmitted-via: Transifex (translate.fedoraproject.org)

diff --git a/po/pl.po b/po/pl.po
index 0b2aab6..8444059 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -5,240 +5,276 @@ msgid ""
 msgstr ""
 "Project-Id-Version: pl\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-07-22 19:44+0000\n"
-"PO-Revision-Date: 2008-07-24 20:39+0200\n"
+"POT-Creation-Date: 2008-08-09 17:20+0000\n"
+"PO-Revision-Date: 2008-08-10 01:50+0200\n"
 "Last-Translator: Piotr DrÄ…g <piotrdrag at gmail.com>\n"
 "Language-Team: Polish <pl at li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:220
 msgid "Update detail"
 msgstr "Szczegóły aktualizacji"
 
-#: ../client/pk-console.c:413
+#: ../client/pk-console.c:437
 msgid "A system restart is required"
 msgstr "Wymagane jest ponowne uruchomienie systemu"
 
-#: ../client/pk-console.c:415
+#: ../client/pk-console.c:439
 msgid "A logout and login is required"
 msgstr "Wymagane jest wylogowanie siÄ™ i ponowne zalogowanie"
 
-#: ../client/pk-console.c:417
+#: ../client/pk-console.c:441
 msgid "An application restart is required"
 msgstr "Wymagane jest ponowne uruchomienie aplikacji"
 
-#: ../client/pk-console.c:462
-#, c-format
-msgid "Please enter a number from 1 to %i: "
-msgstr "Proszę podać numer od 1 do %i: "
-
-#: ../client/pk-console.c:525
-msgid "Could not find a package match"
-msgstr "Nie można znaleźć pasującego pakietu"
-
-#: ../client/pk-console.c:539
+#: ../client/pk-console.c:534 ../client/pk-generate-pack.c:115
 msgid "There are multiple package matches"
 msgstr "Pasuje kilka pakietów"
 
 #. find out what package the user wants to use
-#: ../client/pk-console.c:546
+#: ../client/pk-console.c:541 ../client/pk-generate-pack.c:122
 msgid "Please enter the package number: "
 msgstr "Proszę podać numer pakietu: "
 
-#: ../client/pk-console.c:580
-msgid ""
-"Could not find a package with that name to install, or package already "
-"installed"
-msgstr ""
-"Nie można znaleźć pakietu o tej nazwie do zainstalowania, lub pakiet jest "
-"już zainstalowany"
+#: ../client/pk-console.c:575
+msgid "Could not find package to install"
+msgstr "Nie można znaleźć pakietu do zainstalowania"
 
-#: ../client/pk-console.c:726
-msgid "Could not find a package to remove"
+#: ../client/pk-console.c:679
+msgid "Could not find package to remove"
 msgstr "Nie można znaleźć pakietu do usunięcia"
 
-#: ../client/pk-console.c:787
+#: ../client/pk-console.c:740
 msgid "The following packages have to be removed"
 msgstr "Następujące pakiety muszą zostać usunięte"
 
 #. get user input
-#: ../client/pk-console.c:794
+#: ../client/pk-console.c:747
 msgid "Okay to remove additional packages?"
 msgstr "Usunąć dodatkowe pakiety?"
 
-#: ../client/pk-console.c:798
+#: ../client/pk-console.c:751 ../client/pk-generate-pack.c:356
+#: ../client/pk-generate-pack.c:487
 msgid "Cancelled!"
 msgstr "Anulowano!"
 
-#: ../client/pk-console.c:832
-msgid "Could not find a package to download"
-msgstr "Nie można znaleźć pakietu do pobrania"
+#: ../client/pk-console.c:785
+msgid "Could not find package to download:"
+msgstr "Nie można znaleźć pakietu do pobrania:"
 
-#: ../client/pk-console.c:883
-msgid "Could not find a package with that name to update"
-msgstr "Nie można znaleźć pakietu o tej nazwie do zaktualizowania"
+#: ../client/pk-console.c:836
+msgid "Could not find package to update"
+msgstr "Nie można znaleźć pakietu do zaktualizowania"
 
-#: ../client/pk-console.c:905
-msgid "Could not find what packages require this package"
-msgstr "Nie można znaleźć pakietów, które wymagają tego pakietu"
+#: ../client/pk-console.c:858
+msgid "Could not find what packages require"
+msgstr "Nie można znaleźć pakietów, które wymagają"
 
-#: ../client/pk-console.c:926
-msgid "Could not get dependencies for this package"
-msgstr "Nie można uzyskać zależności tego pakietu"
+#: ../client/pk-console.c:879
+msgid "Could not get dependencies for"
+msgstr "Nie można uzyskać zależności dla"
 
-#: ../client/pk-console.c:947
-msgid "Could not find details for this package"
-msgstr "Nie można znaleźć szczegółów tego pakietu"
+#: ../client/pk-console.c:900
+msgid "Could not find details for"
+msgstr "Nie można znaleźć szczegółów dla"
 
-#: ../client/pk-console.c:968
+#: ../client/pk-console.c:923
 msgid "Could not find the files for this package"
 msgstr "Nie można znaleźć plików tego pakietu"
 
-#: ../client/pk-console.c:1050
+#: ../client/pk-console.c:930
+msgid "Could not get the file list"
+msgstr "Nie można uzyskać listy plików"
+
+#: ../client/pk-console.c:949
+msgid "Could not find the update details for"
+msgstr "Nie można znaleźć szczegółów aktualizacji dla"
+
+#: ../client/pk-console.c:1010
 msgid "Package description"
 msgstr "Opis pakietu"
 
-#: ../client/pk-console.c:1073
+#: ../client/pk-console.c:1033
 msgid "Package files"
 msgstr "Pliki pakietu"
 
-#: ../client/pk-console.c:1081
+#: ../client/pk-console.c:1041
 msgid "No files"
 msgstr "Brak plików"
 
 #. get user input
-#: ../client/pk-console.c:1113
+#: ../client/pk-console.c:1073
 msgid "Okay to import key?"
 msgstr "Zaimportować klucz?"
 
-#: ../client/pk-console.c:1116
+#: ../client/pk-console.c:1076
 msgid "Did not import key"
 msgstr "Nie zaimportowano klucza"
 
 #. get user input
-#: ../client/pk-console.c:1156
+#: ../client/pk-console.c:1116
 msgid "Do you agree?"
 msgstr "Zgadzasz siÄ™?"
 
-#: ../client/pk-console.c:1159
+#: ../client/pk-console.c:1119
 msgid "Did not agree to licence, task will fail"
 msgstr "Nie zaakceptowano licencji, zadanie nie powiedzie siÄ™"
 
-#: ../client/pk-console.c:1188
+#: ../client/pk-console.c:1148
 msgid "The daemon crashed mid-transaction!"
 msgstr "Demon zawiesił się w połowie transakcji!"
 
 #. header
-#: ../client/pk-console.c:1241
+#: ../client/pk-console.c:1201
 msgid "PackageKit Console Interface"
 msgstr "Interfejs konsoli PackageKit"
 
-#: ../client/pk-console.c:1241
+#: ../client/pk-console.c:1201
 msgid "Subcommands:"
 msgstr "Podpolecenia:"
 
-#: ../client/pk-console.c:1349 ../client/pk-monitor.c:104 ../src/pk-main.c:189
+#: ../client/pk-console.c:1309 ../client/pk-generate-pack.c:420
+#: ../client/pk-monitor.c:104 ../src/pk-main.c:189
 msgid "Show extra debugging information"
 msgstr "Wyświetla dodatkowe informacje o debugowaniu"
 
-#: ../client/pk-console.c:1351 ../client/pk-monitor.c:106
+#: ../client/pk-console.c:1311 ../client/pk-monitor.c:106
 msgid "Show the program version and exit"
 msgstr "Wyświetla wersję programu i wyłącza"
 
-#: ../client/pk-console.c:1353
+#: ../client/pk-console.c:1313
 msgid "Set the filter, e.g. installed"
 msgstr "Ustawia filtr, np. zainstalowane"
 
-#: ../client/pk-console.c:1355
+#: ../client/pk-console.c:1315
 msgid "Exit without waiting for actions to complete"
 msgstr "Wyłącza bez oczekiwania na zakończenie działań"
 
-#: ../client/pk-console.c:1378
+#: ../client/pk-console.c:1338
 msgid "Could not connect to system DBUS."
 msgstr "Nie można połączyć się z systemowym D-Bus."
 
-#: ../client/pk-console.c:1472
-msgid "You need to specify a search type"
-msgstr "Należy podać typ wyszukiwania"
+#: ../client/pk-console.c:1432
+msgid "You need to specify a search type, e.g. name"
+msgstr "Należy podać typ wyszukiwania, np. po nazwie"
 
-#: ../client/pk-console.c:1477 ../client/pk-console.c:1484
-#: ../client/pk-console.c:1491 ../client/pk-console.c:1498
-#: ../client/pk-console.c:1604 ../client/pk-console.c:1611
-#: ../client/pk-console.c:1618 ../client/pk-console.c:1625
+#: ../client/pk-console.c:1437 ../client/pk-console.c:1444
+#: ../client/pk-console.c:1451 ../client/pk-console.c:1458
+#: ../client/pk-console.c:1564 ../client/pk-console.c:1571
+#: ../client/pk-console.c:1578 ../client/pk-console.c:1585
 msgid "You need to specify a search term"
 msgstr "Należy podać termin wyszukiwania"
 
-#: ../client/pk-console.c:1503
+#: ../client/pk-console.c:1463
 msgid "Invalid search type"
 msgstr "Nieprawidłowy typ wyszukiwania"
 
-#: ../client/pk-console.c:1508
+#: ../client/pk-console.c:1468
 msgid "You need to specify a package or file to install"
 msgstr "Należy podać pakiet lub plik do zainstalowania"
 
-#: ../client/pk-console.c:1515
+#: ../client/pk-console.c:1475
 msgid "You need to specify a type, key_id and package_id"
 msgstr "Należy podać typ, key_id i package_id"
 
-#: ../client/pk-console.c:1522
+#: ../client/pk-console.c:1482
 msgid "You need to specify a package to remove"
 msgstr "Należy podać pakiet do usunięcia"
 
-#: ../client/pk-console.c:1528
+#: ../client/pk-console.c:1488
 msgid ""
 "You need to specify the package to download and the destination directory"
 msgstr "Należy podać pakiet do pobrania i katalog docelowy"
 
-#: ../client/pk-console.c:1534
+#: ../client/pk-console.c:1494
 msgid "You need to specify a eula-id"
 msgstr "Należy podać eula-id"
 
-#: ../client/pk-console.c:1550
+#: ../client/pk-console.c:1510
 msgid "You need to specify a package name to resolve"
 msgstr "Należy podać nazwę pakietu do rozwiązania"
 
-#: ../client/pk-console.c:1559 ../client/pk-console.c:1566
+#: ../client/pk-console.c:1519 ../client/pk-console.c:1526
 msgid "You need to specify a repo name"
 msgstr "Należy podać nazwę repozytorium"
 
-#: ../client/pk-console.c:1573
+#: ../client/pk-console.c:1533
 msgid "You need to specify a repo name/parameter and value"
 msgstr "Należy podać nazwę/parametr repozytorium i wartość"
 
-#: ../client/pk-console.c:1586
+#: ../client/pk-console.c:1546
 msgid "You need to specify a time term"
 msgstr "Należy podać termin czasu"
 
-#: ../client/pk-console.c:1591
+#: ../client/pk-console.c:1551
 msgid "You need to specify a correct role"
 msgstr "Należy podać poprawną rolę"
 
-#: ../client/pk-console.c:1596
+#: ../client/pk-console.c:1556
 msgid "Failed to get last time"
 msgstr "Uzyskanie ostatniego czasu nie powiodło się"
 
-#: ../client/pk-console.c:1632
+#: ../client/pk-console.c:1592
 msgid "You need to specify a package to find the details for"
 msgstr "Należy podać pakiet do znalezienia szczegółów dla"
 
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1599
 msgid "You need to specify a package to find the files for"
 msgstr "Należy podać pakiet do znalezienia plików dla"
 
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1648
 #, c-format
 msgid "Option '%s' not supported"
 msgstr "Opcja \"%s\" nie jest obsługiwana"
 
-#: ../client/pk-console.c:1699
+#: ../client/pk-console.c:1661
+msgid "You don't have the necessary privileges for this operation"
+msgstr "Nie posiadasz niezbędnych uprawnień dla tej operacji"
+
+#: ../client/pk-console.c:1663
 msgid "Command failed"
 msgstr "Polecenie nie powiodło się"
 
-#: ../client/pk-console.c:1703
-msgid "You don't have the necessary privileges for this operation"
-msgstr "Nie posiadasz niezbędnych uprawnień dla tej operacji"
+#: ../client/pk-generate-pack.c:106
+msgid "Could not find a package match"
+msgstr "Nie można znaleźć pasującego pakietu"
+
+#. get user input
+#: ../client/pk-generate-pack.c:352
+msgid "Okay to download the additional packages"
+msgstr "Pobrać dodatkowe pakiety?"
+
+#: ../client/pk-generate-pack.c:422
+msgid ""
+"Set the path of the file with the list of packages/dependencies to be "
+"excluded"
+msgstr ""
+"Proszę ustawić ścieżkę pliku z listą pakietów/zależności do wykluczenia"
+
+#: ../client/pk-generate-pack.c:467
+msgid "You need to specify the pack name and packages to be packed\n"
+msgstr "Należy podać nazwę pakietu serwisowego i pakiety do zapakowania\n"
+
+#: ../client/pk-generate-pack.c:473
+msgid ""
+"Invalid name for the service pack, Specify a name with .pack extension\n"
+msgstr ""
+"Nieprawidłowa nazwa pakietu serwisowego. Proszę podać nazwę z rozszerzeniem ."
+"pack\n"
+
+#: ../client/pk-generate-pack.c:485
+msgid "A pack with the same name already exists, do you want to overwrite it?"
+msgstr "Pakiet serwisowy o tej samej nazwie już istnieje, zastąpić go?"
+
+#: ../client/pk-generate-pack.c:498
+msgid "Failed to create directory"
+msgstr "Utworzenie katalogu nie powiodło się"
+
+#: ../client/pk-generate-pack.c:505
+msgid "Failed to create pack"
+msgstr "Utworzenie pakietu serwisowego nie powiodło się"
 
 #: ../client/pk-import-desktop.c:279 ../client/pk-import-specspo.c:177
 #, c-format
@@ -253,10 +289,105 @@ msgstr "Prawdopodobnie należy uruchomić ten program jako użytkownik root"
 msgid "PackageKit Monitor"
 msgstr "Monitor PackageKit"
 
+#: ../client/pk-tools-common.c:51
+#, c-format
+msgid "Please enter a number from 1 to %i: "
+msgstr "Proszę podać numer od 1 do %i: "
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:300
+msgid "Getting package information..."
+msgstr "Uzyskiwanie informacji o pakiecie..."
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:304
+#, c-format
+msgid "<span color='#%06x' underline='single' size='larger'>Run %s</span>"
+msgstr "<span color='#%06x' underline='single' size='larger'>Uruchom %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:308
+#: ../contrib/packagekit-plugin/src/contents.cpp:313
+#: ../contrib/packagekit-plugin/src/contents.cpp:336
+#: ../contrib/packagekit-plugin/src/contents.cpp:340
+#, c-format
+msgid "<big>%s</big>"
+msgstr "<big>%s</big>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:310
+#, c-format
+msgid ""
+"\n"
+"<small>Installed version: %s</small>"
+msgstr ""
+"\n"
+"<small>Zainstalowana wersja: %s</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:316
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run version %s now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Uruchom teraz wersjÄ™ %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:321
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Uruchom teraz</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:325
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Upgrade to version %s</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Zaktualizuj do wersji %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:330
+#, c-format
+msgid ""
+"<span color='#%06x' underline='single' size='larger'>Install %s Now</span>"
+msgstr ""
+"<span color='#%06x' underline='single' size='larger'>Zainstaluj teraz %s</"
+"span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:333
+#, c-format
+msgid ""
+"\n"
+"<small>Version: %s</small>"
+msgstr ""
+"\n"
+"<small>Wersja: %s</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:337
+msgid ""
+"\n"
+"<small>No packages found for your system</small>"
+msgstr ""
+"\n"
+"<small>Nie znaleziono pakietów dla systemu</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:341
+msgid ""
+"\n"
+"<small>Installing...</small>"
+msgstr ""
+"\n"
+"<small>Instalowanie...</small>"
+
 #: ../data/packagekit-catalog.xml.in.h:1
 msgid "PackageKit Catalog"
 msgstr "Katalog PackageKit"
 
+#: ../data/packagekit-pack.xml.in.h:1
+msgid "PackageKit Service Pack"
+msgstr "Pakiet serwisowy PackageKit"
+
 #: ../src/pk-main.c:83
 msgid "Startup failed due to security policies on this machine."
 msgstr ""
commit b6caccefbf716ea55f54d1440f29261da62b6f73
Author: Aidan Skinner <aidan at skinner.me.uk>
Date:   Sat Aug 9 16:05:06 2008 +0100

    Wrap dbus calls so that they attempt to obtain the right privilages with they fail to auth.

diff --git a/python/packagekitwrapper.py b/python/packagekitwrapper.py
index 4893736..f333a41 100644
--- a/python/packagekitwrapper.py
+++ b/python/packagekitwrapper.py
@@ -53,7 +53,7 @@ class PackageKitClient:
         for cb in callbacks.keys():
             pk_xn.connect_to_signal(cb, callbacks[cb])
 
-        method()
+        polkit_auth_wrapper(method)
         self._wait()
         if self._error_enum:
             raise PackageKitError(self._error_enum)
@@ -171,7 +171,6 @@ class PackageKitClient:
 
         On failure this throws a PackageKitError or a DBusException.
         '''
-        self._auth()
         self._InstRemovePackages(package_ids, progress_cb, True, None, None)
 
     def RemovePackages(self, package_ids, progress_cb=None, allow_deps=False,
@@ -246,7 +245,6 @@ class PackageKitClient:
         It should only return the newest update for each installed package.
         '''
         xn = self._get_xn()
-        self._auth()
         self._wrapPackageCall(xn, lambda : xn.UpdateSystem())
 
 
@@ -344,6 +342,36 @@ class PackageKitClient:
         return dbus.Interface(self.bus.get_object('org.freedesktop.PackageKit',
             tid, False), 'org.freedesktop.PackageKit.Transaction')
 
+#### PolicyKit authentication borrowed wrapper ##
+class PermissionDeniedByPolicy(dbus.DBusException):
+    _dbus_error_name = 'org.freedesktop.PackageKit.PermissionDeniedByPolicy'
+
+
+def polkit_auth_wrapper(fn, *args, **kwargs):
+    '''Function call wrapper for PolicyKit authentication.
+
+    Call fn(*args, **kwargs). If it fails with a PermissionDeniedByPolicy
+    and the caller can authenticate to get the missing privilege, the PolicyKit
+    authentication agent is called, and the function call is attempted again.
+    '''
+    try:
+        return fn(*args, **kwargs)
+    except dbus.DBusException, e:
+        if e._dbus_error_name == PermissionDeniedByPolicy._dbus_error_name:
+            # last words in message are privilege and auth result
+            (priv, auth_result) = e.message.split()[-2:]
+            if auth_result.startswith('auth_'):
+                pk_auth = dbus.Interface(dbus.SessionBus().get_object(
+                    'org.freedesktop.PolicyKit.AuthenticationAgent', '/', False),
+                    'org.freedesktop.PolicyKit.AuthenticationAgent')
+                # TODO: provide xid
+                res = pk_auth.ObtainAuthorization(priv, dbus.UInt32(0),
+                    dbus.UInt32(os.getpid()), timeout=300)
+                if res:
+                    return fn(*args, **kwargs)
+            raise PermissionDeniedByPolicy(priv + ' ' + auth_result)
+        else:
+            raise
 
 #
 # Test code
commit 6943e0b1f7dd8283ae06b24c6a7ec5bad9428da8
Author: Aidan Skinner <aidan at skinner.me.uk>
Date:   Sat Aug 9 15:51:54 2008 +0100

    Format python synchronous API for 80 columns

diff --git a/python/packagekitwrapper.py b/python/packagekitwrapper.py
index 7e23dad..4893736 100644
--- a/python/packagekitwrapper.py
+++ b/python/packagekitwrapper.py
@@ -64,44 +64,50 @@ class PackageKitClient:
 
     def _wrapPackageCall(self, pk_xn, method):
         '''
-        Wraps a call which emits Finished, ErrorCode on completion and Package for information
-        returns a list of dicts with 'installed', 'id' and 'summary' keys
+        Wraps a call which emits Finished, ErrorCode on completion and
+        Package for information returns a list of dicts with
+        'installed', 'id' and 'summary' keys
         '''
 
         result = []
-        package_cb = lambda i, id, summary: result.append({'installed' : (i == 'installed'),
-                                                           'id': (str(id)),
-                                                           'summary' : str(summary)
-                                                           }
-                                                          )
+        package_cb = lambda i, id, summary: result.append(
+            {'installed' : (i == 'installed'),
+             'id': (str(id)),
+             'summary' : str(summary)
+             })
         self._wrapCall(pk_xn, method, {'Package' : package_cb})
         return result
 
     def _wrapDetailsCall(self, pk_xn, method):
         '''
-        Wraps a call which emits Finished, ErrorCode on completion and Details for information
-        returns a list of dicts with 'id', 'license', 'group', 'description', 'upstream_url', 'size'.keys
+        Wraps a call which emits Finished, ErrorCode on completion and
+        Details for information returns a list of dicts with 'id',
+        'license', 'group', 'description', 'upstream_url', 'size'.keys
         '''
         result = []
-        details_cb = lambda id, license, group, detail, url, size: result.append({"id" : str(id),
-                                                                                  "license" : str(license),
-                                                                                  "group" : str(group),
-                                                                                  "detail" : str(detail),
-                                                                                  "url" : str(url),
-                                                                                  "size" : int(size)}
-                                                                                 )
+        details_cb = lambda id, license, group, detail, url, size: result.append
+        ({"id" : str(id),
+          "license" : str(license),
+          "group" : str(group),
+          "detail" : str(detail),
+          "url" : str(url),
+          "size" : int(size)
+          })
+
         self._wrapCall(pk_xn, method, {'Details' : details_cb})
         return result
 
     def _wrapReposCall(self, pk_xn, method):
         '''
-        Wraps a call which emits Finished, ErrorCode and RepoDetail for information
-        returns a list of dicts with 'id', 'description', 'enabled' keys
+        Wraps a call which emits Finished, ErrorCode and RepoDetail
+        for information returns a list of dicts with 'id',
+        'description', 'enabled' keys
         '''
         result = []
-        repo_cb = lambda id, description, enabled: result.append({'id' : str(id),
-                                                                  'desc' : str(description),
-                                                                  'enabled' : enabled})
+        repo_cb = lambda id, description, enabled: result.append
+        ({'id' : str(id),
+          'desc' : str(description),
+          'enabled' : enabled})
         self._wrapCall(pk_xn, method, {'RepoDetail' : repo_cb})
         return result
 
@@ -116,22 +122,25 @@ class PackageKitClient:
             pass
 
     def Resolve(self, filter, package):
-        '''Resolve a package name to a PackageKit package_id.
-
-        filter and package are directly passed to the PackageKit transaction D-BUS
-        method Resolve()
+        '''
+        Resolve a package name to a PackageKit package_id filter and
+        package are directly passed to the PackageKit transaction
+        D-BUS method Resolve()
 
-        Return Dict with keys of (installed, id, short_description) for all matches,
-        where installed is a boolean and id and short_description are strings.
+        Return Dict with keys of (installed, id, short_description)
+        for all matches, where installed is a boolean and id and
+        short_description are strings.
         '''
         xn = self._get_xn()
         return self._wrapPackageCall(xn, lambda : xn.Resolve(filter, package))
 
 
     def GetDetails(self, package_id):
-        '''Get details about a PackageKit package_id.
+        '''
+        Get details about a PackageKit package_id.
 
-        Return dict with keys (id, license, group, description, upstream_url, size).
+        Return dict with keys (id, license, group, description,
+        upstream_url, size).
         '''
         xn = self._get_xn()
         return self._wrapDetailsCall(xn, lambda : xn.GetDetails(package_id))
@@ -148,7 +157,8 @@ class PackageKitClient:
         Search a packages details.
         '''
         xn = self._get_xn()
-        return self._wrapPackageCall(xn, lambda : xn.SearchDetails(filter, name))
+        return self._wrapPackageCall(xn,
+                                     lambda : xn.SearchDetails(filter, name))
 
 
     def InstallPackages(self, package_ids, progress_cb=None):
@@ -161,6 +171,7 @@ class PackageKitClient:
 
         On failure this throws a PackageKitError or a DBusException.
         '''
+        self._auth()
         self._InstRemovePackages(package_ids, progress_cb, True, None, None)
 
     def RemovePackages(self, package_ids, progress_cb=None, allow_deps=False,
@@ -217,7 +228,8 @@ class PackageKitClient:
 
     def GetUpdates(self, filter=None):
         '''
-        This method should return a list of packages that are installed and are upgradable.
+        This method should return a list of packages that are installed and
+        are upgradable.
 
         It should only return the newest update for each installed package.
         '''
@@ -228,11 +240,13 @@ class PackageKitClient:
 
     def UpdateSystem(self):
         '''
-        This method should return a list of packages that are installed and are upgradable.
+        This method should return a list of packages that are
+        installed and are upgradable.
 
         It should only return the newest update for each installed package.
         '''
         xn = self._get_xn()
+        self._auth()
         self._wrapPackageCall(xn, lambda : xn.UpdateSystem())
 
 
@@ -273,6 +287,16 @@ class PackageKitClient:
             # directly, so delay it a bit
             gobject.timeout_add(10, _cancel, pk_xn)
 
+    def _auth(self):
+        policykit = self.bus.get_object(
+            'org.freedesktop.PolicyKit.AuthenticationAgent', '/',
+            'org.freedesktop.PolicyKit.AuthenticationAgent')
+        if(policykit == None):
+           print("Error: Could not get PolicyKit D-Bus Interface\n")
+        granted = policykit.ObtainAuthorization("org.freedesktop.packagekit.update-system",
+                                                (dbus.UInt32)(xid),
+                                                (dbus.UInt32)(os.getpid()))
+
     def _InstRemovePackages(self, package_ids, progress_cb, install,
         allow_deps, auto_remove):
         '''Shared implementation of InstallPackages and RemovePackages.'''
@@ -310,7 +334,8 @@ class PackageKitClient:
                 e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown'):
                 # first initialization (lazy) or timeout
                 self.pk_control = dbus.Interface(self.bus.get_object(
-                    'org.freedesktop.PackageKit', '/org/freedesktop/PackageKit',
+                        'org.freedesktop.PackageKit',
+                        '/org/freedesktop/PackageKit',
                     False), 'org.freedesktop.PackageKit')
                 tid = self.pk_control.GetTid()
             else:
commit b4da451504d239b40d9f0726efc20d0c1b20900c
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Sat Aug 9 01:05:25 2008 +0200

    APT: Add a skeleton for UpdateDetail

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 7194b5a..90fb306 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -291,6 +291,41 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.Finished(EXIT_SUCCESS)
 
     @threaded
+    def doGetUpdateDetails(self, pkg_ids):
+        '''
+        Implement the {backend}-get-update-details functionality
+        '''
+        pklog.info("Get update details of %s" % pkg_ids)
+        self.StatusChanged(STATUS_INFO)
+        self.NoPercentageUpdates()
+        self.AllowCancel(True)
+        self._check_init(progress=False)
+        for pkg_id in pkg_ids:
+            if self._is_canceled(): return
+            pkg = self._find_package_by_id(pkg_id)
+            if pkg == None:
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "Package %s isn't available" % name)
+                self.Finished(EXIT_FAILED)
+                return
+            # FIXME add some real data
+            updates = pkg_id
+            obsoletes = ""
+            vendor_url = ""
+            bugzilla_url = ""
+            cvs_url = ""
+            restart = ""
+            update_text = ""
+            changelog = ""
+            state = ""
+            issued = ""
+            updated = ""
+            self.UpdateDetail(pkg_id, updates, obsoletes, vendor_url,
+                              bugzilla_url, cvs_url, restart, update_text,
+                              changelog, state, issued, updated)
+        self.Finished(EXIT_SUCCESS)
+
+    @threaded
     def doGetDetails(self, pkg_ids):
         '''
         Implement the {backend}-get-details functionality
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 32ec527..4423d3f 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -141,6 +141,15 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
 }
 
 /**
+ * backend_get_update_detail:
+ *  */
+static void
+backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+{
+	pk_backend_dbus_get_update_detail (dbus, package_ids);
+}
+
+/**
  *  * pk_backend_search_details:
  *   */
 static void
@@ -202,7 +211,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_packages,			/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
-	NULL,					/* get_update_detail */
+	backend_get_update_detail,		/* get_update_detail */
 	backend_get_updates,			/* get_updates */
 	NULL,					/* install_files */
 	backend_install_packages,		/* install_packages */
commit f518415b61055a63d6a7c39ebafda8fcf6ca93b3
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Sat Aug 9 00:50:30 2008 +0200

    APT: trivial. reuse _find_package_by_id in doGetDetails

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 9701a70..7194b5a 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -302,13 +302,12 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self._check_init(progress=False)
         for pkg_id in pkg_ids:
             if self._is_canceled(): return
-            name, version, arch, data = self.get_package_from_id(pkg_id)
-            if not self._cache.has_key(name):
+            pkg = self._find_package_by_id(pkg_id)
+            if pkg == None:
                 self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
                                "Package %s isn't available" % name)
                 self.Finished(EXIT_FAILED)
                 return
-            pkg = self._cache[name]
             #FIXME: should perhaps go to python-apt since we need this in
             #       several applications
             desc = pkg.description
commit bb43a08d75edd86c1e72bccf4c50c3d0a6dbdd4d
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Fri Aug 8 22:41:14 2008 +0200

    APT: trivial remove a debugging statement

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index d2b5474..9701a70 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -302,8 +302,6 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self._check_init(progress=False)
         for pkg_id in pkg_ids:
             if self._is_canceled(): return
-            import pdb
-            pdb.set_trace()
             name, version, arch, data = self.get_package_from_id(pkg_id)
             if not self._cache.has_key(name):
                 self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
commit 9c7fc612b892f67df8b1ec02446380a3506ba7f0
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Fri Aug 8 22:39:51 2008 +0200

    APT: Do not implement GetDetails but doGetDetails in the apt backend. Allow to get details of several package ids.

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 23765a4..d2b5474 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -291,42 +291,46 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         self.Finished(EXIT_SUCCESS)
 
     @threaded
-    def GetDetails(self, pkg_id):
+    def doGetDetails(self, pkg_ids):
         '''
         Implement the {backend}-get-details functionality
         '''
-        pklog.info("Get details of %s" % pkg_id)
+        pklog.info("Get details of %s" % pkg_ids)
         self.StatusChanged(STATUS_INFO)
         self.NoPercentageUpdates()
-        self.AllowCancel(False)
+        self.AllowCancel(True)
         self._check_init(progress=False)
-        name, version, arch, data = self.get_package_from_id(pkg_id)
-        if not self._cache.has_key(name):
-            self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
-                           "Package %s isn't available" % name)
-            self.Finished(EXIT_FAILED)
-            return
-        pkg = self._cache[name]
-        #FIXME: should perhaps go to python-apt since we need this in
-        #       several applications
-        desc = pkg.description
-        # Skip the first line - it's a duplicate of the summary
-        i = desc.find('\n')
-        desc = desc[i+1:]
-        # do some regular expression magic on the description
-        # Add a newline before each bullet
-        p = re.compile(r'^(\s|\t)*(\*|0|-)',re.MULTILINE)
-        desc = p.sub(ur'\n\u2022', desc)
-        # replace all newlines by spaces
-        p = re.compile(r'\n', re.MULTILINE)
-        desc = p.sub(" ", desc)
-        # replace all multiple spaces by newlines
-        p = re.compile(r'\s\s+', re.MULTILINE)
-        desc = p.sub('\n', desc)
-        #FIXME: group and licence information missing
-        self.Details(pkg_id, 'unknown', 'unknown', desc,
+        for pkg_id in pkg_ids:
+            if self._is_canceled(): return
+            import pdb
+            pdb.set_trace()
+            name, version, arch, data = self.get_package_from_id(pkg_id)
+            if not self._cache.has_key(name):
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "Package %s isn't available" % name)
+                self.Finished(EXIT_FAILED)
+                return
+            pkg = self._cache[name]
+            #FIXME: should perhaps go to python-apt since we need this in
+            #       several applications
+            desc = pkg.description
+            # Skip the first line - it's a duplicate of the summary
+            i = desc.find('\n')
+            desc = desc[i+1:]
+            # do some regular expression magic on the description
+            # Add a newline before each bullet
+            p = re.compile(r'^(\s|\t)*(\*|0|-)',re.MULTILINE)
+            desc = p.sub(ur'\n\u2022', desc)
+            # replace all newlines by spaces
+            p = re.compile(r'\n', re.MULTILINE)
+            desc = p.sub(" ", desc)
+            # replace all multiple spaces by newlines
+            p = re.compile(r'\s\s+', re.MULTILINE)
+            desc = p.sub('\n', desc)
+            #FIXME: group and licence information missing
+            self.Details(pkg_id, 'unknown', 'unknown', desc,
                          pkg.homepage, pkg.packageSize)
-        self.Finished(EXIT_SUCCESS)
+            self.Finished(EXIT_SUCCESS)
 
     @threaded
     @async
@@ -571,6 +575,20 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         pklog.debug("Locking cache")
         self._locked.acquire()
 
+    def _is_canceled(self):
+        '''
+        Check if the current action was canceled. If so send the corresponding
+        error code.
+        '''
+        if self._canceled.isSet():
+            self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
+                           "The search was canceled")
+            self.Finished(EXIT_KILL)
+            self._canceled.clear()
+            return True
+        else:
+            return False
+ 
     def _unlock_cache(self):
         '''
         Unlock the cache
commit 5b1a42f5bb3b23a336c2df27b26cc590ceae3a7b
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Fri Aug 8 22:38:30 2008 +0200

    Python DBus backend: trivial fix a typo in the last commit. Rename the variable package ot package_ids in another place too.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 95c1571..f7beed3 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -533,14 +533,14 @@ class PackageKitBaseBackend(dbus.service.Object):
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='ssb',out_signature='')
-    def GetDepends(self,filters,package,recursive):
+    def GetDepends(self,filters,package_ids,recursive):
         '''
         Print a list of depends for a given package
         '''
-        pklog.info("GetDepends(%s,%s,%s)" % (filters,package,recursive))
-        self.doGetDepends(package,recursive)
+        pklog.info("GetDepends(%s,%s,%s)" % (filters,package_ids,recursive))
+        self.doGetDepends(package_ids,recursive)
 
-    def doGetDepends(self,package,recursive):
+    def doGetDepends(self,package_ids,recursive):
         '''
         Should be replaced in the corresponding backend sub class
         '''
@@ -693,7 +693,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         Print a detailed details for a given package
         '''
         pklog.info("GetDetails(%s)" % package_ids)
-        self.doGetDetails(package)
+        self.doGetDetails(package_ids)
 
     def doGetDetails(self,package_ids):
         '''
commit 466fa15fc0f79511ff0fd4fd9a2bbab3d7cfe6b1
Author: Michael Vogt <mvo at ubuntu.com>
Date:   Fri Aug 8 14:46:16 2008 +0200

    * backends/apt/aptDBUSBackend.py:
      - improve the InstallProgress() code of the apt backend,
        it will now kill hanging maintainer scripts after 10minutes
      - send a backend.Message() up when modified maintainer scripts
        are found
      - implement the missing doUpdatePackages() method

diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 23765a4..b838df6 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -121,19 +121,23 @@ class PackageKitFetchProgress(apt.progress.FetchProgress):
         #FIXME: use the Message method to notify the user
         self._backend.error(ERROR_UNKNOWN,
                             "Medium change needed")
-
 class PackageKitInstallProgress(apt.progress.InstallProgress):
     '''
     Handle the installation and removal process. Bits taken from
     DistUpgradeViewNonInteractive.
     '''
+
+    # a insanly long timeout to be able to kill hanging maintainer
+    # scripts
+    TIMEOUT = 10*60
+
     def __init__(self, backend, prange=(0,100)):
         apt.progress.InstallProgress.__init__(self)
         self._backend = backend
-        self.timeout = 900
         self.pstart = prange[0]
         self.pend = prange[1]
         self.pprev = None
+        self.conffile_prompts = set()
 
     def statusChange(self, pkg, percent, status):
         progress = self.pstart + percent/100 * (self.pend - self.pstart)
@@ -146,12 +150,33 @@ class PackageKitInstallProgress(apt.progress.InstallProgress):
         self._backend.StatusChanged(STATUS_INSTALL)
         self.last_activity = time.time()
 
+    def fork(self):
+        pklog.debug("fork()")
+        (pid, self.master_fd) = pty.fork()
+        return pid
+
     def updateInterface(self):
-        pklog.debug("Updating interface")
+        #pklog.debug("Updating interface")
         apt.progress.InstallProgress.updateInterface(self)
+        try:
+            pklog.debug("%s" % os.read(self.master_fd, 512))
+        except Exception, e:
+            pklog.debug("ioerror: %s" % e)
+        # we timed out, send ctrl-c
+        if self.last_activity + self.TIMEOUT < time.time():
+            pklog.critical("no activity for %s time sending ctrl-c" % self.TIMEOUT)
+            os.write(self.master_fd, 3)
 
     def conffile(self, current, new):
-        pklog.critical("Config file prompt: '%s'" % current)
+        pklog.warning("Config file prompt: '%s' (sending no)" % current)
+        i = os.write(self.master_fd, "n\n")
+        pklog.debug("wrote n, send %i bytes" % i)
+        self.conffile_prompts.add(new)
+    
+    def finishUpdate(self):
+        pklog.debug("finishUpdate()")
+        if self.conffile_prompts:
+            self._backend.Message(MESSAGE_NOTICE, "The following conffile prompts were found and need investiagtion: %s" % "\n".join(self.conffile_prompts))
 
 def sigquit(signum, frame):
     pklog.error("Was killed")
@@ -413,6 +438,59 @@ class PackageKitAptBackend(PackageKitBaseBackend):
 
     @threaded
     @async
+    def doUpdatePackages(self, ids):
+        '''
+        Implement the {backend}-update functionality
+        '''
+        pklog.info("Updating package with id %s" % ids)
+        self.StatusChanged(STATUS_INSTALL)
+        self.AllowCancel(False)
+        self.PercentageChanged(0)
+        self.StatusChanged(STATUS_RUNNING)
+        pkgs=[]
+        for id in ids:
+            pkg = self._find_package_by_id(id)
+            if pkg == None:
+                self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,
+                               "Package %s isn't available" % id)
+                self.Finished(EXIT_FAILED)
+                return
+            if not pkg.isUpgradable:
+                self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,
+                               "Package %s is already installed" % pkg.name)
+                self.Finished(EXIT_FAILED)
+                return
+            pkgs.append(pkg.name[:])
+            try:
+                pkg.markUpgrade()
+            except:
+                self._open_cache(prange=(90,100))
+                self.ErrorCode(ERROR_UNKNOWN, "%s could not be queued for "
+                                              "installation" % pkg.name)
+                self.Finished(EXIT_FAILED)
+                return
+        try:
+            self._cache.commit(PackageKitFetchProgress(self, prange=(10,50)),
+                               PackageKitInstallProgress(self, prange=(50,90)))
+        except Exception, e:
+            pklog.warning("exception %s during commit()" % e)
+            self._open_cache(prange=(90,100))
+            self.ErrorCode(ERROR_UNKNOWN, "Installation failed")
+            self.Finished(EXIT_FAILED)
+            return
+        self._open_cache(prange=(90,100))
+        self.PercentageChanged(100)
+        pklog.debug("Checking success of operation")
+        for p in pkgs:
+            if not self._cache.has_key(p) or not self._cache[p].isInstalled:
+                self.ErrorCode(ERROR_UNKNOWN, "%s was not installed" % p)
+                self.Finished(EXIT_FAILED)
+                return
+        pklog.debug("Sending success signal")
+        self.Finished(EXIT_SUCCESS)
+
+    @threaded
+    @async
     def doInstallPackages(self, ids):
         '''
         Implement the {backend}-install functionality
@@ -447,7 +525,8 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         try:
             self._cache.commit(PackageKitFetchProgress(self, prange=(10,50)),
                                PackageKitInstallProgress(self, prange=(50,90)))
-        except:
+        except Exception, e:
+            pklog.warning("exception %s during commit()" % e)
             self._open_cache(prange=(90,100))
             self.ErrorCode(ERROR_UNKNOWN, "Installation failed")
             self.Finished(EXIT_FAILED)
commit 719eeb884ac193cdc6813c61eb5fa324159c09d4
Author: Sebastian Heinlein <devel at glatzor.de>
Date:   Fri Aug 8 13:13:48 2008 +0200

    Fix new API which allow several package ids in the dbus python backend.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index a148312..95c1571 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -503,7 +503,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Print a list of requires for a given package
         '''
-        pklog.info("GetRequires(%s,%s,%s)" % (filters,package,recursive))
+        pklog.info("GetRequires(%s,%s,%s)" % (filters,package_ids,recursive))
         self.doGetRequires(filters,package,recursive)
 
     def doGetRequires(self,filters,package,recursive):
@@ -605,8 +605,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Implement the {backend}-install functionality
         '''
-        pklog.info("InstallPackages(%s)" % ",".join(packages))
-        self.doInstallPackages(packages)
+        pklog.info("InstallPackages(%s)" % package_ids)
+        self.doInstallPackages(package_ids)
 
     def doInstallPackages(self,package_ids):
         '''
@@ -657,8 +657,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Implement the {backend}-update-packages functionality
         '''
-        pklog.info("UpdatePackages(%s)" % ",".join(packages))
-        self.doUpdatePackages(packages)
+        pklog.info("UpdatePackages(%s)" % package_ids)
+        self.doUpdatePackages(package_ids)
 
     def doUpdatePackages(self,package_ids):
         '''
@@ -674,9 +674,9 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Implement the {backend}-remove functionality
         '''
-        pklog.info("RemovePackages(%s,%s,%s)" % (packages,allowdep,
-                                                   autoremove))
-        self.doRemovePackages(packages,allowdep,autoremove)
+        pklog.info("RemovePackages(%s,%s,%s)" % (package_ids,allowdep,
+                                                 autoremove))
+        self.doRemovePackages(package_ids,allowdep,autoremove)
 
     def doRemovePackages(self,package_ids,allowdep,autoremove):
         '''
@@ -692,7 +692,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Print a detailed details for a given package
         '''
-        pklog.info("GetDetails(%s)" % package)
+        pklog.info("GetDetails(%s)" % package_ids)
         self.doGetDetails(package)
 
     def doGetDetails(self,package_ids):
@@ -709,8 +709,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Implement the get-files method
         '''
-        pklog.info("GetFiles(%s)" % package)
-        self.doGetFiles( package)
+        pklog.info("GetFiles(%s)" % package_ids)
+        self.doGetFiles(package_ids)
 
     def doGetFiles(self,package_ids):
         '''
@@ -777,8 +777,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         '''
         Implement the {backend}-get-update_detail functionality
         '''
-        pklog.info("GetUpdateDetail(%s)" % package)
-        self.doGetUpdateDetail(package)
+        pklog.info("GetUpdateDetail(%s)" % package_ids)
+        self.doGetUpdateDetail(package_ids)
 
     def doGetUpdateDetail(self,package_ids):
         '''
commit de436b6f76e40b4d6e16840ed8273130aeacd574
Author: Val L <onestep at onestep-box.luga.lan>
Date:   Fri Aug 8 11:53:32 2008 +0300

    changes in check for libtar.h

diff --git a/configure.ac b/configure.ac
index bdd1d02..d132365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ PKG_CHECK_MODULES(DBUS, \
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
-AC_CHECK_HEADERS([libtar.h])
+AC_CHECK_HEADERS(libtar.h, [AC_DEFINE(HAVE_LIBTAR_H)], [AC_MSG_ERROR([Can't find libtar.h. Please install libtar.])])
 TAR_LIBS=-ltar
 AC_SUBST(TAR_LIBS)
 


More information about the PackageKit-commit mailing list