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

Richard Hughes hughsient at kemper.freedesktop.org
Sun Nov 4 11:19:03 PST 2007


 .gitignore                            |    3 
 backends/alpm/pk-backend-alpm.c       |    8 +-
 backends/box/helpers/Makefile.am      |    1 
 backends/box/helpers/refresh-cache.sh |   12 ---
 backends/box/pk-backend-box.c         |   14 +++-
 backends/pisi/helpers/pisiBackend.py  |    8 +-
 backends/yum/helpers/yumBackend.py    |   45 ++++++------
 client/.gitignore                     |    3 
 docs/pk-introduction.xml              |  119 ++++++++++++++++++++++------------
 libgbus/.gitignore                    |    3 
 libpackagekit/.gitignore              |    4 +
 libpackagekit/pk-enum.c               |    5 +
 libpackagekit/pk-enum.h               |    5 +
 libpackagekit/pk-self-test.c          |    2 
 libselftest/.gitignore                |    4 +
 python/packagekit/backend.py          |    6 +
 src/.gitignore                        |    4 +
 src/pk-inhibit.c                      |    4 -
 tools/create-coverage-report.sh       |   90 +++++++++++++++++++++++++
 tools/yum-get-groups.sh               |    2 
 20 files changed, 254 insertions(+), 88 deletions(-)

New commits:
commit 7d95ae703ed266279abed17f1132ac2f110028ac
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 19:18:05 2007 +0000

    add gcov conversion script

diff --git a/tools/create-coverage-report.sh b/tools/create-coverage-report.sh
new file mode 100755
index 0000000..9fc2d55
--- /dev/null
+++ b/tools/create-coverage-report.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+TOTAL_ACTUAL=0
+TOTAL_COVERED=0
+TOTAL_SOURCE=0
+TOTAL_PERCENT=0
+NOT_TESTED=""
+
+MODULE=$1
+shift
+
+process ()
+{
+	if [ -e ".libs/packagekitd" ]; then
+		gcov $1 &> /dev/null
+	elif [ -e ".libs/libpackagekit.la" ]; then
+		gcov $1 -o .libs &> /dev/null
+	else
+		return
+	fi
+	if [ ! -e $1.gcov ]; then
+		NOT_TESTED="$1.gcov,$NOT_TESTED"
+		return
+	fi
+	SOURCE=`cat $1 |wc -l`
+	ACTUAL=`grep -v "        -:" $1.gcov  |wc -l`
+	NOT_COVERED=`grep "    #####:" $1.gcov  |wc -l`
+	COVERED=$(($ACTUAL - $NOT_COVERED))
+	if [ $ACTUAL -ne 0 ]; then
+		PERCENT=$((100 * $COVERED / $ACTUAL))
+	else
+		PERCENT=0
+	fi
+
+	TOTAL_SOURCE=$(($TOTAL_SOURCE + $SOURCE))
+	TOTAL_ACTUAL=$(($TOTAL_ACTUAL + $ACTUAL))
+	TOTAL_COVERED=$(($TOTAL_COVERED + $COVERED))
+
+	echo -n "$1"
+
+	n=${#1}
+	while [ $n -lt 55 ] ; do
+		echo -n " "
+		n=$(($n + 1))
+	done
+
+	echo -n " : "
+
+	if [ $PERCENT -lt 10 ] ; then
+		echo -n "  $PERCENT%"
+	elif [ $PERCENT -lt 100 ] ; then
+		echo -n " $PERCENT%"
+	else
+		echo -n "100%"
+	fi
+
+	echo " ($COVERED of $ACTUAL)"
+}
+
+echo "=============================================================================="
+echo "Test coverage for module $MODULE:"
+echo "=============================================================================="
+
+while [ $# -gt 0 ] ; do
+
+	case "$1" in
+	"pk-main.c"|"pk-marshal.c"|"pk-security-dummy.c"|"pk-backend-python.c")
+		#ignore these
+		;;
+	*)
+		process $1
+		;;
+	esac
+	shift
+done
+
+if [ $TOTAL_ACTUAL -ne 0 ]; then
+	TOTAL_PERCENT=$((100 * $TOTAL_COVERED / $TOTAL_ACTUAL))
+fi
+if [ -n "NOT_TESTED" ]; then
+	echo "NOT TESTED = $NOT_TESTED"
+fi
+
+echo
+echo "Source lines          : $TOTAL_SOURCE"
+echo "Actual statements     : $TOTAL_ACTUAL"
+echo "Executed statements   : $TOTAL_COVERED"
+echo "Test coverage         : $TOTAL_PERCENT%"
+echo
+
commit d990f5bf91ff8b90c487eb99c893f2c33b333ebd
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 18:31:33 2007 +0000

    use config.h in pk-self-test

diff --git a/libpackagekit/pk-self-test.c b/libpackagekit/pk-self-test.c
index e00455e..f55fd6c 100644
--- a/libpackagekit/pk-self-test.c
+++ b/libpackagekit/pk-self-test.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+
 #include <glib.h>
 #include <glib-object.h>
 #include <libselftest.h>
commit 7f4290026415cce266ef1171268a1e811e0ca3d8
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 18:30:40 2007 +0000

    add some extra gitignore entries for gcov

diff --git a/.gitignore b/.gitignore
index a911d1e..c36b60f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,4 +51,5 @@ py-compile
 tags
 *.patch
 NEWS.new
+coverage-report.txt
 
diff --git a/client/.gitignore b/client/.gitignore
index da99461..e0f363e 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -10,4 +10,7 @@ pk-application
 *.glade.bak
 *.gladep
 *.gladep.bak
+*.gcov
+*.gcda
+*.gcno
 
diff --git a/libgbus/.gitignore b/libgbus/.gitignore
index c25dd54..e9199c5 100644
--- a/libgbus/.gitignore
+++ b/libgbus/.gitignore
@@ -5,4 +5,7 @@
 *.lo
 *-marshal.c
 *-marshal.h
+*.gcov
+*.gcda
+*.gcno
 
diff --git a/libpackagekit/.gitignore b/libpackagekit/.gitignore
index be29c71..fede20f 100644
--- a/libpackagekit/.gitignore
+++ b/libpackagekit/.gitignore
@@ -7,4 +7,8 @@
 *-marshal.h
 pk-self-test
 *.loT
+*.gcov
+*.gcda
+*.gcno
+coverage-report.txt
 
diff --git a/libselftest/.gitignore b/libselftest/.gitignore
index c25dd54..c2f3774 100644
--- a/libselftest/.gitignore
+++ b/libselftest/.gitignore
@@ -5,4 +5,8 @@
 *.lo
 *-marshal.c
 *-marshal.h
+*.gcov
+*.gcda
+*.gcno
+coverage-report.txt
 
diff --git a/src/.gitignore b/src/.gitignore
index c2c4d8a..bfc46dd 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -7,4 +7,8 @@ pk-interface.h
 packagekitd
 pk-self-test
 debug.log
+*.gcov
+*.gcda
+*.gcno
+coverage-report.txt
 
commit c19b447049dc9fa4657f0d02ac9ef72895544132
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 17:14:52 2007 +0000

    fix config.h including

diff --git a/src/pk-inhibit.c b/src/pk-inhibit.c
index 317d204..dd3a05c 100644
--- a/src/pk-inhibit.c
+++ b/src/pk-inhibit.c
@@ -19,8 +19,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifdef HAVE_INHIBITIG_H
-#  include <inhibitig.h>
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #include <stdlib.h>
commit 8b3b4303e248d6f2da4811a62514cac334c6fbbe
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Sun Nov 4 13:33:23 2007 +0100

    yum : emit no-cache in resolve if the cache is invalid

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 94e9530..d5eacd0 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -665,27 +665,30 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         '''
         self.allow_interrupt(True);
         self.percentage(None)
-
+        self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
+        self.yumbase.conf.cache = 1 # Only look in cache.
+      
         fltlist = filters.split(';')
-
-        # Get installed packages
-        installedByKey = self.yumbase.rpmdb.searchNevra(name=name)
-        if FILTER_NON_INSTALLED not in fltlist:
-            for pkg in installedByKey:
-                self._show_package(pkg,INFO_INSTALLED)
-        # Get available packages
-        if FILTER_INSTALLED not in fltlist:
-            for pkg in self.yumbase.pkgSack.returnNewestByNameArch():
-                if pkg.name == name:
-                    show = True
-                    for instpo in installedByKey:
-                        # Check if package have a smaller & equal EVR to a inst pkg
-                        if pkg.EVR < instpo.EVR or pkg.EVR == instpo.EVR:
-                            show = False
-                    if show:
-                        self._show_package(pkg,INFO_AVAILABLE)
-                        break
-
+        try:
+            # Get installed packages
+            installedByKey = self.yumbase.rpmdb.searchNevra(name=name)
+            if FILTER_NON_INSTALLED not in fltlist:
+                for pkg in installedByKey:
+                    self._show_package(pkg,INFO_INSTALLED)
+            # Get available packages
+            if FILTER_INSTALLED not in fltlist:
+                for pkg in self.yumbase.pkgSack.returnNewestByNameArch():
+                    if pkg.name == name:
+                        show = True
+                        for instpo in installedByKey:
+                            # Check if package have a smaller & equal EVR to a inst pkg
+                            if pkg.EVR < instpo.EVR or pkg.EVR == instpo.EVR:
+                                show = False
+                        if show:
+                            self._show_package(pkg,INFO_AVAILABLE)
+                            break
+        except yum.Errors.RepoError,e:
+            self.error(ERROR_NO_CACHE,"Yum cache is invalid")
     def install(self, package):
         '''
         Implement the {backend}-install functionality
commit 2c892069cddb6fe35ef27b918f690b8dd783bae2
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 09:24:42 2007 +0000

    fix the tarball building

diff --git a/backends/box/helpers/Makefile.am b/backends/box/helpers/Makefile.am
index b9ae0d2..0e8bed1 100644
--- a/backends/box/helpers/Makefile.am
+++ b/backends/box/helpers/Makefile.am
@@ -6,7 +6,6 @@ NULL =
 dist_helper_DATA = 			\
 	install-file.sh			\
 	install-package.sh		\
-	refresh-cache.sh		\
 	update-package.sh		\
 	update-system.sh		\
 	$(NULL)
commit 517210a11f745fa3cfaab736c17d0a1f97e6307a
Merge: ea7f16d... f44115b...
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 09:12:53 2007 +0000

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

commit ea7f16d8957a2981bb7c0c9b666c9583c5ffe7af
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Nov 4 09:12:00 2007 +0000

    add some more error enums and use them in the backends

diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 88f7db7..933ca52 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -341,7 +341,7 @@ backend_destroy (PkBackend *backend)
 	g_return_if_fail (backend != NULL);
 	if (alpm_release () == -1)
 	  pk_backend_error_code (backend,
-				 PK_ERROR_ENUM_INTERNAL_ERROR,
+				 PK_ERROR_ENUM_FAILED_FINALISE,
 				 "Failed to release control");
 }
 
@@ -359,7 +359,7 @@ backend_initialize (PkBackend *backend)
 	if (alpm_initialize () == -1)
 	  {
 	    pk_backend_error_code (backend,
-				 PK_ERROR_ENUM_INTERNAL_ERROR,
+				 PK_ERROR_ENUM_FAILED_INITIALIZATION,
 				 "Failed to initialize package manager");
 	    pk_debug ("alpm: %s", alpm_strerror (pm_errno));
 	    //return;
@@ -368,7 +368,7 @@ backend_initialize (PkBackend *backend)
 	if (alpm_parse_config ("/etc/pacman.conf", NULL, "") != 0)
 	  {
 	    pk_backend_error_code (backend,
-				 PK_ERROR_ENUM_INTERNAL_ERROR,
+				 PK_ERROR_ENUM_CONFIG_PARSING,
 				 "Failed to parse config file");
 	    pk_debug ("alpm: %s", alpm_strerror (pm_errno));
 	    backend_destroy (backend);
@@ -379,7 +379,7 @@ backend_initialize (PkBackend *backend)
 	if (alpm_db_register ("local") == NULL)
 	  {
 	    pk_backend_error_code (backend,
-				 PK_ERROR_ENUM_INTERNAL_ERROR,
+				 PK_ERROR_ENUM_CONFIG_PARSING,
 				 "Failed to load local database");
 	    backend_destroy (backend);
 	    return;
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index a9341de..e6ad922 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -129,7 +129,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             status = INFO_AVAILABLE
             pkg = self.packagedb.get_package(package)
         else:
-            self.error(ERROR_INTERNAL_ERROR, "Package was not found")
+            self.error(ERROR_PACKAGE_NOT_FOUND, "Package was not found")
 
         if filters:
             if "none" not in filters:
@@ -183,7 +183,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
                             pkg.packageURI,
                             pkg.packageSize, "")
         else:
-            self.error(ERROR_INTERNAL_ERROR, "Package was not found")
+            self.error(ERROR_PACKAGE_NOT_FOUND, "Package was not found")
 
     def get_files(self, package_id):
         """ Prints a file list for a given package """
@@ -328,7 +328,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             except pisi.Error:
                 self.error(ERROR_REPO_NOT_FOUND, "Repository is not exists")
         else:
-            self.error(ERROR_INTERNAL_ERROR, "Parameter not supported")
+            self.error(ERROR_NOT_SUPPORTED, "Parameter not supported")
 
     def resolve(self, filters, package):
         """ Turns a single package name into a package_id suitable for the other methods """
@@ -368,7 +368,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
                     for pkg in self.componentdb.get_packages(key, walk = True):
                         self.__get_package(pkg, filters)
         except:
-            self.error(ERROR_INTERNAL_ERROR, "Component %s was not found" % group)
+            self.error(ERROR_GROUP_NOT_FOUND, "Component %s was not found" % group)
 
     def search_name(self, filters, package):
         """ Prints a list of packages contains search term in its name """
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 5f9cb04..94e9530 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -600,7 +600,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         if pkg:
             deps = self._get_best_dependencies(pkg)
         else:
-            self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+            self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
         for pkg in deps:
             if pkg.name != name:
                 pkgver = self._get_package_ver(pkg)
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index e543350..c0b2f01 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -94,14 +94,19 @@ static PkEnumMatch enum_error[] = {
 	{PK_ERROR_ENUM_PACKAGE_ID_INVALID,	"package-id-invalid"},
 	{PK_ERROR_ENUM_TRANSACTION_ERROR,	"transaction-error"},
 	{PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED,	"package-not-installed"},
+	{PK_ERROR_ENUM_PACKAGE_NOT_FOUND,	"package-not-found"},
 	{PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED,	"package-already-installed"},
 	{PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED,	"package-download-failed"},
+	{PK_ERROR_ENUM_GROUP_NOT_FOUND,		"group-not-found"},
 	{PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,	"dep-resolution-failed"},
 	{PK_ERROR_ENUM_CREATE_THREAD_FAILED,	"create-thread-failed"},
 	{PK_ERROR_ENUM_REPO_NOT_FOUND,		"repo-not-found"},
 	{PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,	"cannot-remove-system-package"},
 	{PK_ERROR_ENUM_PROCESS_QUIT,		"process-quit"},
 	{PK_ERROR_ENUM_PROCESS_KILL,		"process-kill"},
+	{PK_ERROR_ENUM_FAILED_INITIALIZATION,	"failed-initialization"},
+	{PK_ERROR_ENUM_FAILED_FINALISE,		"failed-finalise"},
+	{PK_ERROR_ENUM_FAILED_CONFIG_PARSING,	"failed-config-parsing"},
 	{0, NULL},
 };
 
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index c6efd17..4182da6 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -108,8 +108,10 @@ typedef enum {
 	PK_ERROR_ENUM_GPG_FAILURE,
 	PK_ERROR_ENUM_PACKAGE_ID_INVALID,
 	PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED,
+	PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
 	PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED,
 	PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED,
+	PK_ERROR_ENUM_GROUP_NOT_FOUND,
 	PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
 	PK_ERROR_ENUM_FILTER_INVALID,
 	PK_ERROR_ENUM_CREATE_THREAD_FAILED,
@@ -119,6 +121,9 @@ typedef enum {
 	PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
 	PK_ERROR_ENUM_PROCESS_QUIT,
 	PK_ERROR_ENUM_PROCESS_KILL,
+	PK_ERROR_ENUM_FAILED_INITIALIZATION,
+	PK_ERROR_ENUM_FAILED_FINALISE,
+	PK_ERROR_ENUM_FAILED_CONFIG_PARSING,
 	PK_ERROR_ENUM_UNKNOWN
 } PkErrorCodeEnum;
 
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index f1fdc87..574097b 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -34,18 +34,22 @@ ERROR_INTERNAL_ERROR = "internal-error"
 ERROR_GPG_FAILURE = "gpg-failure"
 ERROR_SIGNATURE_NOT_IMPORTED = "signature-not-imported"
 ERROR_PACKAGE_NOT_INSTALLED = "package-not-installed"
+ERROR_PACKAGE_NOT_FOUND = "package-not-found"
 ERROR_PACKAGE_ALREADY_INSTALLED = "package-already-installed"
 ERROR_PACKAGE_DOWNLOAD_FAILED = "package-download-failed"
+ERROR_GROUP_NOT_FOUND = "group-not-found"
 ERROR_DEP_RESOLUTION_FAILED = "dep-resolution-failed"
 ERROR_CREATE_THREAD_FAILED = "create-thread-failed"
 ERROR_FILTER_INVALID = "filter-invalid"
 ERROR_TRANSACTION_ERROR = "transaction-error"
-ERROR_TRANSACTION_ERROR = "transaction-error"
 ERROR_NO_CACHE = "no-cache"
 ERROR_REPO_NOT_FOUND = "repo-not-found"
 ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE = "cannot-remove-system-package"
 ERROR_PROCESS_QUIT="process-quit"
 ERROR_PROCESS_KILL="process-kill"
+ERROR_FAILED_INITIALIZATION="failed-initialization"
+ERROR_FAILED_FINALISE="failed-finalise"
+ERROR_FAILED_CONFIG_PARSING="failed-config-parsing"
 
 STATE_DOWNLOAD = "download"
 STATE_INSTALL = "install"
commit f44115b5f45388c310cd59ded0a094537460cbc7
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Sat Nov 3 20:25:29 2007 +0000

    [box] use C API with percent updates for cache refreshing instead of shell script

diff --git a/backends/box/helpers/refresh-cache.sh b/backends/box/helpers/refresh-cache.sh
deleted file mode 100644
index c236369..0000000
--- a/backends/box/helpers/refresh-cache.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2007 Grzegorz Dabrowski <gdx at o2.pl>
-#
-# 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.
-
-box --sync-repos
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index cfd554d..158e386 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -390,7 +390,7 @@ backend_get_depends_requires_thread (PkBackend *backend, gpointer data)
 }
 
 static void
-uninstall_progress(int value, gpointer user_data)
+common_progress(int value, gpointer user_data)
 {
 	PkBackend* backend = (PkBackend *) user_data;
 	pk_backend_change_percentage (backend, value);
@@ -410,7 +410,7 @@ backend_remove_package_thread (PkBackend *backend, gpointer data)
 		return FALSE;
 	}
 
-	if (!box_package_uninstall (pi->name, "/", uninstall_progress, backend))
+	if (!box_package_uninstall (pi->name, "/", common_progress, backend))
 	{
 		pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, "Cannot uninstall");
 	}
@@ -422,6 +422,14 @@ backend_remove_package_thread (PkBackend *backend, gpointer data)
 	return TRUE;
 }
 
+static gboolean
+backend_refresh_cache_thread (PkBackend *backend, gpointer data)
+{
+    	box_repos_sync(common_progress, backend);
+
+	return TRUE;
+}
+
 /* ===================================================================== */
 
 /**
@@ -585,7 +593,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
 		return;
 	}
 	pk_backend_change_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
-	pk_backend_spawn_helper (backend, "refresh-cache.sh", NULL);
+	pk_backend_thread_helper (backend, backend_refresh_cache_thread, NULL);
 }
 
 /**
commit 1a08841c605c79f3a692904a3771bde0b158a2a0
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Nov 3 12:05:45 2007 +0000

    add a note about case sensitivity

diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index 54aadf5..8253d76 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -616,6 +616,10 @@
         running the transaction.
       </para>
       <para>
+        The search query in the backend should not be case sensitive, and
+        should not be sensitive to <literal>_</literal> or <literal>-</literal>.
+      </para>
+      <para>
         This method typically emits
         <literal>Progress</literal>,
         <literal>Error</literal> and
commit eee47fb86d84215c250795a37a0ad1c53881bc99
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Nov 3 12:02:59 2007 +0000

    correct and add a few things to the developer docs

diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index 1a5058b..54aadf5 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -25,8 +25,8 @@
     </itemizedlist>
 
     <para>
-      PackageKit is a modular design with an asyncronous API for client programs,
-      a flexible queing module, and run-time selectable backends.
+      PackageKit is a modular design with an asynchronous API for client programs,
+      a flexible queuing module, and run-time selectable backends.
     </para>
 
     <mediaobject id="pk-structure">
@@ -39,27 +39,27 @@
   <sect1 id="introduction-backends">
     <title>Backends</title>
     <para>
-      The following sections explain what a backend is, and how it is implimented.
+      The following sections explain what a backend is, and how it is implemented.
     </para>
     <sect2 id="introduction-backends-overview">
       <title>Overview</title>
       <para>
         A backend is just a compiled <literal>.so</literal> object that is
-        loaded at runtime and provides an interface to the underlying package
+        loaded at run-time and provides an interface to the underlying package
         commands.
         A backend converts an async request into either a new thread which
         in the same process, or using external "glue" files that can be written
         in any language.
       </para>
       <para>
-        Please see the <literal>helpers/BACKENDS</literal> file for the current
+        Please see the <literal>html/pk-faq.html</literal> file for the current
         status of the existing backends.
         Backend maintainers, please keep this file updated.
       </para>
     </sect2>
 
     <sect2 id="introduction-backends-compiled-backends">
-      <title>Compiled backeds</title>
+      <title>Compiled backends</title>
       <para>
         If you have got a C or C++ binding for your package system then you can
         use a compiled backend, which is more efficient than using helpers as
@@ -72,7 +72,7 @@
       </para>
       <para>
         You will have to use threading if your backend does not support async
-        operation as requests have to return immediatly.
+        operation as requests have to return immediately.
         This is very important. Do any significant processing in a thread, and
         certainly don't return package results without creating a thread.
         By keeping the backends async we can make sure that there is no blocking
@@ -90,7 +90,8 @@
         This means a python library can be interfaced easily with a C backend.
       </para>
       <para>
-        Even when using helpers, a compiled backed is still used for two reasons:
+        Even when using helpers, a compiled backend stub is still used for
+        two reasons:
       </para>
       <itemizedlist>
         <listitem>
@@ -106,6 +107,11 @@
           </para>
         </listitem>
       </itemizedlist>
+      <para>
+        Boilerplate code for common backends can be found in
+        <literal>src/pk-backend-language.[c|h]</literal> which eliminates copy
+        and paste in the compiled part of the backend.
+      </para>
     </sect2>
   </sect1>
 
@@ -121,7 +127,7 @@
         This is the <literal>name;version;arch;data</literal> in
         a single string and is meant to represent a single package.
         This is important when multiple versions of a package are installed and
-        only one is removed.
+        only the correct one is removed.
       </para>
       <para>
         The <literal>package_id</literal> is parsed and checked carefully in
@@ -134,7 +140,13 @@
         It is designed to make the life of a backend writer a little bit easier.
       </para>
       <para>
-        The backend must ensure that it only matches on one single package.
+        The data field for an installed package must be
+        <literal>installed</literal> as this is used to identify which packages
+        are installable or installed in the client tools.
+      </para>
+      <para>
+        The backend must ensure that the package_id only matches on one
+        single package.
         A single package_id must be enough to uniquely identify a single object
         in any repository used on the system.
       </para>
@@ -203,7 +215,7 @@
             </row>
             <row>
               <entry><literal>gui;~installed;~devel</literal></entry>
-              <entry>All non-installed, non-devel gui programs.</entry>
+              <entry>All non-installed, non-devel gui programs</entry>
             </row>
           </tbody>
         </tgroup>
@@ -226,8 +238,8 @@
         locale.
         The error description should be descriptive, as it's for power users
         and people trying to debug the problem.
-        For instance, "Out of memory" is not helpful as an error description,
-        but "Could not create database index" is.
+        For instance, "Out of memory" is not helpful as an error description
+        that is reported in a bugzilla, but "Could not create database index" is.
         For the description use <literal>;</literal> to separate the lines if
         required.
       </para>
@@ -250,7 +262,7 @@
             </row>
             <row>
               <entry><literal>no-network</literal></entry>
-              <entry>There is no network connection</entry>
+              <entry>There is no network connection that can be used</entry>
             </row>
             <row>
               <entry><literal>not-supported</literal></entry>
@@ -287,7 +299,7 @@
               <entry><literal>no-cache</literal></entry>
               <entry>
                 The operation is trying to read from the cache, but the cache
-                is not present or invalid.
+                is not present or invalid
               </entry>
             </row>
             <row>
@@ -303,7 +315,7 @@
             </row>
             <row>
               <entry><literal>dep-resolution-failed</literal></entry>
-              <entry>Dependancy resolution failed</entry>
+              <entry>Dependency resolution failed</entry>
             </row>
             <row>
               <entry><literal>filter-invalid</literal></entry>
@@ -320,7 +332,10 @@
             </row>
             <row>
               <entry><literal>transaction-error</literal></entry>
-              <entry>There was a generic transaction error</entry>
+              <entry>
+                There was a generic transaction error, but please give more
+                details in the description
+              </entry>
             </row>
             <row>
               <entry><literal>repo-not-found</literal></entry>
@@ -330,20 +345,20 @@
               <entry><literal>cannot-remove-system-package</literal></entry>
               <entry>
                 Could not remove a protected system package that is needed for
-                stable operation of the system.
+                stable operation of the system
               </entry>
             </row>
             <row>
               <entry><literal>process-quit</literal></entry>
               <entry>
-                The process was asked to quit, probably because it was cancelled.
+                The process was asked to quit, probably because it was cancelled
               </entry>
             </row>
             <row>
               <entry><literal>process-kill</literal></entry>
               <entry>
                 The process was forcibly killed, probably because ignored the
-                quit request. This is probably due to it being cancelled.
+                quit request. This is probably due to it being cancelled
               </entry>
             </row>
           </tbody>
@@ -360,7 +375,8 @@
         shown in the UI.
       </para>
       <para>
-        The following group enumerated types are available:
+        The following group enumerated types are available, but please check
+        <literal>libpackagekit/pk-enum.h</literal> for the latest list.
       </para>
       <informaltable>
         <tgroup cols="2">
@@ -476,12 +492,12 @@
       <itemizedlist>
         <listitem>
           <para>
-            update libxml as a dependancy
+            update libxml2 as a dependency
           </para>
         </listitem>
         <listitem>
           <para>
-            install java as dependancy
+            install java as dependency
           </para>
         </listitem>
         <listitem>
@@ -499,7 +515,7 @@
         This is one single transaction with the role <literal>install</literal>,
         with 4 different sub-transactions.
         This allows the user to rollback transactions with selected backends,
-        rather than select sub-transactions which may need complex complict
+        rather than select sub-transactions which may need complex conflict
         resolution.
       </para>
       <para>
@@ -511,7 +527,7 @@
         <literal>identifier</literal> is random data used by the daemon to
         ensure jobs started in parallel cannot race, and also to make a
         malicious client program harder to write.
-        <literal>data</literal> can be used for refcounting in the backend or
+        <literal>data</literal> can be used for ref-counting in the backend or
         for any other purpose.
         It is designed to make the life of a backend writer a little bit easier.
         An example <literal>transaction_id</literal> would be
@@ -532,7 +548,8 @@
       <sect3 id="config-main-logging">
         <title>TransactionLogging</title>
         <para>
-          This logs all transactions to a database so old transactions can be viewed.
+          This logs all transactions to a database so old transactions can be
+          viewed, and rollbacks can be done.
         </para>
       </sect3>
       <sect3 id="config-main-timeout">
@@ -593,6 +610,12 @@
         Do not refresh the package cache. This should be fast.
       </para>
       <para>
+        Always emit <literal>installed</literal> before
+        <literal>available</literal> packages first, as it allows the client
+        program to perform the GUI filtering and matching whilst the daemon is
+        running the transaction.
+      </para>
+      <para>
         This method typically emits
         <literal>Progress</literal>,
         <literal>Error</literal> and
@@ -627,7 +650,7 @@
             </row>
             <row>
               <entry><literal>group_type</literal></entry>
-              <entry>An enumerated group_type, or <literal>unknown</literal>.</entry>
+              <entry>An enumerated group_type, or <literal>unknown</literal></entry>
             </row>
           </tbody>
         </tgroup>
@@ -677,9 +700,9 @@
       </informaltable>
       <para>
         Do not refresh the package cache. This should be fast.
-        This is very similar to find-package.
+        This is very similar to search-name.
         This should search as much data as possible, including, if possible
-        repo names, package summaries, descriptions and urls.
+        repo names, package summaries, descriptions and URLs.
       </para>
       <para>
         This method typically emits
@@ -1175,7 +1198,7 @@
         There are no arguments.
       </para>
       <para>
-        This should fetch updated metadata for all enabled repositories.
+        This should fetch updated meta-data for all enabled repositories.
         This operation should be only scheduled when the computer is idle as
         the network connection will be very active, and will the computer will
         have have non-trivial levels of hard disk and processor activity.
@@ -1324,7 +1347,7 @@
             <row>
               <entry><literal>remaining</literal></entry>
               <entry>
-                The amount of time in seconds this transaction will tyake to
+                The amount of time in seconds this transaction will take to
                 complete. Zero is sent for unknown.
               </entry>
             </row>
@@ -1353,7 +1376,10 @@
             </row>
             <row>
               <entry><literal>description</literal></entry>
-              <entry>Long description or error, e.g. "<literal>failed to connect to mytry.xml</literal>"</entry>
+              <entry>
+                Long description or error, e.g.
+                <literal>failed to connect to mytry.xml</literal>
+              </entry>
             </row>
           </tbody>
         </tgroup>
@@ -1364,6 +1390,9 @@
       <title>Status</title>
       <para>
         This is optional, but highly recommended.
+        It gives the GUI tools a chance to show a different icon to show what
+        stage the transaction is in, for instance, a downloading icon can be
+        shown whilst in the <literal>download</literal> state.
       </para>
       <informaltable>
         <tgroup cols="2">
@@ -1445,7 +1474,7 @@
           <tbody>
             <row>
               <entry><literal>info</literal></entry>
-              <entry>A valid <literal>info</literal> string enumunerated type</entry>
+              <entry>A valid <literal>info</literal> string enumerated type</entry>
             </row>
             <row>
               <entry><literal>package_id</literal></entry>
@@ -1453,14 +1482,16 @@
             </row>
             <row>
               <entry><literal>summary</literal></entry>
-              <entry>The one line package summary, e.g. "Clipart for OpenOffice"</entry>
+              <entry>
+                The one line package summary, e.g. "Clipart for OpenOffice"
+              </entry>
             </row>
           </tbody>
         </tgroup>
       </informaltable>
 
       <para>
-        The <literal>info</literal> enumunerated type
+        The <literal>info</literal> enumerated type
       </para>
 
       <informaltable>
@@ -1552,7 +1583,7 @@
             <row>
               <entry><literal>licence</literal></entry>
               <entry>
-                The licence, e.g. "GPL2" or "proprietary".
+                The licence, e.g. "GPLv2+" or "proprietary".
                 If you need to add a EULA then do it like this:
                 "proprietary;By installing this software\nyou may kill a kitten."
               </entry>
@@ -1564,7 +1595,7 @@
             <row>
               <entry><literal>detail</literal></entry>
               <entry>
-                The multi line package description.
+                The multi-line package description.
                 NOTE: Tabs may have to be stripped from the description to
                 avoid being split.
               </entry>
@@ -1619,7 +1650,9 @@
             </row>
             <row>
               <entry><literal>url</literal></entry>
-              <entry>A URL with more details on the update, e.g. a security advisory</entry>
+              <entry>
+                A URL with more details on the update, e.g. a security advisory
+              </entry>
             </row>
             <row>
               <entry><literal>restart_enum</literal></entry>
@@ -1629,7 +1662,7 @@
               <entry><literal>update_text</literal></entry>
               <entry>
                 The update text describing the update in a non-localised way.
-                Newlines should be converted to ";"
+                Newlines should be converted to ";" before printed.
               </entry>
             </row>
           </tbody>
@@ -1663,7 +1696,9 @@
           <tbody>
             <row>
               <entry><literal>repository_name</literal></entry>
-              <entry>The name of the repository associated with the provided key</entry>
+              <entry>
+                The name of the repository associated with the provided key
+              </entry>
             </row>
             <row>
               <entry><literal>key_url</literal></entry>
commit e06cd96dcc5460f6f02f9d0cacce71de5d1f0476
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Nov 3 11:36:11 2007 +0000

    update gitignore

diff --git a/.gitignore b/.gitignore
index 97a4b34..a911d1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,3 +50,5 @@ py-compile
 *.swp
 tags
 *.patch
+NEWS.new
+
commit ad077e3d1db10e3b93b152d99926899ea665b120
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Nov 3 11:18:18 2007 +0000

    add soem hacky code I used to get the groups used by yum

diff --git a/tools/yum-get-groups.sh b/tools/yum-get-groups.sh
new file mode 100755
index 0000000..0710d27
--- /dev/null
+++ b/tools/yum-get-groups.sh
@@ -0,0 +1,2 @@
+cat ../backends/yum/helpers/yumBackend.py | grep "GROUP_" | cut -d":" -f2 | cut -d"," -f1 | cut -d" " -f2 | sort| uniq
+



More information about the PackageKit mailing list