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

Richard Hughes hughsient at kemper.freedesktop.org
Wed Oct 3 11:16:21 PDT 2007


 TODO                               |    6 ----
 backends/yum/helpers/yumBackend.py |    3 --
 docs/introduction.xml              |   11 ++++++-
 libpackagekit/pk-package-list.c    |   53 +++++++++++++++++++++++++++++++++++++
 libpackagekit/pk-package-list.h    |    2 +
 src/pk-engine.c                    |    7 ++++
 6 files changed, 72 insertions(+), 10 deletions(-)

New commits:
diff-tree 1348b3842532fd5965c3e2dad541ee0d4fdc8f8e (from f416cd5a679db256d666df03c90ea6c35b531472)
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Oct 3 19:11:41 2007 +0100

    update TODO and make documentation clearer

diff --git a/TODO b/TODO
index 42c0896..058c5f8 100644
--- a/TODO
+++ b/TODO
@@ -5,11 +5,6 @@ Do automatic updates at login time when 
  * needs gnome-screensaver integration
 NOTE: RELEASE BLOCKER
 
-*** don't output the same package in different repos ***
-Need to store Package() in the server properly, and compare the first chunk
-(not the data) to avoid reporting the same package more than once.
-NOTE: RELEASE BLOCKER
-
 *** Add new callback for status ***
 TimeRemaining()
  
diff --git a/docs/introduction.xml b/docs/introduction.xml
index 6ba5264..995fbcd 100644
--- a/docs/introduction.xml
+++ b/docs/introduction.xml
@@ -1246,6 +1246,11 @@
         If updating, as packages are updated then emit them to the screen.
 	This allows a summary to be presented after the transaction.
       </para>
+      <para>
+        When returning results from a search always return
+        <literal>installed</literal> before <literal>available</literal> for
+        the same package name.
+      </para>
       <informaltable>
         <tgroup cols="2">
           <thead>
@@ -1395,7 +1400,11 @@
             </row>
             <row>
               <entry><literal>file_list</literal></entry>
-              <entry>A list of all files and directories created by the package at install time.  Separated by the ';' character.</entry>
+              <entry>
+                A list of all files and directories created by the package
+                at install time.
+                The list is separated by the <literal>;</literal> character.
+              </entry>
             </row>
           </tbody>
         </tgroup>
diff-tree f416cd5a679db256d666df03c90ea6c35b531472 (from bdf5d8d79f19c2239bff111ba845beabb2cd5732)
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Oct 3 18:40:12 2007 +0100

    check if already in the package list, to avoid having installed and available in the UI

diff --git a/src/pk-engine.c b/src/pk-engine.c
index fa5b91c..c0cbe37 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -268,6 +268,7 @@ pk_engine_package_cb (PkBackend *backend
 {
 	PkTransactionItem *item;
 	const gchar *info_text;
+	gboolean ret;
 
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (PK_IS_ENGINE (engine));
@@ -278,6 +279,12 @@ pk_engine_package_cb (PkBackend *backend
 		return;
 	}
 
+	/* check if already in the package list, to avoid having installed and available in the UI */
+	ret = pk_package_list_contains (item->package_list, package_id);
+	if (ret == TRUE) {
+		return;
+	}
+
 	/* add to package cache */
 	pk_package_list_add (item->package_list, info, package_id, summary);
 
diff-tree bdf5d8d79f19c2239bff111ba845beabb2cd5732 (from 65aa3d1d55b41aabd8d1b16ccf3609d503bdef32)
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Oct 3 18:34:35 2007 +0100

    add pk_package_list_contains so we can check the package buffer

diff --git a/TODO b/TODO
index 28a0f9f..42c0896 100644
--- a/TODO
+++ b/TODO
@@ -8,7 +8,6 @@ NOTE: RELEASE BLOCKER
 *** don't output the same package in different repos ***
 Need to store Package() in the server properly, and compare the first chunk
 (not the data) to avoid reporting the same package more than once.
-Need to properly unit test...
 NOTE: RELEASE BLOCKER
 
 *** Add new callback for status ***
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index 73475dc..20ba8ef 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -36,6 +36,7 @@
 #include <glib/gi18n.h>
 
 #include "pk-debug.h"
+#include "pk-package-id.h"
 #include "pk-package-list.h"
 
 static void     pk_package_list_class_init	(PkPackageListClass *klass);
@@ -136,6 +137,31 @@ pk_package_list_remove_buffer (PkPackage
 }
 
 /**
+ * pk_package_list_contains:
+ **/
+gboolean
+pk_package_list_contains (PkPackageList *plist, const gchar *package_id)
+{
+	PkPackageListItem *item;
+	guint i;
+	guint length;
+	gboolean ret = FALSE;
+
+	g_return_val_if_fail (plist != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_PACKAGE_LIST (plist), FALSE);
+
+	length = plist->priv->array->len;
+	for (i=0; i<length; i++) {
+		item = g_ptr_array_index (plist->priv->array, i);
+		ret = pk_package_id_equal (item->package_id, package_id);
+		if (ret == TRUE) {
+			break;
+		}
+	}
+	return ret;
+}
+
+/**
  * pk_package_list_class_init:
  * @klass: The PkPackageListClass
  **/
@@ -229,6 +255,33 @@ libst_package_list (LibSelfTest *test)
 	}
 
 	/************************************************************/
+	libst_title (test, "check not exists");
+	ret = pk_package_list_contains (plist, "liferea;1.23;i386;data");
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "check exists");
+	ret = pk_package_list_contains (plist, "gnome;1.23;i386;data");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "check exists different data");
+	ret = pk_package_list_contains (plist, "gnome;1.23;i386;fedora");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
 	libst_title (test, "add entry");
 	text = pk_package_list_get_string (plist);
 	if (text != NULL && strcmp (text, "installed\tgnome;1.23;i386;data\tGNOME!") == 0) {
diff --git a/libpackagekit/pk-package-list.h b/libpackagekit/pk-package-list.h
index 5685827..5e89ff1 100644
--- a/libpackagekit/pk-package-list.h
+++ b/libpackagekit/pk-package-list.h
@@ -60,6 +60,8 @@ gboolean	 pk_package_list_add			(PkPacka
 							 PkInfoEnum		 info,
 							 const gchar		*package_id,
 							 const gchar		*summary);
+gboolean	 pk_package_list_contains		(PkPackageList		*plist,
+							 const gchar		*package_id);
 gchar		*pk_package_list_get_string		(PkPackageList		*plist);
 GPtrArray	*pk_package_list_get_buffer		(PkPackageList		*plist);
 gboolean	 pk_package_list_remove_buffer		(PkPackageList		*plist);
diff-tree 65aa3d1d55b41aabd8d1b16ccf3609d503bdef32 (from b541123242f34411dda8a04102b8ecfffb11356f)
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Wed Oct 3 16:01:33 2007 +0200

    Dont submit package signals for metadata files

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 160e551..cc7be19 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -585,9 +585,6 @@ class DownloadCallback( BaseMeter ):
                 pkg = self._getPackage(name)
                 if pkg: # show package to download
                     self.base._show_package(pkg,INFO_DOWNLOADING)
-                else:
-                    id = self.base.get_package_id(name, '', '', '')
-                    self.base.package(id,INFO_DOWNLOADING, "Repository MetaData")
     
 
 class PackageKitCallback(RPMBaseCallback):



More information about the PackageKit mailing list