[packagekit] packagekit: Branch 'master' - 4 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Feb 18 16:27:55 PST 2008
backends/alpm/pk-backend-alpm.c | 3 -
backends/apt/pk-backend-apt.c | 3 -
backends/apt2/pk-backend-apt2.c | 3 -
backends/box/pk-backend-box.c | 3 -
backends/conary/pk-backend-conary.c | 3 -
backends/dummy/pk-backend-dummy.c | 14 +++++
backends/opkg/pk-backend-opkg.c | 3 -
backends/pisi/pk-backend-pisi.c | 3 -
backends/smart/pk-backend-smart.c | 3 -
backends/test/pk-backend-test-dbus.c | 3 -
backends/test/pk-backend-test-fail.c | 3 -
backends/test/pk-backend-test-nop.c | 3 -
backends/test/pk-backend-test-spawn.c | 3 -
backends/test/pk-backend-test-succeed.c | 13 ++++-
backends/test/pk-backend-test-thread.c | 3 -
backends/yum/pk-backend-yum.c | 3 -
backends/yum2/pk-backend-yum2.c | 3 -
client/pk-console.c | 8 +++
docs/api/Makefile.am | 47 ++++++++++---------
docs/html/pk-faq.html | 59 ++++++++++++------------
libpackagekit/pk-client.c | 78 ++++++++++++++++++++++++++++++++
libpackagekit/pk-client.h | 2
libpackagekit/pk-enum.c | 1
libpackagekit/pk-enum.h | 1
policy/packagekit.policy | 9 +++
python/packagekit/backend.py | 8 +++
python/packagekit/daemonBackend.py | 11 ++++
python/packagekit/frontend.py | 9 +++
src/pk-backend-dbus.c | 29 +++++++++++
src/pk-backend-dbus.h | 2
src/pk-backend.c | 2
src/pk-backend.h | 6 +-
src/pk-engine.c | 53 +++++++++++++++++++++
src/pk-engine.h | 4 +
src/pk-interface.xml | 5 ++
src/pk-runner.c | 20 ++++++++
src/pk-runner.h | 2
src/pk-security-polkit.c | 2
38 files changed, 360 insertions(+), 70 deletions(-)
New commits:
commit 3f95d3f3aafd9076efdc0a07490b5b977207c719
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 19 00:24:12 2008 +0000
update the list of methods and filters in the html docs
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 299ca3f..e91270d 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -24,40 +24,43 @@
<pre>
| conary | yum | apt | box | alpm | smart | pisi | zypp |
---------------------------------------------------------------------------
-resolve | X | X | | X | | X | X | X |
-refresh-cache | X | X | X | X | | X | X | |
- \--force | | | | | | | | |
-get-updates | X | X | | X | | X | X | |
-update-system | X | X | | X | | X | X | |
-search-name | X | X | X | X | X | X | X | X |
-search-details | | X | X | X | | X | X | |
-search-file | | X | | X | | | X | |
-search-group | | X | | | | | X | |
-install-package | X | X | | X | X | X | X | X |
-install-file | | X | | X | | X | X | |
-remove-package | X | X | | X | X | X | X | |
-update-package | X | X | | X | | X | X | |
-get-depends | | X | | X | | X | X | |
- \--recursive | | | | | | | | |
-get-requires | X | X | | X | | | X | |
- \--recursive | | | | | | | | |
-get-description | X | X | X | X | | X | X | |
-get-files | X | X | | X | | X | X | |
-get-update-detail | | X | | | | | | |
-get-repo-list | | X | | X | X | X | X | X |
-repo-enable | | X | | X | | X | | X |
-repo-set-data | | X | | X | | | X | |
-cancel-transaction| X | X | | | | | X | |
+Resolve | X | X | | X | | X | X | X |
+RefreshCache | X | X | X | X | | X | X | |
+ \Force | | | | | | | | |
+GetUpdates | X | X | | X | | X | X | |
+UpdateSystem | X | X | | X | | X | X | |
+SearchName | X | X | X | X | X | X | X | X |
+SearchDetails | | X | X | X | | X | X | |
+SearchFile | | X | | X | | | X | |
+SearchGroup | | X | | | | | X | |
+InstallPackage | X | X | | X | X | X | X | X |
+InstallFile | | X | | X | | X | X | |
+RemovePackage | X | X | | X | X | X | X | |
+UpdatePackage | X | X | | X | | X | X | |
+GetDepends | | X | | X | | X | X | |
+ \Recursive | | | | | | | | |
+GetRequires | X | X | | X | | | X | |
+ \Recursive | | | | | | | | |
+GetDescription | X | X | X | X | | X | X | |
+GetFiles | X | X | | X | | X | X | |
+GetUpdateDetail | | X | | | | | | |
+GetRepoList | | X | | X | X | X | X | X |
+RepoEnable | | X | | X | | X | | X |
+RepoSetData | | X | | X | | | X | |
+Cancel | X | X | | | | | X | |
+ServicePack | | | | | | | | |
</pre>
<h4>Filters</h4>
<pre>
| conary | yum | apt | box | alpm | smart | pisi | zypp |
---------------------------------------------------------------------------
-installed | X | X | X | X | X | X | X | |
-development | | X | X | X | | | | |
-gui | | X | X | X | | | X | |
-free | | | | | | | | |
+Installed | X | X | X | X | X | X | X | |
+Development | | X | X | X | | | | |
+GUI | | X | X | X | | | X | |
+Free | | | | | | | | |
+Visible | | | | | | | | |
+Supported | | | | | | | | |
</pre>
<h3>Why doesn't PackageKit work with SELinux?</h3>
commit 361bec7f7c2c7abf8110fd1cbc16bef1b1be78af
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 19 00:14:01 2008 +0000
add the ServicePack functionality
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 81b5197..666aa36 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -805,6 +805,7 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
backend_get_repo_list, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 51d80b9..7086833 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -270,5 +270,6 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/apt2/pk-backend-apt2.c b/backends/apt2/pk-backend-apt2.c
index e04381c..2b695f2 100644
--- a/backends/apt2/pk-backend-apt2.c
+++ b/backends/apt2/pk-backend-apt2.c
@@ -277,5 +277,6 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 6930de1..b438be7 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -914,6 +914,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
backend_repo_enable, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 6c67d04..8411674 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -408,6 +408,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 376998f..eadc4af 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -550,6 +550,17 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
pk_backend_finished (backend);
}
+/**
+ * backend_service_pack:
+ */
+static void
+backend_service_pack (PkBackend *backend, const gchar *location)
+{
+ g_return_if_fail (backend != NULL);
+ pk_warning ("service pack on %s device", location);
+ pk_backend_finished (backend);
+}
+
PK_BACKEND_OPTIONS (
"Dummy", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
@@ -578,6 +589,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
backend_repo_enable, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ backend_service_pack /* service_pack */
);
diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c
index 4d7ee0e..b9f398c 100644
--- a/backends/opkg/pk-backend-opkg.c
+++ b/backends/opkg/pk-backend-opkg.c
@@ -938,6 +938,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index ce971e7..1b918ce 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -378,6 +378,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
NULL, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 91e88f8..5428048 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -52,5 +52,6 @@ PK_BACKEND_OPTIONS (
pk_backend_python_update_system, /* update_system */
pk_backend_python_get_repo_list, /* get_repo_list */
pk_backend_python_repo_enable, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c
index f5433a5..8b0b75f 100644
--- a/backends/test/pk-backend-test-dbus.c
+++ b/backends/test/pk-backend-test-dbus.c
@@ -95,6 +95,7 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index 39c18a9..2600aba 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -298,6 +298,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index 5b0b814..8338e2a 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -51,6 +51,7 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 7b7e157..bfbc364 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -92,6 +92,7 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index 5b52ecb..2fb7d74 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -305,6 +305,16 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
pk_backend_finished (backend);
}
+/**
+ * backend_service_pack:
+ */
+static void
+backend_service_pack (PkBackend *backend, const gchar *location)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_finished (backend);
+}
+
PK_BACKEND_OPTIONS (
"Test Succeed", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
@@ -333,6 +343,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
backend_repo_enable, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ backend_service_pack /* service_pack */
);
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index 398f41a..be426c3 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -159,6 +159,7 @@ PK_BACKEND_OPTIONS (
NULL, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
- NULL /* repo_set_data */
+ NULL, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index b858e30..b428c51 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -400,6 +400,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
backend_repo_enable, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/backends/yum2/pk-backend-yum2.c b/backends/yum2/pk-backend-yum2.c
index 9dea670..ee05197 100644
--- a/backends/yum2/pk-backend-yum2.c
+++ b/backends/yum2/pk-backend-yum2.c
@@ -387,6 +387,7 @@ PK_BACKEND_OPTIONS (
backend_update_system, /* update_system */
backend_get_repo_list, /* get_repo_list */
backend_repo_enable, /* repo_enable */
- backend_repo_set_data /* repo_set_data */
+ backend_repo_set_data, /* repo_set_data */
+ NULL /* service_pack */
);
diff --git a/client/pk-console.c b/client/pk-console.c
index 3ae61a2..dbb3ced 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -332,6 +332,7 @@ const gchar *summary =
" search name|details|group|file data\n"
" install <package_id>\n"
" install-file <file>\n"
+ " service-pack <location>\n"
" remove <package_id>\n"
" update <package_id>\n"
" refresh\n"
@@ -763,6 +764,13 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
} else {
wait = pk_client_install_file (client, value);
}
+ } else if (strcmp (mode, "service-pack") == 0) {
+ if (value == NULL) {
+ g_set_error (error, 0, 0, "you need to specify a location to update from");
+ return FALSE;
+ } else {
+ wait = pk_client_service_pack (client, value);
+ }
} else if (strcmp (mode, "remove") == 0) {
if (value == NULL) {
g_set_error (error, 0, 0, "you need to specify a package to remove");
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index baac616..3437f8f 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -2163,6 +2163,82 @@ pk_client_install_file (PkClient *client, const gchar *file)
return ret;
}
+
+/**
+ * pk_client_service_pack_action:
+ **/
+gboolean
+pk_client_service_pack_action (PkClient *client, const gchar *location, GError **error)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+ *error = NULL;
+ ret = dbus_g_proxy_call (client->priv->proxy, "ServicePack", error,
+ G_TYPE_STRING, client->priv->tid,
+ G_TYPE_STRING, location,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (ret == FALSE) {
+ /* abort as the DBUS method failed */
+ pk_warning ("ServicePack failed!");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * pk_client_service_pack:
+ **/
+gboolean
+pk_client_service_pack (PkClient *client, const gchar *location)
+{
+ gboolean ret;
+ GError *error;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+ /* check to see if we already have a transaction */
+ ret = pk_client_allocate_transaction_id (client);
+ if (ret == FALSE) {
+ pk_warning ("Failed to get transaction ID");
+ return FALSE;
+ }
+ /* save this so we can re-issue it */
+ client->priv->role = PK_ROLE_ENUM_SERVICE_PACK;
+ client->priv->xcached_full_path = g_strdup (location);
+
+ /* hopefully do the operation first time */
+ ret = pk_client_service_pack_action (client, location, &error);
+
+ /* we were refused by policy then try to get auth */
+ if (ret == FALSE) {
+ if (pk_polkit_client_error_denied_by_policy (error) == TRUE) {
+ /* retry the action if we succeeded */
+ if (pk_polkit_client_gain_privilege_str (client->priv->polkit, error->message) == TRUE) {
+ pk_debug ("gained priv");
+ g_error_free (error);
+ /* do it all over again */
+ ret = pk_client_service_pack_action (client, location, &error);
+ }
+ }
+ if (error != NULL) {
+ pk_debug ("ERROR: %s", error->message);
+ g_error_free (error);
+ }
+ }
+
+ /* spin until finished */
+ if (ret == TRUE && client->priv->synchronous == TRUE) {
+ g_main_loop_run (client->priv->loop);
+ }
+
+ return ret;
+}
+
/**
* pk_client_get_repo_list:
*/
@@ -2679,6 +2755,8 @@ pk_client_requeue (PkClient *client)
pk_client_install_package (client, client->priv->xcached_package_id);
} else if (client->priv->role == PK_ROLE_ENUM_INSTALL_FILE) {
pk_client_install_file (client, client->priv->xcached_full_path);
+ } else if (client->priv->role == PK_ROLE_ENUM_SERVICE_PACK) {
+ pk_client_service_pack (client, client->priv->xcached_full_path);
} else if (client->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
pk_client_refresh_cache (client, client->priv->xcached_force);
} else if (client->priv->role == PK_ROLE_ENUM_REMOVE_PACKAGE) {
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index ce74548..9013e17 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -128,6 +128,8 @@ gboolean pk_client_update_package (PkClient *client,
const gchar *package_id);
gboolean pk_client_install_file (PkClient *client,
const gchar *full_path);
+gboolean pk_client_service_pack (PkClient *client,
+ const gchar *location);
gboolean pk_client_resolve (PkClient *client,
const gchar *filter,
const gchar *package);
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index e89479f..2c89798 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -93,6 +93,7 @@ static PkEnumMatch enum_role[] = {
{PK_ROLE_ENUM_GET_REPO_LIST, "get-repo-list"},
{PK_ROLE_ENUM_REPO_ENABLE, "repo-enable"},
{PK_ROLE_ENUM_REPO_SET_DATA, "repo-set-data"},
+ {PK_ROLE_ENUM_SERVICE_PACK, "service-pack"},
{0, NULL},
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index b9c7f9d..b13a9ae 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -68,6 +68,7 @@ typedef enum {
PK_ROLE_ENUM_GET_REPO_LIST,
PK_ROLE_ENUM_REPO_ENABLE,
PK_ROLE_ENUM_REPO_SET_DATA,
+ PK_ROLE_ENUM_SERVICE_PACK,
PK_ROLE_ENUM_UNKNOWN
} PkRoleEnum;
diff --git a/policy/packagekit.policy b/policy/packagekit.policy
index 05e76fa..7662a05 100755
--- a/policy/packagekit.policy
+++ b/policy/packagekit.policy
@@ -27,6 +27,15 @@ Copyright (c) 2007 Richard Hughes <richard at hughsie.com>
</defaults>
</action>
+ <action id="org.freedesktop.packagekit.service-pack">
+ <description>Update from service pack</description>
+ <message>System policy prevents updating from service pack</message>
+ <defaults>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_admin</allow_active>
+ </defaults>
+ </action>
+
<action id="org.freedesktop.packagekit.update-package">
<description>Update package</description>
<message>System policy prevents updating package</message>
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 94e1f8f..931a272 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -336,6 +336,14 @@ class PackageKitBaseBackend:
'''
self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ def service_pack (self, location):
+ '''
+ Implement the {backend}-service-pack functionality
+ Update the computer from a service pack in location
+ Needed to be implemented in a sub class
+ '''
+ self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+
def resolve(self, name):
'''
Implement the {backend}-resolve functionality
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 404ee29..f369aa2 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -307,6 +307,17 @@ class PackageKitBaseBackend(dbus.service.Object):
#
# @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
# in_signature='s', out_signature='')
+# def ServicePack (self, location):
+# '''
+# Implement the {backend}-service-pack functionality
+# Install the package containing the inst_file file
+# Needed to be implemented in a sub class
+# '''
+# self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
+# self.Exit()
+#
+# @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+# in_signature='s', out_signature='')
# def UpdatePackage(self, package):
# '''
# Implement the {backend}-update functionality
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 8897916..a094f07 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -310,6 +310,15 @@ class PackageKit(PackageKitDbusInterface):
"""
return self.pk_iface.InstallFile(self.tid(),full_path)
+ @dbusException
+ @job_id
+ def ServicePack(self,location):
+ """
+ Updates a service pack from a location
+ Asynchronous
+ """
+ return self.pk_iface.ServicePack(self.tid(),location)
+
## Do things or query transactions
@dbusException
@job_id
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 582f58d..ae80095 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -1038,6 +1038,35 @@ pk_backend_dbus_install_file (PkBackendDbus *backend_dbus, const gchar *full_pat
}
/**
+ * pk_backend_dbus_service_pack:
+ **/
+gboolean
+pk_backend_dbus_service_pack (PkBackendDbus *backend_dbus, const gchar *location)
+{
+ DBusGProxyCall *call;
+
+ g_return_val_if_fail (backend_dbus != NULL, FALSE);
+ g_return_val_if_fail (location != NULL, FALSE);
+
+ /* lock the backend */
+ pk_backend_dbus_lock (backend_dbus);
+
+ /* do the action */
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "ServicePack",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, location,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ /* unlock the backend if we failed */
+ if (call == NULL) {
+ pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
* pk_backend_dbus_finalize:
**/
static void
diff --git a/src/pk-backend-dbus.h b/src/pk-backend-dbus.h
index 58bc25d..6d9b6aa 100644
--- a/src/pk-backend-dbus.h
+++ b/src/pk-backend-dbus.h
@@ -105,6 +105,8 @@ gboolean pk_backend_dbus_update_package (PkBackendDbus *backend_dbus,
const gchar *package_id);
gboolean pk_backend_dbus_install_file (PkBackendDbus *backend_dbus,
const gchar *full_path);
+gboolean pk_backend_dbus_service_pack (PkBackendDbus *backend_dbus,
+ const gchar *location);
gboolean pk_backend_dbus_kill (PkBackendDbus *backend_dbus);
gboolean pk_backend_dbus_repo_enable (PkBackendDbus *backend_dbus,
const gchar *rid,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 11cfefa..e9d787a 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -146,7 +146,8 @@ typedef struct {
void (*get_repo_list) (PkBackend *backend);
void (*repo_enable) (PkBackend *backend, const gchar *repo_id, gboolean enabled);
void (*repo_set_data) (PkBackend *backend, const gchar *repo_id, const gchar *parameter, const gchar *value);
- gpointer padding[12];
+ void (*service_pack) (PkBackend *backend, const gchar *location);
+ gpointer padding[11];
} PkBackendDesc;
#define PK_BACKEND_OPTIONS(description, author, initialize, destroy, \
@@ -154,7 +155,7 @@ typedef struct {
get_requires, get_update_detail, get_updates, install_package, install_file, \
refresh_cache, remove_package, resolve, rollback, search_details, \
search_file, search_group, search_name, update_package, update_system, \
- get_repo_list, repo_enable, repo_set_data) \
+ get_repo_list, repo_enable, repo_set_data, service_pack) \
G_MODULE_EXPORT const PkBackendDesc pk_backend_desc = { \
description, \
author, \
@@ -184,6 +185,7 @@ typedef struct {
get_repo_list, \
repo_enable, \
repo_set_data, \
+ service_pack, \
{0} \
}
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 3faca0a..4d98b3d 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1880,6 +1880,59 @@ pk_engine_install_file (PkEngine *engine, const gchar *tid, const gchar *full_pa
}
/**
+ * pk_engine_service_pack:
+ **/
+void
+pk_engine_service_pack (PkEngine *engine, const gchar *tid, const gchar *location,
+ DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ PkTransactionItem *item;
+ GError *error;
+ gchar *sender;
+
+ g_return_if_fail (engine != NULL);
+ g_return_if_fail (PK_IS_ENGINE (engine));
+
+ pk_debug ("ServicePack method called: %s, %s", tid, location);
+
+ /* find pre-requested transaction id */
+ item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
+ if (item == NULL) {
+ error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
+ "transaction_id '%s' not found", tid);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ /* check if the action is allowed from this client - if not, set an error */
+ sender = dbus_g_method_get_sender (context);
+ ret = pk_engine_action_is_allowed (engine, sender, PK_ROLE_ENUM_SERVICE_PACK, &error);
+ g_free (sender);
+ if (ret == FALSE) {
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ /* create a new runner object */
+ item->runner = pk_engine_runner_new (engine);
+
+ /* set the dbus name, so we can get the disconnect */
+ pk_runner_set_dbus_name (item->runner, dbus_g_method_get_sender (context));
+
+ ret = pk_runner_service_pack (item->runner, location);
+ if (ret == FALSE) {
+ error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
+ "Operation not yet supported by backend");
+ pk_engine_item_delete (engine, item);
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+ pk_engine_item_commit (engine, item);
+ dbus_g_method_return (context);
+}
+
+/**
* pk_engine_rollback:
**/
void
diff --git a/src/pk-engine.h b/src/pk-engine.h
index c57da71..1bc8227 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -156,6 +156,10 @@ void pk_engine_install_file (PkEngine *engine,
const gchar *tid,
const gchar *full_path,
DBusGMethodInvocation *context);
+void pk_engine_service_pack (PkEngine *engine,
+ const gchar *tid,
+ const gchar *location,
+ DBusGMethodInvocation *context);
void pk_engine_update_package (PkEngine *engine,
const gchar *tid,
const gchar *package_id,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 265ec24..220b1f6 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -102,6 +102,11 @@
<arg type="s" name="tid" direction="in"/>
<arg type="s" name="full_path" direction="in"/>
</method>
+ <method name="ServicePack">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="tid" direction="in"/>
+ <arg type="s" name="location" direction="in"/>
+ </method>
<!-- signals emitted from any transaction -->
<signal name="StatusChanged">
diff --git a/src/pk-runner.c b/src/pk-runner.c
index b838599..f8ff1a4 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -310,6 +310,9 @@ pk_runner_set_running (PkRunner *runner)
} else if (runner->priv->role == PK_ROLE_ENUM_INSTALL_FILE) {
desc->install_file (runner->priv->backend,
runner->priv->cached_full_path);
+ } else if (runner->priv->role == PK_ROLE_ENUM_SERVICE_PACK) {
+ desc->service_pack (runner->priv->backend,
+ runner->priv->cached_full_path);
} else if (runner->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
desc->refresh_cache (runner->priv->backend,
runner->priv->cached_force);
@@ -494,6 +497,23 @@ pk_runner_install_file (PkRunner *runner, const gchar *full_path)
}
/**
+ * pk_runner_service_pack:
+ */
+gboolean
+pk_runner_service_pack (PkRunner *runner, const gchar *location)
+{
+ g_return_val_if_fail (runner != NULL, FALSE);
+ if (runner->priv->backend->desc->service_pack == NULL) {
+ pk_debug ("Not implemented yet: ServicePack");
+ return FALSE;
+ }
+ runner->priv->cached_full_path = g_strdup (location);
+ runner->priv->status = PK_STATUS_ENUM_WAIT;
+ pk_runner_set_role (runner, PK_ROLE_ENUM_SERVICE_PACK);
+ return TRUE;
+}
+
+/**
* pk_runner_refresh_cache:
*/
gboolean
diff --git a/src/pk-runner.h b/src/pk-runner.h
index fe09c6e..f8bea82 100644
--- a/src/pk-runner.h
+++ b/src/pk-runner.h
@@ -72,6 +72,8 @@ gboolean pk_runner_install_package (PkRunner *runner,
const gchar *package_id);
gboolean pk_runner_install_file (PkRunner *runner,
const gchar *full_path);
+gboolean pk_runner_service_pack (PkRunner *runner,
+ const gchar *location);
gboolean pk_runner_refresh_cache (PkRunner *runner,
gboolean force);
gboolean pk_runner_remove_package (PkRunner *runner,
diff --git a/src/pk-security-polkit.c b/src/pk-security-polkit.c
index c540ce6..fd558ed 100644
--- a/src/pk-security-polkit.c
+++ b/src/pk-security-polkit.c
@@ -114,6 +114,8 @@ pk_security_role_to_action (PkSecurity *security, PkRoleEnum role)
policy = "org.freedesktop.packagekit.install";
} else if (role == PK_ROLE_ENUM_INSTALL_FILE) {
policy = "org.freedesktop.packagekit.localinstall";
+ } else if (role == PK_ROLE_ENUM_SERVICE_PACK) {
+ policy = "org.freedesktop.packagekit.service-pack";
} else if (role == PK_ROLE_ENUM_ROLLBACK) {
policy = "org.freedesktop.packagekit.rollback";
} else if (role == PK_ROLE_ENUM_REPO_ENABLE ||
commit aaeedec1cd7947e7fe7a388d31e596c9d33b1b1e
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 18 23:12:20 2008 +0000
make Makefile pretty for gtk-doc
diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am
index 5854381..f0048c0 100644
--- a/docs/api/Makefile.am
+++ b/docs/api/Makefile.am
@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in
+NULL =
+
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
@@ -34,9 +36,10 @@ HFILE_GLOB=$(top_srcdir)/libpackagekit/*.h
CFILE_GLOB=$(top_srcdir)/libpackagekit/*.c
# Header files to ignore when scanning.
-IGNORE_HFILES = \
- config.h \
- pk-marshal.h
+IGNORE_HFILES = \
+ config.h \
+ pk-marshal.h \
+ $(NULL)
# Images to copy into HTML directory.
HTML_IMAGES=
@@ -51,25 +54,25 @@ expand_content_files=
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
-INCLUDES = \
- $(POLKIT_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(GLIB_CFLAGS) \
- -I$(top_builddir)/libpackagekit \
- -I$(top_srcdir)/libpackagekit \
- -I$(top_srcdir)/libselftest \
- -I$(top_srcdir)/libgbus
-
-PK_LIBS = \
- $(top_builddir)/libpackagekit/libpackagekit.la
-
-GTKDOC_LIBS = \
- $(GLIB_LIBS) \
- $(DBUS_LIBS) \
- $(SQLITE_LIBS) \
- $(PK_LIBS) \
- $(POLKIT_LIBS)
-
+INCLUDES = \
+ $(POLKIT_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ -I$(top_builddir)/libpackagekit \
+ -I$(top_srcdir)/libpackagekit \
+ -I$(top_srcdir)/libselftest \
+ -I$(top_srcdir)/libgbus \
+ $(NULL)
+
+PK_LIBS = $(top_builddir)/libpackagekit/libpackagekit.la
+
+GTKDOC_LIBS = \
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(SQLITE_LIBS) \
+ $(PK_LIBS) \
+ $(POLKIT_LIBS) \
+ $(NULL)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
commit 20bc49a350e564c75f294ec403aa22ec481f3b3b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 18 22:29:46 2008 +0000
make pk_backend_build_library_path static, we don't use it outside of PkBackend
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 42f5ad2..1410f12 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -93,7 +93,7 @@ static guint signals [PK_BACKEND_LAST_SIGNAL] = { 0, };
/**
* pk_backend_build_library_path:
**/
-gchar *
+static gchar *
pk_backend_build_library_path (PkBackend *backend)
{
gchar *path;
More information about the PackageKit
mailing list