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

Richard Hughes hughsient at kemper.freedesktop.org
Sat Oct 13 13:17:21 PDT 2007


 TODO                          |    1 
 libpackagekit/Makefile.am     |    2 
 libpackagekit/pk-common.c     |  244 +++++++++++++++++++++++++++++++++++++++++-
 libpackagekit/pk-common.h     |    8 +
 libpackagekit/pk-package-id.c |  151 ++-----------------------
 libpackagekit/pk-package-id.h |    2 
 libpackagekit/pk-self-test.c  |    2 
 src/pk-transaction-id.c       |   45 ++++++-
 8 files changed, 306 insertions(+), 149 deletions(-)

New commits:
commit 593aeed02684bd497a43289387365e360673878c
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Oct 13 21:16:02 2007 +0100

    only compare the first two entries of the tid. fixes a todo in prep for rollbacks

diff --git a/TODO b/TODO
index a18fb9a..43a453f 100644
--- a/TODO
+++ b/TODO
@@ -20,6 +20,5 @@ Have different permissions for signed and unsigned repos.
 *** Handle rollbacks for select backends ***
 To do rollbacks sanely in PK we need a few things:
  * emit internal signal for SetTransactionData
- * write pk_transaction_id_equal to not compare data
  * allow transaction data to be changed in _db
 
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index 12d7536..9cd339e 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -188,6 +188,7 @@ libst_package_id (LibSelfTest *test)
 		libst_failed (test, NULL);
 	}
 
+	/************************************************************/
 	libst_title (test, "pid equal pass (different)");
 	ret = pk_package_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;data");
 	if (ret == TRUE) {
@@ -196,6 +197,7 @@ libst_package_id (LibSelfTest *test)
 		libst_failed (test, NULL);
 	}
 
+	/************************************************************/
 	libst_title (test, "get an ident object");
 	ident = pk_package_id_new ();
 	if (ident != NULL) {
diff --git a/src/pk-transaction-id.c b/src/pk-transaction-id.c
index e8e3e0b..e869313 100644
--- a/src/pk-transaction-id.c
+++ b/src/pk-transaction-id.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n.h>
 
 #include "pk-debug.h"
+#include "pk-common.h"
 #include "pk-transaction-id.h"
 #define PK_TRANSACTION_ID_COUNT_FILE		LOCALSTATEDIR "/run/PackageKit/job_count.dat"
 
@@ -97,16 +98,11 @@ pk_transaction_id_save_job_count (guint job_count)
 
 /**
  * pk_transaction_id_equal:
- * TODO: only compare first two sections...
  **/
 gboolean
 pk_transaction_id_equal (const gchar *tid1, const gchar *tid2)
 {
-	if (tid1 == NULL || tid2 == NULL) {
-		pk_warning ("transaction id compare invalid '%s' and '%s'", tid1, tid2);
-		return FALSE;
-	}
-	return (strcmp (tid1, tid2) == 0);
+	return pk_string_id_equal (tid1, tid2, 3, 2);
 }
 
 /**
@@ -146,6 +142,7 @@ void
 libst_transaction_id (LibSelfTest *test)
 {
 	gchar *tid;
+	gboolean ret;
 
 	if (libst_start (test, "PkTransactionId", CLASS_AUTO) == FALSE) {
 		return;
@@ -163,6 +160,42 @@ libst_transaction_id (LibSelfTest *test)
 	}
 	g_free (tid);
 
+	/************************************************************/
+	libst_title (test, "tid equal pass (same)");
+	ret = pk_transaction_id_equal ("34;1234def;r23", "34;1234def;r23");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "tid equal pass (different)");
+	ret = pk_transaction_id_equal ("34;1234def;unknown", "34;1234def;r23");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "tid equal fail 1");
+	ret = pk_transaction_id_equal ("34;1234def;r23", "35;1234def;r23");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "tid equal fail 2");
+	ret = pk_transaction_id_equal ("34;1234def;r23", "34;1234dff;r23");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
 	libst_end (test);
 }
 #endif
commit d5a2fdc839b828058f8280278f4d4b340480ad5d
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Oct 13 21:05:01 2007 +0100

    make a more general purpose function pk_string_id_equal so we can use it for the transaction_id also

diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 9ddf70d..f252fe7 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -162,6 +162,59 @@ pk_string_id_strcmp (const gchar *id1, const gchar *id2)
 	return (strcmp (id1, id2) == 0);
 }
 
+/**
+ * pk_string_id_equal:
+ * only compare first sections, not all the data
+ **/
+gboolean
+pk_string_id_equal (const gchar *id1, const gchar *id2, guint parts, guint compare)
+{
+	gchar **sections1;
+	gchar **sections2;
+	gboolean ret = FALSE;
+	guint i;
+
+	if (id1 == NULL || id2 == NULL) {
+		pk_warning ("package id compare invalid '%s' and '%s'", id1, id2);
+		return FALSE;
+	}
+	if (compare > parts) {
+		pk_warning ("compare %i > parts %i", compare, parts);
+		return FALSE;
+	}
+	if (compare == parts) {
+		pk_debug ("optimise to strcmp");
+		return pk_string_id_strcmp (id1, id2);
+	}
+
+	/* split, NULL will be returned if error */
+	sections1 = pk_string_id_split (id1, parts);
+	sections2 = pk_string_id_split (id2, parts);
+
+	/* check we split okay */
+	if (sections1 == NULL) {
+		pk_warning ("string id compare sections1 invalid '%s'", id1);
+		goto out;
+	}
+	if (sections2 == NULL) {
+		pk_warning ("string id compare sections2 invalid '%s'", id2);
+		goto out;
+	}
+
+	/* only compare preceeding sections */
+	for (i=0; i<compare; i++) {
+		if (strcmp (sections1[i], sections2[i]) != 0) {
+			goto out;
+		}
+	}
+	ret = TRUE;
+
+out:
+	g_strfreev (sections1);
+	g_strfreev (sections2);
+	return ret;
+}
+
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
@@ -256,6 +309,62 @@ libst_common (LibSelfTest *test)
 		libst_failed (test, NULL);
 	}
 
+	libst_title (test, "id equal pass (same)");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora", 4, 3);
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal pass (parts==match)");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora", 4, 4);
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal pass (different)");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;data", 4, 3);
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal fail1");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.2;x64;fedora", 4, 3);
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal fail2");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "gnome;0.0.2;i386;fedora", 4, 3);
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal fail3");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.3;i386;fedora", 4, 3);
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	libst_title (test, "id equal fail (match too high)");
+	ret = pk_string_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.3;i386;fedora", 4, 5);
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
 	/************************************************************
 	 ****************          FILTERS         ******************
 	 ************************************************************/
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index 8985368..9877227 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
 gboolean	 pk_filter_check			(const gchar	*filter);
 gchar		**pk_string_id_split			(const gchar	*id,
 							 guint		 parts);
+gboolean	 pk_string_id_strcmp			(const gchar	*id1,
+							 const gchar	*id2);
+gboolean	 pk_string_id_equal			(const gchar	*id1,
+							 const gchar	*id2,
+							 guint		 parts,
+							 guint		 match);
 
 G_END_DECLS
 
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index c5d38f0..12d7536 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -47,48 +47,6 @@ pk_package_id_new (void)
 }
 
 /**
- * pk_package_id_equal:
- * only compare first three sections, not data
- **/
-gboolean
-pk_package_id_equal (const gchar *pid1, const gchar *pid2)
-{
-	gchar **sections1;
-	gchar **sections2;
-	gboolean ret = FALSE;
-
-	if (pid1 == NULL || pid2 == NULL) {
-		pk_warning ("package id compare invalid '%s' and '%s'", pid1, pid2);
-		return FALSE;
-	}
-
-	/* split, NULL will be returned if error */
-	sections1 = pk_string_id_split (pid1, 4);
-	sections2 = pk_string_id_split (pid2, 4);
-
-	/* check we split okay */
-	if (sections1 == NULL) {
-		pk_warning ("package id compare sections1 invalid '%s'", pid1);
-		return FALSE;
-	}
-	if (sections2 == NULL) {
-		pk_warning ("package id compare sections2 invalid '%s'", pid2);
-		return FALSE;
-	}
-
-	/* only compare first three sections */
-	if ((strcmp (sections1[0], sections2[0]) == 0) &&
-	    (strcmp (sections1[1], sections2[1]) == 0) &&
-	    (strcmp (sections1[2], sections2[2]) == 0)) {
-		ret = TRUE;
-	}
-
-	g_strfreev (sections1);
-	g_strfreev (sections2);
-	return ret;
-}
-
-/**
  * pk_package_id_check:
  **/
 gboolean
@@ -191,6 +149,15 @@ pk_package_id_free (PkPackageId *ident)
 	return TRUE;
 }
 
+/**
+ * pk_string_id_equal:
+ **/
+gboolean
+pk_package_id_equal (const gchar *pid1, const gchar *pid2)
+{
+	return pk_string_id_equal (pid1, pid2, 4, 3);
+}
+
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
@@ -229,30 +196,6 @@ libst_package_id (LibSelfTest *test)
 		libst_failed (test, NULL);
 	}
 
-	libst_title (test, "pid equal fail1");
-	ret = pk_package_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.2;x64;fedora");
-	if (ret == FALSE) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	libst_title (test, "pid equal fail2");
-	ret = pk_package_id_equal ("moo;0.0.1;i386;fedora", "gnome;0.0.2;i386;fedora");
-	if (ret == FALSE) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	libst_title (test, "pid equal fail3");
-	ret = pk_package_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.3;i386;fedora");
-	if (ret == FALSE) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
 	libst_title (test, "get an ident object");
 	ident = pk_package_id_new ();
 	if (ident != NULL) {
diff --git a/libpackagekit/pk-package-id.h b/libpackagekit/pk-package-id.h
index 88050cb..05a3217 100644
--- a/libpackagekit/pk-package-id.h
+++ b/libpackagekit/pk-package-id.h
@@ -48,8 +48,6 @@ gboolean	 pk_package_id_free			(PkPackageId	*ident);
 gboolean	 pk_package_id_check			(const gchar	*package_id);
 gboolean	 pk_package_id_equal			(const gchar	*tid1,
 							 const gchar	*tid2);
-gboolean	 pk_package_id_strcmp			(const gchar	*tid1,
-							 const gchar	*tid2);
 
 G_END_DECLS
 
commit b1cb1bb5d7422c2019ad6c8b7c070e1d836e50f1
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Oct 13 20:16:47 2007 +0100

    move pk_string_id_strcmp into PkCommon

diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index fe854c4..9ddf70d 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -149,6 +149,19 @@ out:
 	return NULL;
 }
 
+/**
+ * pk_string_id_strcmp:
+ **/
+gboolean
+pk_string_id_strcmp (const gchar *id1, const gchar *id2)
+{
+	if (id1 == NULL || id2 == NULL) {
+		pk_warning ("string id compare invalid '%s' and '%s'", id1, id2);
+		return FALSE;
+	}
+	return (strcmp (id1, id2) == 0);
+}
+
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
@@ -225,6 +238,24 @@ libst_common (LibSelfTest *test)
 		libst_failed (test, NULL);
 	}
 
+	/************************************************************/
+	libst_title (test, "id strcmp pass");
+	ret = pk_string_id_strcmp ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora");
+	if (ret == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "id strcmp fail");
+	ret = pk_string_id_strcmp ("moo;0.0.1;i386;fedora", "moo;0.0.2;i386;fedora");
+	if (ret == FALSE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
 	/************************************************************
 	 ****************          FILTERS         ******************
 	 ************************************************************/
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index d37ba0b..c5d38f0 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -47,19 +47,6 @@ pk_package_id_new (void)
 }
 
 /**
- * pk_package_id_strcmp:
- **/
-gboolean
-pk_package_id_strcmp (const gchar *pid1, const gchar *pid2)
-{
-	if (pid1 == NULL || pid2 == NULL) {
-		pk_warning ("package id compare invalid '%s' and '%s'", pid1, pid2);
-		return FALSE;
-	}
-	return (strcmp (pid1, pid2) == 0);
-}
-
-/**
  * pk_package_id_equal:
  * only compare first three sections, not data
  **/
@@ -226,22 +213,6 @@ libst_package_id (LibSelfTest *test)
 	 ****************          IDENT           ******************
 	 ************************************************************/
 
-	libst_title (test, "pid strcmp pass");
-	ret = pk_package_id_strcmp ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora");
-	if (ret == TRUE) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	libst_title (test, "pid strcmp fail");
-	ret = pk_package_id_strcmp ("moo;0.0.1;i386;fedora", "moo;0.0.2;i386;fedora");
-	if (ret == FALSE) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
 	libst_title (test, "pid equal pass (same)");
 	ret = pk_package_id_equal ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora");
 	if (ret == TRUE) {
commit ffeebe7709359b8a4653a484b8ed3b420d8e8702
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Oct 13 20:12:26 2007 +0100

    move common functionality into PkCommon

diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index 9249292..b73aed3 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -88,6 +88,8 @@ pk_self_test_SOURCES =						\
 	pk-debug.h						\
 	pk-enum.h						\
 	pk-enum.c						\
+	pk-common.h						\
+	pk-common.c						\
 	pk-enum-list.h						\
 	pk-enum-list.c						\
 	pk-package-id.h						\
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 8b4e2a5..fe854c4 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -110,6 +110,45 @@ out:
 	return ret;
 }
 
+/**
+ * pk_string_id_split:
+ *
+ * You need to use g_strfreev on the returned value
+ **/
+gchar **
+pk_string_id_split (const gchar *id, guint parts)
+{
+	gchar **sections = NULL;
+
+	if (id == NULL) {
+		pk_warning ("ident is null!");
+		goto out;
+	}
+
+	/* split by delimeter ';' */
+	sections = g_strsplit (id, ";", 0);
+	if (g_strv_length (sections) != parts) {
+		pk_warning ("ident '%s' is invalid (sections=%d)", id, g_strv_length (sections));
+		goto out;
+	}
+
+	/* name has to be valid */
+	if (strlen (sections[0]) == 0) {
+		pk_warning ("ident first section is empty");
+		goto out;
+	}
+
+	/* all okay, phew.. */
+	return sections;
+
+out:
+	/* free sections and return NULL */
+	if (sections != NULL) {
+		g_strfreev (sections);
+	}
+	return NULL;
+}
+
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
@@ -117,17 +156,76 @@ out:
 #include <libselftest.h>
 
 void
-libst_task_common (LibSelfTest *test)
+libst_common (LibSelfTest *test)
 {
 	gboolean ret;
-	gchar *text;
+	gchar **array;
 	const gchar *temp;
 
-	if (libst_start (test, "PkTaskCommon", CLASS_AUTO) == FALSE) {
+	if (libst_start (test, "PkCommon", CLASS_AUTO) == FALSE) {
 		return;
 	}
 
 	/************************************************************
+	 ****************          string_id         ****************
+	 ************************************************************/
+	libst_title (test, "test pass 1");
+	array = pk_string_id_split ("foo", 1);
+	if (array != NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+	g_strfreev (array);
+
+	/************************************************************/
+	libst_title (test, "test pass 2");
+	array = pk_string_id_split ("foo;moo", 2);
+	if (array != NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+	g_strfreev (array);
+
+	/************************************************************/
+	libst_title (test, "test pass 3");
+	array = pk_string_id_split ("foo;moo;bar", 3);
+	if (array != NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+	g_strfreev (array);
+
+	/************************************************************/
+	libst_title (test, "test fail under");
+	array = pk_string_id_split ("foo;moo", 1);
+	if (array == NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "test fail over");
+	array = pk_string_id_split ("foo;moo", 3);
+	if (array == NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "test fail missing first");
+	array = pk_string_id_split (";moo", 2);
+	if (array == NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************
 	 ****************          FILTERS         ******************
 	 ************************************************************/
 	temp = NULL;
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index 7cffabd..8985368 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -31,6 +31,8 @@ G_BEGIN_DECLS
 #define	PK_DBUS_INTERFACE		"org.freedesktop.PackageKit"
 
 gboolean	 pk_filter_check			(const gchar	*filter);
+gchar		**pk_string_id_split			(const gchar	*id,
+							 guint		 parts);
 
 G_END_DECLS
 
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index c95ece4..d37ba0b 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n.h>
 
 #include "pk-debug.h"
+#include "pk-common.h"
 #include "pk-package-id.h"
 
 /**
@@ -46,46 +47,6 @@ pk_package_id_new (void)
 }
 
 /**
- * pk_package_id_split:
- *
- * Returns the split, ONLY if package name is okay
- * You need to use g_strfreev on the returned value
- **/
-static gchar **
-pk_package_id_split (const gchar *package_id)
-{
-	gchar **sections = NULL;
-
-	if (package_id == NULL) {
-		pk_warning ("Package ident is null!");
-		goto out;
-	}
-
-	/* split by delimeter ';' */
-	sections = g_strsplit (package_id, ";", 0);
-	if (g_strv_length (sections) != 4) {
-		pk_warning ("Package ident '%s' is invalid (sections=%d)", package_id, g_strv_length (sections));
-		goto out;
-	}
-
-	/* name has to be valid */
-	if (strlen (sections[0]) == 0) {
-		pk_warning ("Package ident package is empty");
-		goto out;
-	}
-
-	/* all okay, phew.. */
-	return sections;
-
-out:
-	/* free sections and return NULL */
-	if (sections != NULL) {
-		g_strfreev (sections);
-	}
-	return NULL;
-}
-
-/**
  * pk_package_id_strcmp:
  **/
 gboolean
@@ -115,8 +76,8 @@ pk_package_id_equal (const gchar *pid1, const gchar *pid2)
 	}
 
 	/* split, NULL will be returned if error */
-	sections1 = pk_package_id_split (pid1);
-	sections2 = pk_package_id_split (pid2);
+	sections1 = pk_string_id_split (pid1, 4);
+	sections2 = pk_string_id_split (pid2, 4);
 
 	/* check we split okay */
 	if (sections1 == NULL) {
@@ -147,7 +108,7 @@ gboolean
 pk_package_id_check (const gchar *package_id)
 {
 	gchar **sections;
-	sections = pk_package_id_split (package_id);
+	sections = pk_string_id_split (package_id, 4);
 	if (sections != NULL) {
 		g_strfreev (sections);
 		return TRUE;
@@ -164,7 +125,7 @@ pk_package_id_new_from_string (const gchar *package_id)
 	gchar **sections;
 	PkPackageId *ident = NULL;
 
-	sections = pk_package_id_split (package_id);
+	sections = pk_string_id_split (package_id, 4);
 	if (sections == NULL) {
 		return NULL;
 	}
diff --git a/libpackagekit/pk-self-test.c b/libpackagekit/pk-self-test.c
index d53bcf9..e00455e 100644
--- a/libpackagekit/pk-self-test.c
+++ b/libpackagekit/pk-self-test.c
@@ -27,6 +27,7 @@
 void libst_package_id (LibSelfTest *test);
 void libst_package_list (LibSelfTest *test);
 void libst_enum (LibSelfTest *test);
+void libst_common (LibSelfTest *test);
 void libst_enum_list (LibSelfTest *test);
 
 int
@@ -38,6 +39,7 @@ main (int argc, char **argv)
 	libst_init (&test);
 
 	/* tests go here */
+	libst_common (&test);
 	libst_package_id (&test);
 	libst_package_list (&test);
 	libst_enum (&test);



More information about the PackageKit mailing list