[packagekit] packagekit: Branch 'master' - 4 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Nov 19 10:20:44 PST 2007
backends/box/Makefile.am | 1
backends/box/helpers/Makefile.am | 18 -----
backends/box/helpers/install-file.sh | 15 ----
backends/box/helpers/install-package.sh | 15 ----
backends/box/helpers/update-package.sh | 15 ----
backends/box/helpers/update-system.sh | 14 ----
backends/box/pk-backend-box.c | 101 ++++++++++++++++++++++++++++----
src/pk-backend.c | 1
8 files changed, 91 insertions(+), 89 deletions(-)
New commits:
commit b1574fc6541bdc3e82e9c2debad565d4b3e14214
Merge: 2995b14... d12b503...
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date: Mon Nov 19 18:49:32 2007 +0000
Merge branch 'master' of git+ssh://kaliber@git.packagekit.org/srv/git/PackageKit
commit d12b50351646eb1afe0c52c665272f74b97b5320
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 19 17:42:42 2007 +0000
remember to unref the GBUS in the backend - should fix a segfault after a couple of transactions have been processed and the client exits
diff --git a/src/pk-backend.c b/src/pk-backend.c
index d770ba0..c5e4142 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1911,6 +1911,7 @@ pk_backend_finalize (GObject *object)
pk_inhibit_remove (backend->priv->inhibit, backend);
g_object_unref (backend->priv->time);
g_object_unref (backend->priv->inhibit);
+ g_object_unref (backend->priv->libgbus);
g_object_unref (backend->priv->network);
g_object_unref (backend->priv->thread_list);
commit 2995b14192d6540026c07f084146ac5cc7e824e0
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date: Sat Nov 17 20:52:19 2007 +0000
[box] removed last helper, use C implementation
diff --git a/backends/box/Makefile.am b/backends/box/Makefile.am
index f657b0d..7e96eb7 100644
--- a/backends/box/Makefile.am
+++ b/backends/box/Makefile.am
@@ -1,4 +1,3 @@
-SUBDIRS = helpers
plugindir = @PK_PLUGIN_DIR@
plugin_LTLIBRARIES = libpk_backend_box.la
libpk_backend_box_la_SOURCES = pk-backend-box.c
diff --git a/backends/box/helpers/Makefile.am b/backends/box/helpers/Makefile.am
deleted file mode 100644
index aeef0ff..0000000
--- a/backends/box/helpers/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-
-helperdir = $(datadir)/PackageKit/helpers/box
-
-NULL =
-
-dist_helper_DATA = \
- update-system.sh \
- $(NULL)
-
-install-data-hook:
- chmod a+rx $(DESTDIR)$(helperdir)/*.sh
-
-clean-local :
- rm -f *~
-
diff --git a/backends/box/helpers/update-system.sh b/backends/box/helpers/update-system.sh
deleted file mode 100644
index bb4700e..0000000
--- a/backends/box/helpers/update-system.sh
+++ /dev/null
@@ -1,14 +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.
-
-echo "no-percentage-updates" > /dev/stderr
-echo "status update" > /dev/stderr
-box --upgrade-dist 2>&1 >/dev/null
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 39a3b0b..7fe9580 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -275,6 +275,16 @@ backend_get_updates_thread (PkBackend *backend, gpointer data)
}
static gboolean
+backend_update_system_thread (PkBackend *backend, gpointer data)
+{
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+
+ box_upgrade_dist("/", common_progress, backend);
+
+ return TRUE;
+}
+
+static gboolean
backend_install_package_thread (PkBackend *backend, gpointer data)
{
ThreadData *d = (ThreadData*) data;
@@ -753,7 +763,7 @@ static void
backend_update_system (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "update-system.sh", NULL);
+ pk_backend_thread_helper (backend, backend_update_system_thread, NULL);
}
/**
commit d43b45bd3afc79d7da955c75ea41639540dee38d
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date: Sat Nov 17 18:19:26 2007 +0000
[box] implemented package installation in C
diff --git a/backends/box/helpers/Makefile.am b/backends/box/helpers/Makefile.am
index 0e8bed1..aeef0ff 100644
--- a/backends/box/helpers/Makefile.am
+++ b/backends/box/helpers/Makefile.am
@@ -4,9 +4,6 @@ helperdir = $(datadir)/PackageKit/helpers/box
NULL =
dist_helper_DATA = \
- install-file.sh \
- install-package.sh \
- update-package.sh \
update-system.sh \
$(NULL)
diff --git a/backends/box/helpers/install-file.sh b/backends/box/helpers/install-file.sh
deleted file mode 100644
index 3f77679..0000000
--- a/backends/box/helpers/install-file.sh
+++ /dev/null
@@ -1,15 +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.
-
-echo "no-percentage-updates" > /dev/stderr
-echo "status install" > /dev/stderr
-pkg=$(echo "$1" | cut -f1 -d';')
-box -i "$pkg" 2>&1 >/dev/null
diff --git a/backends/box/helpers/install-package.sh b/backends/box/helpers/install-package.sh
deleted file mode 100644
index 3f77679..0000000
--- a/backends/box/helpers/install-package.sh
+++ /dev/null
@@ -1,15 +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.
-
-echo "no-percentage-updates" > /dev/stderr
-echo "status install" > /dev/stderr
-pkg=$(echo "$1" | cut -f1 -d';')
-box -i "$pkg" 2>&1 >/dev/null
diff --git a/backends/box/helpers/update-package.sh b/backends/box/helpers/update-package.sh
deleted file mode 100644
index 913b69e..0000000
--- a/backends/box/helpers/update-package.sh
+++ /dev/null
@@ -1,15 +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.
-
-echo "no-percentage-updates" > /dev/stderr
-echo "status update" > /dev/stderr
-pkg=$(echo "$1" | cut -f1 -d';')
-box -i "$pkg" 2>&1 >/dev/null
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 48ff087..39a3b0b 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -81,6 +81,12 @@ db_close(sqlite3 *db)
box_db_close(db);
}
+static void
+common_progress(int value, gpointer user_data)
+{
+ PkBackend* backend = (PkBackend *) user_data;
+ pk_backend_change_percentage (backend, value);
+}
static void
add_packages_from_list (PkBackend *backend, GList *list, gboolean updates)
@@ -269,6 +275,49 @@ backend_get_updates_thread (PkBackend *backend, gpointer data)
}
static gboolean
+backend_install_package_thread (PkBackend *backend, gpointer data)
+{
+ ThreadData *d = (ThreadData*) data;
+ gboolean result;
+ PkPackageId *pi;
+
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+
+ pi = pk_package_id_new_from_string (d->package_id);
+ if (pi == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
+ pk_package_id_free (pi);
+ g_free (d->package_id);
+ g_free (d);
+
+ return FALSE;
+ }
+ result = box_package_install(pi->name, "/", common_progress, backend);
+
+ g_free (d->package_id);
+ g_free (d);
+
+ return result;
+}
+
+
+static gboolean
+backend_install_file_thread (PkBackend *backend, gpointer data)
+{
+ ThreadData *d = (ThreadData*) data;
+ gboolean result;
+
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+
+ result = box_package_install_file(d->package_id, "/", common_progress, backend);
+
+ g_free (d->package_id);
+ g_free (d);
+
+ return result;
+}
+
+static gboolean
backend_get_description_thread (PkBackend *backend, gpointer data)
{
PkPackageId *pi;
@@ -391,13 +440,6 @@ backend_get_depends_requires_thread (PkBackend *backend, gpointer data)
return TRUE;
}
-static void
-common_progress(int value, gpointer user_data)
-{
- PkBackend* backend = (PkBackend *) user_data;
- pk_backend_change_percentage (backend, value);
-}
-
static gboolean
backend_remove_package_thread (PkBackend *backend, gpointer data)
{
@@ -565,6 +607,8 @@ backend_get_updates (PkBackend *backend)
static void
backend_install_package (PkBackend *backend, const gchar *package_id)
{
+ ThreadData *data = g_new0(ThreadData, 1);
+
g_return_if_fail (backend != NULL);
/* check network state */
if (pk_backend_network_is_online (backend) == FALSE) {
@@ -572,7 +616,14 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
pk_backend_finished (backend);
return;
}
- pk_backend_spawn_helper (backend, "install-package.sh", package_id, NULL);
+
+ if (data == NULL) {
+ pk_backend_error_code(backend, PK_ERROR_ENUM_OOM, "Failed to allocate memory");
+ pk_backend_finished (backend);
+ } else {
+ data->package_id = g_strdup(package_id);
+ pk_backend_thread_helper (backend, backend_install_package_thread, data);
+ }
}
/**
@@ -581,8 +632,17 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
static void
backend_install_file (PkBackend *backend, const gchar *file)
{
+ ThreadData *data = g_new0(ThreadData, 1);
+
g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "install-file.sh", file, NULL);
+
+ if (data == NULL) {
+ pk_backend_error_code(backend, PK_ERROR_ENUM_OOM, "Failed to allocate memory");
+ pk_backend_finished (backend);
+ } else {
+ data->package_id = g_strdup(file);
+ pk_backend_thread_helper (backend, backend_install_file_thread, data);
+ }
}
/**
@@ -667,6 +727,8 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
static void
backend_update_package (PkBackend *backend, const gchar *package_id)
{
+ ThreadData *data = g_new0(ThreadData, 1);
+
g_return_if_fail (backend != NULL);
/* check network state */
if (pk_backend_network_is_online (backend) == FALSE) {
@@ -674,7 +736,14 @@ backend_update_package (PkBackend *backend, const gchar *package_id)
pk_backend_finished (backend);
return;
}
- pk_backend_spawn_helper (backend, "update-package.sh", package_id, NULL);
+
+ if (data == NULL) {
+ pk_backend_error_code(backend, PK_ERROR_ENUM_OOM, "Failed to allocate memory");
+ pk_backend_finished (backend);
+ } else {
+ data->package_id = g_strdup(package_id);
+ pk_backend_thread_helper (backend, backend_install_package_thread, data);
+ }
}
/**
More information about the PackageKit
mailing list