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

Richard Hughes hughsient at kemper.freedesktop.org
Sun Sep 9 23:25:59 PDT 2007


 backends/Makefile.am            |    4 
 backends/alpm/.gitignore        |   10 
 backends/alpm/Makefile.am       |    7 
 backends/alpm/pk-backend-alpm.c |  539 ++++++++++++++++++++++++++++++++++++++++
 configure.ac                    |   15 +
 5 files changed, 574 insertions(+), 1 deletion(-)

New commits:
diff-tree 3c623dd47802d1bb83060924764ed31fef65fef6 (from 2e94601b80560cf8073285cfd6e62044fc6b06ac)
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Sep 10 07:25:42 2007 +0100

    refix the default backend change. I think Andreas failed to fix the conflict properly. No problem.

diff --git a/configure.ac b/configure.ac
index 2e1b896..5ce4df7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,15 +184,15 @@ AC_MSG_RESULT(yes)
 dnl ---------------------------------------------------------------------------
 dnl - Compile time default choice of backend
 dnl ---------------------------------------------------------------------------
-AC_ARG_WITH([backend],
+AC_ARG_WITH([default_backend],
 	    AS_HELP_STRING([--with-default-backend=<option>],
-			   [Default backend to use dummy,apt,yum,conary (dummy)]))
+			   [Default backend to use alpm,apt,box,conary,dummy,yum (dummy)]))
 # default to a sane option for the installed tool
 if test x$with_default_backend = x; then
     if test -f /usr/bin/yum ; then
         with_default_backend=yum
-#    elif test -f /usr/lib/libalpm.so; then
-#	with_default_backend=alpm
+    elif test -f /usr/lib/libalpm.so; then
+	with_default_backend=alpm
     elif test -f /usr/bin/apt-get ; then
         with_default_backend=apt
     elif test -f /usr/bin/conary ; then
@@ -251,7 +251,7 @@ AC_DEFUN([APT_BACKEND],
  	fi
 ])
 
-if test x$with_backend = xapt; then
+if test x$with_default_backend = xapt; then
    
    AC_ARG_WITH(libapt-pkg-lib,
      AC_HELP_STRING([--with-libapt-pkg-lib=DIR],[look for the libapt-pkg library in DIR]),
@@ -317,17 +317,17 @@ if test x$with_backend = xapt; then
     AC_SUBST(APT_PKG_TYPE)
 fi
 
-if test x$with_backend = xbox; then
+if test x$with_default_backend = xbox; then
 	PKG_CHECK_MODULES(BOX, libbox)
 	AC_SUBST(BOX_CFLAGS)
 	AC_SUBST(BOX_LIBS)
 fi
 
-if test x$with_backend = xalpm; then
-    with_backend=dummy
+if test x$with_default_backend = xalpm; then
+    with_default_backend=dummy
     AC_MSG_WARN([The alpm backend doesn't work at all!])
     AC_CHECK_HEADER([alpm.h],
-		    [with_backend=alpm],
+		    [with_default_backend=alpm],
 		    [AC_MSG_WARN([No alpm headers found - falling back to dummy backend])])
 fi
     
@@ -337,12 +337,12 @@ AC_SUBST(PK_PLUGIN_DIR, "\$(libdir)/pack
 AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/libpackagekit $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS")
 AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS")
 
-AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_backend = xdummy], [using dummy backend])
-AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_backend = xapt], [using APT backend])
-AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$with_backend = xyum], [using YUM backend])
-AM_CONDITIONAL(BACKEND_TYPE_CONARY, [test x$with_backend = xconary], [using CONARY backend])
-AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$with_backend = xbox], [using BOX backend])
-AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$with_backend = xalpm], [using ALPM backend])
+AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_default_backend = xdummy], [using dummy backend])
+AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_default_backend = xapt], [using APT backend])
+AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$with_default_backend = xyum], [using YUM backend])
+AM_CONDITIONAL(BACKEND_TYPE_CONARY, [test x$with_default_backend = xconary], [using CONARY backend])
+AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$with_default_backend = xbox], [using BOX backend])
+AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$with_default_backend = xalpm], [using ALPM backend])
 
 
 dnl ---------------------------------------------------------------------------
diff-tree 2e94601b80560cf8073285cfd6e62044fc6b06ac (from 09ebb9bad8573390a1d1c03408974060b725282f)
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date:   Mon Sep 10 03:07:08 2007 +0200

    added alpm backend

diff --git a/backends/Makefile.am b/backends/Makefile.am
index e2632b6..a5ff919 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -1,5 +1,9 @@
 SUBDIRS = dummy test
 
+if BACKEND_TYPE_ALPM
+SUBDIRS += alpm
+endif
+
 if BACKEND_TYPE_APT
 SUBDIRS += apt
 endif
diff --git a/backends/alpm/.gitignore b/backends/alpm/.gitignore
new file mode 100644
index 0000000..c851833
--- /dev/null
+++ b/backends/alpm/.gitignore
@@ -0,0 +1,10 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.la
+*.lo
+*.loT
+*.o
+*~
+
diff --git a/backends/alpm/Makefile.am b/backends/alpm/Makefile.am
new file mode 100644
index 0000000..48588ca
--- /dev/null
+++ b/backends/alpm/Makefile.am
@@ -0,0 +1,7 @@
+plugindir = @PK_PLUGIN_DIR@
+plugin_LTLIBRARIES = libpk_backend_alpm.la
+libpk_backend_alpm_la_SOURCES = pk-backend-alpm.c
+libpk_backend_alpm_la_LIBADD = @PK_PLUGIN_LIBS@ -lalpm
+libpk_backend_alpm_la_LDFLAGS = -module -avoid-version
+libpk_backend_alpm_la_CFLAGS = @PK_PLUGIN_CFLAGS@
+
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
new file mode 100644
index 0000000..1140f16
--- /dev/null
+++ b/backends/alpm/pk-backend-alpm.c
@@ -0,0 +1,539 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 Richard Hughes <richard at hughsie.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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#define ALPM_CONFIG_PATH "/etc/pacman.conf"
+
+#include <gmodule.h>
+#include <glib.h>
+#include <string.h>
+#include <pk-backend.h>
+#include <pk-debug.h>
+
+#include <alpm.h>
+#include <alpm_list.h>
+
+static int progress_percentage;
+
+alpm_list_t *
+my_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
+{
+  alpm_list_t *newlist, *lp;
+
+  if (left == NULL) 
+    return right;
+  if (right == NULL)
+    return left;
+
+  if (fn(left->data, right->data) <= 0) {
+    newlist = left;
+    left = left->next;
+  }
+  else {
+    newlist = right;
+    right = right->next;
+  }
+  newlist->prev = NULL;
+  newlist->next = NULL;
+  lp = newlist;
+
+  while ((left != NULL) && (right != NULL)) {
+    if (fn(left->data, right->data) <= 0) {
+      lp->next = left;
+      left->prev = lp;
+      left = left->next;
+    } 
+    else {
+      lp->next = right;
+      right->prev = lp;
+      right = right->next;
+    }
+    lp = lp->next;
+    lp->next = NULL;
+  }
+  if (left != NULL) {
+    lp->next = left;
+    left->prev = lp;
+  }
+  else if (right != NULL) {
+    lp->next = right;
+    right->prev = lp;
+  }
+  return(newlist);
+}
+
+gboolean
+pkg_equal (pmpkg_t *p1, pmpkg_t *p2)
+{
+  if (strcmp (alpm_pkg_get_name (p1), alpm_pkg_get_name (p2)) != 0)
+    return FALSE;
+  if (strcmp (alpm_pkg_get_version (p1), alpm_pkg_get_version (p2)) != 0)
+    return FALSE;
+  return TRUE;
+}
+
+alpm_list_t *
+my_list_remove_node(alpm_list_t *node)
+{
+  if(!node) return(NULL);
+
+  alpm_list_t *ret = NULL;
+
+  if(node->prev) {
+    node->prev->next = node->next;
+    ret = node->prev;
+    node->prev = NULL;
+  }
+  if(node->next) {
+    node->next->prev = node->prev;
+    ret = node->next;
+    node->next = NULL;
+  }
+
+  return(ret);
+}
+
+
+/*static int 
+list_cmp_fn (const void *n1, const void *n2)
+{
+  return 0;
+}*/
+
+
+
+static void
+add_package (PkBackend *backend, pmpkg_t *package, pmdb_t *db, guint installed)
+{ 
+  gchar *pkg_string;
+  pkg_string = pk_package_id_build(alpm_pkg_get_name (package), 
+				     alpm_pkg_get_version (package), 
+				     alpm_pkg_get_arch (package), 
+				     alpm_db_get_name (db));
+
+  pk_backend_package (backend, installed, pkg_string, alpm_pkg_get_desc (package));
+
+  g_free(pkg_string);
+}
+
+
+
+
+static void
+add_packages_from_list (PkBackend *backend, alpm_list_t *list, pmdb_t *db, guint installed)
+{
+  pmpkg_t *package = NULL;
+  alpm_list_t *li = NULL;
+
+  for (li = list; li != NULL; li = alpm_list_next (li)) {
+    package = (pmpkg_t *)li->data;
+    add_package (backend, package, db, installed);
+  }
+}
+
+
+
+/**
+ * backend_destroy:
+ */
+static void
+backend_destroy (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	if (alpm_release () == -1)
+	  pk_backend_error_code (backend, 
+				 PK_ERROR_ENUM_INTERNAL_ERROR,  
+				 "Failed to release control");
+}
+
+/**
+ * backend_initalize:
+ */
+static void
+backend_initalize (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	pk_debug ("alpm: hi!");
+
+	if (alpm_initialize () == -1)
+	  {
+	    pk_backend_error_code (backend, 
+				 PK_ERROR_ENUM_INTERNAL_ERROR,  
+				 "Failed to initialize package manager");
+	    pk_debug ("alpm: %s", alpm_strerror (pm_errno));
+	    //return;
+	  }
+	
+	if (alpm_parse_config ("/etc/pacman.conf", NULL, "") != 0)
+	  {
+	    pk_backend_error_code (backend, 
+				 PK_ERROR_ENUM_INTERNAL_ERROR,  
+				 "Failed to parse config file");
+	    pk_debug ("alpm: %s", alpm_strerror (pm_errno));
+	    backend_destroy (backend);
+	    return;
+	  }
+	
+
+	if (alpm_db_register ("local") == NULL)
+	  {
+	    pk_backend_error_code (backend, 
+				 PK_ERROR_ENUM_INTERNAL_ERROR,  
+				 "Failed to load local database");
+	    backend_destroy (backend);
+	    return;
+	  }
+	pk_debug ("alpm: ready to go");
+}
+
+/**
+ * backend_cancel_job_try:
+ */
+/*static void
+backend_cancel_job_try (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+}*/
+
+/**
+ * backend_get_depends:
+ */
+static void
+backend_get_depends (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 1, "glib2;2.14.0;i386;fedora",
+			 "The GLib library");
+	pk_backend_package (backend, 1, "gtk2;gtk2-2.11.6-6.fc8;i386;fedora",
+			 "GTK+ Libraries for GIMP");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_get_description:
+ */
+static void
+backend_get_description (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_description (backend, "gnome-power-manager;2.6.19;i386;fedora", PK_GROUP_ENUM_PROGRAMMING,
+"Scribus is an desktop open source page layout program with "
+"the aim of producing commercial grade output in PDF and "
+"Postscript, primarily, though not exclusively for Linux.\n"
+"\n"
+"While the goals of the program are for ease of use and simple easy to "
+"understand tools, Scribus offers support for professional publishing "
+"features, such as CMYK color, easy PDF creation, Encapsulated Postscript "
+"import/export and creation of color separations.", "http://live.gnome.org/GnomePowerManager");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_get_requires:
+ */
+static void
+backend_get_requires (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 1, "glib2;2.14.0;i386;fedora",
+			 "The GLib library");
+	pk_backend_package (backend, 1, "gtk2;gtk2-2.11.6-6.fc8;i386;fedora",
+			 "GTK+ Libraries for GIMP");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_get_updates:
+ */
+static void
+backend_get_updates (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 0, "powertop;1.8-1.fc8;i386;fedora",
+			 "Power consumption monitor");
+	pk_backend_package (backend, 1, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed",
+			 "The Linux kernel (the core of the Linux operating system)");
+	pk_backend_package (backend, 1, "gtkhtml2;2.19.1-4.fc8;i386;fedora", "An HTML widget for GTK+ 2.0");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+static gboolean
+backend_install_timeout (gpointer data)
+{
+	PkBackend *backend = (PkBackend *) data;
+	if (progress_percentage == 100) {
+		pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+		return FALSE;
+	}
+	if (progress_percentage == 50) {
+		pk_backend_change_job_status (backend, PK_STATUS_ENUM_INSTALL);
+	}
+	progress_percentage += 10;
+	pk_backend_change_percentage (backend, progress_percentage);
+	return TRUE;
+}
+
+/**
+ * backend_install_package:
+ */
+static void
+backend_install_package (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	progress_percentage = 0;
+	g_timeout_add (1000, backend_install_timeout, backend);
+}
+
+/**
+ * backend_refresh_cache:
+ */
+static void
+backend_refresh_cache (PkBackend *backend, gboolean force)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_remove_package:
+ */
+static void
+backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "No network connection available");
+	pk_backend_finished (backend, PK_EXIT_ENUM_FAILED);
+}
+
+/**
+ * backend_search_details:
+ */
+static void
+backend_search_details (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 0, "vips-doc;7.12.4-2.fc8;noarch;linva",
+			 "The vips documentation package.");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_search_file:
+ */
+static void
+backend_search_file (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 0, "vips-doc;7.12.4-2.fc8;noarch;linva",
+			 "The vips documentation package.");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_search_group:
+ */
+static void
+backend_search_group (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 0, "vips-doc;7.12.4-2.fc8;noarch;linva",
+			 "The vips documentation package.");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+/**
+ * backend_search_name_timeout:
+ **/
+gboolean
+backend_search_name_timeout (gpointer data)
+{
+	PkBackend *backend = (PkBackend *) data;
+	pk_backend_package (backend, 1, "evince;0.9.3-5.fc8;i386;installed",
+			 "PDF Document viewer");
+	pk_backend_package (backend, 1, "tetex;3.0-41.fc8;i386;fedora",
+			 "TeTeX is an implementation of TeX for Linux or UNIX systems.");
+	pk_backend_package (backend, 0, "scribus;1.3.4-1.fc8;i386;fedora",
+			 "Scribus is an desktop open source page layout program");
+	pk_backend_package (backend, 0, "vips-doc;7.12.4-2.fc8;noarch;linva",
+			 "The vips documentation package.");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+	return FALSE;
+}
+
+/**
+ * backend_search_name:
+ */
+static void
+backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_no_percentage_updates (backend);
+
+	gboolean installed = FALSE;
+	gboolean ninstalled = FALSE;
+	pmdb_t *localdb = NULL;
+	alpm_list_t *syncdbs = NULL;
+	gchar **sections = NULL;
+	alpm_list_t *needle = NULL;
+	alpm_list_t *localresult = NULL;
+
+	localdb = alpm_option_get_localdb ();
+	if (localdb == NULL)
+	  {
+	    pk_backend_finished (backend, PK_EXIT_ENUM_FAILED);
+	    return;
+	  }
+
+	sections = g_strsplit (filter, ";", 0);
+	int i = 0;
+	while (sections[i]) {
+	  if (strcmp(sections[i], "installed") == 0)
+	    {
+	      installed = FALSE;
+	    }
+	  if (strcmp(sections[i], "~installed") == 0)
+	    {
+	      ninstalled = FALSE;
+	    }
+
+	  i++;
+	}
+	g_strfreev (sections);
+
+	needle = alpm_list_add (NULL, (void *)search);
+
+	pk_debug ("alpm: searching for \"%s\" - filter installed: %i, ~installed: %i",
+		  (char *)needle->data, installed, ninstalled);
+
+	if (ninstalled)
+	  {
+	    syncdbs = alpm_option_get_syncdbs ();
+	    if (syncdbs != NULL && alpm_list_count (syncdbs) != 0)
+	      {
+		alpm_list_t *i;
+		localresult = alpm_db_search (localdb, needle);
+		for (i = syncdbs; i; i = alpm_list_next (i))
+		  {
+		    alpm_list_t *curresult = alpm_db_search ((pmdb_t *)syncdbs->data, needle);
+
+		    if (curresult != NULL && localresult != NULL)
+		      {
+			alpm_list_t *icmp;
+			alpm_list_t *icmp2;
+			for (icmp = curresult; icmp; icmp = alpm_list_next (icmp))
+			  {
+
+			    for (icmp2 = localresult; icmp2; icmp2 = alpm_list_next (icmp2))
+			      {
+				gboolean success = FALSE;
+				if (pkg_equal (icmp->data, icmp2->data))
+				  {
+				    if (installed)
+				      {
+					success = TRUE;
+					add_package (backend, (pmpkg_t *)icmp->data, (pmdb_t *)i->data, TRUE);
+					break;
+				      }
+				  }
+				if (success == FALSE)
+				  add_package (backend, (pmpkg_t *)icmp->data, (pmdb_t *)i->data, FALSE);
+			      }
+			  }
+			alpm_list_free (curresult);
+		      }
+		  }
+	      }
+	  }
+
+	if (installed && ninstalled)
+	  {
+	      {
+		pk_debug ("searching in local db");
+		alpm_list_t * localresult = alpm_db_search (localdb, needle);
+		//pk_debug (alpm_pkg_get_name (localresult->data));
+		pk_debug ("%i", (int)localresult);
+		add_packages_from_list (backend, localresult, localdb, TRUE);
+	      }
+	  }
+	pk_backend_finished  (backend, PK_EXIT_ENUM_SUCCESS); 
+}
+
+/**
+ * backend_update_package:
+ */
+static void
+backend_update_package (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_package (backend, 1, package_id, "The same thing");
+	pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+}
+
+static gboolean
+backend_update_system_timeout (gpointer data)
+{
+	PkBackend *backend = (PkBackend *) data;
+	if (progress_percentage == 100) {
+		pk_backend_finished (backend, PK_EXIT_ENUM_SUCCESS);
+		return FALSE;
+	}
+	pk_backend_change_job_status (backend, PK_STATUS_ENUM_UPDATE);
+	progress_percentage += 10;
+	pk_backend_change_percentage (backend, progress_percentage);
+	return TRUE;
+}
+
+/**
+ * backend_update_system:
+ */
+static void
+backend_update_system (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_change_job_status (backend, PK_STATUS_ENUM_DOWNLOAD);
+	progress_percentage = 0;
+	pk_backend_require_restart (backend, PK_RESTART_ENUM_SYSTEM, NULL);
+	g_timeout_add (1000, backend_update_system_timeout, backend);
+}
+
+PK_BACKEND_OPTIONS (
+	"alpm backend",					/* description */
+	"0.0.1",					/* version */
+	"Andreas Obergrusberger <tradiaz at yahoo.de>",	/* author */
+	backend_initalize,				/* initalize */
+	backend_destroy,				/* destroy */
+	NULL,						/* get_groups */
+	NULL,						/* get_filters */
+	NULL,						/* cancel_job_try */
+ 	backend_get_depends,				/* get_depends */
+	backend_get_description,			/* get_description */
+	backend_get_requires,				/* get_requires */
+	backend_get_updates,				/* get_updates */
+	backend_install_package,			/* install_package */
+	backend_refresh_cache,				/* refresh_cache */
+	backend_remove_package,				/* remove_package */
+	backend_search_details,				/* search_details */
+	backend_search_file,				/* search_file */
+	backend_search_group,				/* search_group */
+	backend_search_name,				/* search_name */
+	backend_update_package,				/* update_package */
+	backend_update_system				/* update_system */
+);
+
diff --git a/configure.ac b/configure.ac
index dc5ddc3..2e1b896 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,13 +184,15 @@ AC_MSG_RESULT(yes)
 dnl ---------------------------------------------------------------------------
 dnl - Compile time default choice of backend
 dnl ---------------------------------------------------------------------------
-AC_ARG_WITH([default_backend],
+AC_ARG_WITH([backend],
 	    AS_HELP_STRING([--with-default-backend=<option>],
-			   [Default backend to use dummy,apt,yum,conary,box (dummy)]))
+			   [Default backend to use dummy,apt,yum,conary (dummy)]))
 # default to a sane option for the installed tool
 if test x$with_default_backend = x; then
     if test -f /usr/bin/yum ; then
         with_default_backend=yum
+#    elif test -f /usr/lib/libalpm.so; then
+#	with_default_backend=alpm
     elif test -f /usr/bin/apt-get ; then
         with_default_backend=apt
     elif test -f /usr/bin/conary ; then
@@ -249,7 +251,7 @@ AC_DEFUN([APT_BACKEND],
  	fi
 ])
 
-if test x$with_default_backend = xapt; then
+if test x$with_backend = xapt; then
    
    AC_ARG_WITH(libapt-pkg-lib,
      AC_HELP_STRING([--with-libapt-pkg-lib=DIR],[look for the libapt-pkg library in DIR]),
@@ -315,22 +317,32 @@ if test x$with_default_backend = xapt; t
     AC_SUBST(APT_PKG_TYPE)
 fi
 
-if test x$with_default_backend = xbox; then
+if test x$with_backend = xbox; then
 	PKG_CHECK_MODULES(BOX, libbox)
 	AC_SUBST(BOX_CFLAGS)
 	AC_SUBST(BOX_LIBS)
 fi
 
+if test x$with_backend = xalpm; then
+    with_backend=dummy
+    AC_MSG_WARN([The alpm backend doesn't work at all!])
+    AC_CHECK_HEADER([alpm.h],
+		    [with_backend=alpm],
+		    [AC_MSG_WARN([No alpm headers found - falling back to dummy backend])])
+fi
+    
+
 AC_SUBST(PK_CONF_DIR, "\$(sysconfdir)/PackageKit")
 AC_SUBST(PK_PLUGIN_DIR, "\$(libdir)/packagekit-backend")
 AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/libpackagekit $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS")
 AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS")
 
-AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_default_backend = xdummy], [using dummy backend])
-AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_default_backend = xapt], [using APT backend])
-AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$with_default_backend = xyum], [using YUM backend])
-AM_CONDITIONAL(BACKEND_TYPE_CONARY, [test x$with_default_backend = xconary], [using CONARY backend])
-AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$with_default_backend = xbox], [using BOX backend])
+AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_backend = xdummy], [using dummy backend])
+AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_backend = xapt], [using APT backend])
+AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$with_backend = xyum], [using YUM backend])
+AM_CONDITIONAL(BACKEND_TYPE_CONARY, [test x$with_backend = xconary], [using CONARY backend])
+AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$with_backend = xbox], [using BOX backend])
+AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$with_backend = xalpm], [using ALPM backend])
 
 
 dnl ---------------------------------------------------------------------------
@@ -343,6 +355,7 @@ etc/Makefile
 man/Makefile
 docs/Makefile
 backends/Makefile
+backends/alpm/Makefile
 backends/apt/Makefile
 backends/box/Makefile
 backends/box/helpers/Makefile



More information about the PackageKit mailing list