[packagekit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Jan 2 09:58:57 PST 2008
backends/Makefile.am | 4
backends/ipkg/.gitignore | 10 +
backends/ipkg/Makefile.am | 8 +
backends/ipkg/pk-backend-ipkg.c | 195 +++++++++++++++++++++++++++++++++++++
backends/yum/helpers/yumBackend.py | 9 +
configure.ac | 11 +-
libpackagekit/pk-enum.c | 1
libpackagekit/pk-enum.h | 1
src/pk-backend.c | 3
9 files changed, 238 insertions(+), 4 deletions(-)
New commits:
commit 61ab9fde0c5d91548638c4f0c61c298133be32de
Author: Tim Lauridsen <tim at naboo.local>
Date: Wed Jan 2 18:39:10 2008 +0100
yum: Added reboot notification patch by Matthias Clasen
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 2f80bf6..0bd34dd 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -857,7 +857,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
print pkg.name,txmbr.output_state
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
if (pkg.name in self.rebootpkgs or (notice and
- notice.has_key('reboot_suggested') and notice['reboot_suggested']))\
+ notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']))\
and txmbr.ts_state in TS_INSTALL_STATES:
self.require_restart(RESTART_SYSTEM,"")
break
@@ -1073,7 +1073,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if notice:
desc = notice['description']
url = notice['references']
- reboot = notice['reboot_suggested']
+ if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
+ reboot = 'system'
+ else:
+ reboot = 'none'
return desc.replace('\n',';'),url,reboot
return "","",""
commit 95776ed1b135aef1e258ed4916156acde8619e11
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Wed Jan 2 16:12:03 2008 +0200
Add .gitignore to ipkg backend
diff --git a/backends/ipkg/.gitignore b/backends/ipkg/.gitignore
new file mode 100644
index 0000000..c851833
--- /dev/null
+++ b/backends/ipkg/.gitignore
@@ -0,0 +1,10 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.la
+*.lo
+*.loT
+*.o
+*~
+
commit 24cc7f0604ec6f1f348821faa490f790a56f8279
Author: Thomas Wood <thomas at openedhand.com>
Date: Wed Jan 2 12:05:10 2008 +0000
Add initial ipkg backend
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 63df794..289caf1 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -16,6 +16,10 @@ if BACKEND_TYPE_CONARY
SUBDIRS += conary
endif
+if BACKEND_TYPE_IPKG
+SUBDIRS += ipkg
+endif
+
if BACKEND_TYPE_SMART
SUBDIRS += smart
endif
diff --git a/backends/ipkg/Makefile.am b/backends/ipkg/Makefile.am
new file mode 100644
index 0000000..c2f8254
--- /dev/null
+++ b/backends/ipkg/Makefile.am
@@ -0,0 +1,8 @@
+plugindir = @PK_PLUGIN_DIR@
+plugin_LTLIBRARIES = libpk_backend_ipkg.la
+libpk_backend_ipkg_la_SOURCES = pk-backend-ipkg.c
+libpk_backend_ipkg_la_LIBADD = @PK_PLUGIN_LIBS@ $(IPKG_LIBS)
+
+libpk_backend_ipkg_la_LDFLAGS = -module -avoid-version
+libpk_backend_ipkg_la_CFLAGS = @PK_PLUGIN_CFLAGS@ $(IPKG_CFLAGS)
+
diff --git a/backends/ipkg/pk-backend-ipkg.c b/backends/ipkg/pk-backend-ipkg.c
new file mode 100644
index 0000000..78ac977
--- /dev/null
+++ b/backends/ipkg/pk-backend-ipkg.c
@@ -0,0 +1,195 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ * vi: set noexpandtab sts=8 sw=8:
+ *
+ * Copyright (C) 2007 OpenMoko, Inc
+ *
+ * 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.
+ */
+
+#include <gmodule.h>
+#include <glib.h>
+#include <string.h>
+#include <pk-backend.h>
+
+
+#define IPKG_LIB
+#include <libipkg.h>
+
+/* global config structures */
+static ipkg_conf_t global_conf;
+static args_t args;
+
+int
+ipkg_debug (ipkg_conf_t *conf, message_level_t level, char *msg)
+{
+ if (level == 0)
+ printf ("IPKG <%d>: %s", level, msg);
+ return 0;
+}
+
+/**
+ * backend_initalize:
+ */
+static void
+backend_initalize (PkBackend *backend)
+{
+ int err;
+ g_return_if_fail (backend != NULL);
+
+ memset(&global_conf, 0 ,sizeof(global_conf));
+ memset(&args, 0 ,sizeof(args));
+
+ args_init (&args);
+
+ /* testing only */
+ args.offline_root = "/home/thomas/chroots/openmoko/";
+ args.noaction = 1;
+
+
+ err = ipkg_conf_init (&global_conf, &args);
+ if (err) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, "init failed");
+ }
+ args_deinit (&args);
+}
+
+/**
+ * backend_destroy:
+ */
+static void
+backend_destroy (PkBackend *backend)
+{
+ ipkg_conf_deinit (&global_conf);
+ g_return_if_fail (backend != NULL);
+}
+
+/**
+ * backend_get_description:
+ */
+static void
+backend_get_description (PkBackend *backend, const gchar *package_id)
+{
+ pkg_t *pkg;
+ PkPackageId *pi;
+ g_return_if_fail (backend != NULL);
+
+ pi = pk_package_id_new_from_string (package_id);
+ pkg = pkg_hash_fetch_by_name_version (&global_conf.pkg_hash, pi->name, pi->version);
+
+ pk_backend_description (backend, pi->name,
+ "unknown", PK_GROUP_ENUM_OTHER, pkg->description, pkg->url, 0, NULL);
+
+ pk_backend_finished (backend);
+}
+
+/**
+ * backend_refresh_cache:
+ */
+static void
+backend_refresh_cache (PkBackend *backend, gboolean force)
+{
+ int ret;
+ g_return_if_fail (backend != NULL);
+ pk_backend_no_percentage_updates (backend);
+
+ ipkg_cb_message = ipkg_debug;
+
+ ret = ipkg_lists_update (&args);
+ if (ret) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, "update failed");
+ }
+ pk_backend_finished (backend);
+}
+
+/**
+ * backend_search_name:
+ */
+static gboolean
+backend_search_name_thread (PkBackend *backend, gchar *search)
+{
+ int i;
+ pkg_vec_t *available;
+ pkg_t *pkg;
+
+ g_return_val_if_fail ((search), FALSE);
+
+ ipkg_cb_message = ipkg_debug;
+
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_no_percentage_updates (backend);
+
+ available = pkg_vec_alloc();
+ pkg_hash_fetch_available (&global_conf.pkg_hash, available);
+ for (i=0; i < available->len; i++) {
+ char *uid;
+ pkg = available->pkgs[i];
+ if (g_strrstr (pkg->name, search)) {
+ uid = g_strdup_printf ("%s;%s;%s;",
+ pkg->name, pkg->version, pkg->architecture);
+
+ pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE, uid,pkg->description);
+ }
+ }
+
+ pkg_vec_free(available);
+ pk_backend_finished (backend);
+
+ g_free (search);
+ return TRUE;
+}
+
+static void
+backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+ g_return_if_fail (backend != NULL);
+ char *foo = g_strdup (search);
+
+ pk_backend_thread_create (backend,(PkBackendThreadFunc) backend_search_name_thread, foo);
+}
+
+
+PK_BACKEND_OPTIONS (
+ "ipkg", /* description */
+ "Thomas Wood <thomas at openedhand.com>", /* author */
+ backend_initalize, /* initalize */
+ backend_destroy, /* destroy */
+ NULL, /* get_groups */
+ NULL, /* get_filters */
+ NULL, /* cancel */
+ NULL, /* get_depends */
+ backend_get_description, /* get_description */
+ NULL, /* get_files */
+ NULL, /* get_requires */
+ NULL, /* get_update_detail */
+ NULL, /* get_updates */
+ NULL, /* install_package */
+ NULL, /* install_file */
+ backend_refresh_cache, /* refresh_cache */
+ NULL, /* remove_package */
+ NULL, /* resolve */
+ NULL, /* rollback */
+ NULL, /* search_details */
+ NULL, /* search_file */
+ NULL, /* search_group */
+ backend_search_name, /* search_name */
+ NULL, /* update_package */
+ NULL, /* update_system */
+ NULL, /* get_repo_list */
+ NULL, /* repo_enable */
+ NULL /* repo_set_data */
+);
+
diff --git a/configure.ac b/configure.ac
index e66e874..9e4a5f1 100755
--- a/configure.ac
+++ b/configure.ac
@@ -264,7 +264,8 @@ dnl - Compile time default choice of backend
dnl ---------------------------------------------------------------------------
AC_ARG_WITH([default_backend],
AS_HELP_STRING([--with-default-backend=<option>],
- [Default backend to use alpm,apt,box,conary,dummy,smart,yum,pisi,zypp (dummy)]))
+ [Default backend to use
+ alpm,apt,box,conary,dummy,smart,yum,pisi,zypp,ipkg (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
@@ -423,6 +424,12 @@ if test x$with_default_backend = xbox; then
AC_SUBST(BOX_LIBS)
fi
+if test x$with_default_backend = xipkg; then
+ PKG_CHECK_MODULES(IPKG, libipkg)
+ AC_SUBST(IPKG_CFLAGS)
+ AC_SUBST(IPKG_LIBS)
+fi
+
if test x$with_default_backend = xalpm; then
with_default_backend=dummy
AC_MSG_WARN([The alpm backend doesn't work at all!])
@@ -448,6 +455,7 @@ AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_default_backend = xapt], [using AP
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_IPKG, [test x$with_default_backend = xipkg], [using IPKG backend])
AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$with_default_backend = xalpm], [using ALPM backend])
AM_CONDITIONAL(BACKEND_TYPE_SMART, [test x$with_default_backend = xsmart], [using SMART backend])
AM_CONDITIONAL(BACKEND_TYPE_PISI, [test x$with_default_backend = xpisi], [using PiSi backend])
@@ -480,6 +488,7 @@ backends/box/Makefile
backends/conary/Makefile
backends/conary/helpers/Makefile
backends/dummy/Makefile
+backends/ipkg/Makefile
backends/smart/Makefile
backends/smart/helpers/Makefile
backends/test/Makefile
commit a8200f3cc8cc56679c696b7fa61ffb4465def2b5
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Wed Jan 2 10:20:33 2008 +0100
yum: added fix to updates metadata init by Matthias Clasen
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index f89f95a..2f80bf6 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1059,7 +1059,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self._updateMetadata = UpdateMetadata()
for repo in self.yumbase.repos.listEnabled():
try:
- md.add(repo)
+ self._updateMetadata.add(repo)
except:
pass # No updateinfo.xml.gz in repo
return self._updateMetadata
commit 71e9d18673b73c91b62b910b6c761e9c265eaaa9
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 15:50:25 2007 +0000
add another enum PK_STATUS_ENUM_FINISHED in case we are just watching status
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 7e941f6..ad30443 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -64,6 +64,7 @@ static PkEnumMatch enum_status[] = {
{PK_STATUS_ENUM_ROLLBACK, "rollback"},
{PK_STATUS_ENUM_COMMIT, "commit"},
{PK_STATUS_ENUM_REQUEST, "request"},
+ {PK_STATUS_ENUM_FINISHED, "finished"},
{0, NULL},
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 63b9ec3..01821b4 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -96,6 +96,7 @@ typedef enum {
PK_STATUS_ENUM_ROLLBACK,
PK_STATUS_ENUM_COMMIT,
PK_STATUS_ENUM_REQUEST,
+ PK_STATUS_ENUM_FINISHED,
PK_STATUS_ENUM_UNKNOWN
} PkStatusEnum;
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 97fe5cd..cbf6cb6 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1149,6 +1149,9 @@ pk_backend_finished (PkBackend *backend)
pk_warning ("GUI will remain unchanged!");
}
+ /* mark as finished for the UI that might only be watching status */
+ pk_backend_change_status (backend, PK_STATUS_ENUM_FINISHED);
+
/* we can't ever be re-used */
backend->priv->finished = TRUE;
More information about the PackageKit
mailing list