[packagekit] packagekit: Branch 'master' - 11 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Oct 29 00:47:53 PDT 2007
backends/alpm/pk-backend-alpm.c | 1
backends/apt/pk-backend-apt.c | 1
backends/box/pk-backend-box.c | 1
backends/conary/pk-backend-conary.c | 1
backends/dummy/pk-backend-dummy.c | 12 +++
backends/pisi/pk-backend-pisi.c | 1
backends/smart/pk-backend-smart.c | 1
backends/test/pk-backend-test-fail.c | 11 +++
backends/test/pk-backend-test-nop.c | 1
backends/test/pk-backend-test-spawn.c | 1
backends/test/pk-backend-test-succeed.c | 11 +++
backends/test/pk-backend-test-thread.c | 1
backends/yum/helpers/get-files.py | 19 +++++
backends/yum/helpers/yumBackend.py | 15 ++++
backends/yum/pk-backend-yum.c | 1
client/pk-console.c | 62 ++++++++++++++++++-
contrib/pk-completion.bash | 1
docs/pk-backends.xml | 9 ++
docs/pk-introduction.xml | 34 ++++++++++
html/pk-faq.html | 1
libpackagekit/pk-client.c | 103 +++++++++++++++++++++++++++++---
libpackagekit/pk-client.h | 2
libpackagekit/pk-enum.c | 89 +++++++++++++--------------
libpackagekit/pk-enum.h | 12 +++
python/packagekit/backend.py | 14 ++++
src/pk-backend-internal.h | 2
src/pk-backend-python.c | 10 +++
src/pk-backend-python.h | 3
src/pk-backend.c | 65 ++++++++++++++++++--
src/pk-backend.h | 7 +-
src/pk-engine.c | 103 +++++++++++++++++++++++++++++---
src/pk-engine.h | 4 +
src/pk-interface.xml | 8 ++
src/pk-marshal.list | 4 -
34 files changed, 537 insertions(+), 74 deletions(-)
New commits:
commit 7da142d66e32f8c0abeb020426ca11236c3ebf14
Merge: 681e997... e53a908...
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sun Oct 28 22:12:48 2007 -0400
Merge branch 'get-files'
commit e53a90842ce6e964bb5c5ff57b75f03a53f44fd4
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sat Oct 27 22:06:39 2007 -0400
yum: Implement get-files.
diff --git a/backends/yum/helpers/get-files.py b/backends/yum/helpers/get-files.py
new file mode 100755
index 0000000..92a8e0d
--- /dev/null
+++ b/backends/yum/helpers/get-files.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+# Copyright (C) 2007 James Bowes <jbowes at dangerouslyinc.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.
+
+import sys
+
+from yumBackend import PackageKitYumBackend
+package = sys.argv[1]
+backend = PackageKitYumBackend(sys.argv[1:])
+backend.get_files(package)
+sys.exit(0)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index e65bcbe..8acf9ab 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -694,6 +694,21 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+ def get_files(self, package):
+ self.allow_interrupt(True)
+ self.percentage(None)
+
+ pkg,inst = self._findPackage(package)
+ if pkg:
+ files = pkg.returnFileEntries('dir')
+ files.extend(pkg.returnFileEntries()) # regular files
+
+ file_list = ";".join(files)
+
+ self.files(package, file_list)
+ else:
+ self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+
def _show_package(self,pkg,status):
''' Show info about package'''
pkgver = self._get_package_ver(pkg)
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 5f3c08e..3919fed 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -61,7 +61,7 @@ PK_BACKEND_OPTIONS (
pk_backend_python_cancel, /* cancel */
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
- NULL, /* get_files */
+ pk_backend_python_get_files, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index f666b68..83c1f9f 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -40,7 +40,7 @@ update-package | | X | | X | | X | X |
get-depends | | X | | X | | | X |
get-requires | X | | | X | | | X |
get-description | X | X | X | X | | X | X |
-get-files | | | | | | | |
+get-files | | X | | | | | |
get-update-detail | | | | | | | |
get-repo-list | | X | | X | X | X | X |
repo-enable | | X | | X | | X | |
commit dd96d4b6dd7928196c657f35829f86f0d23fe8ad
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sat Oct 27 22:06:02 2007 -0400
Add GetFiles helper code for python backends.
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index a288a84..97233af 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -166,6 +166,13 @@ class PackageKitBaseBackend:
'''
print >> sys.stdout,"description\t%s\t%s\t%s\t%s\t%s\t%ld\t%s" % (id,licence,group,desc,url,bytes,file_list)
+ def files(self, id, file_list):
+ '''
+ Send 'files' signal
+ @param file_list: List of the files in the package, separated by ';'
+ '''
+ print >> sys.stdout,"files\t%s\t%s" % (id, file_list)
+
def update_detail(self,id,updates,obsoletes,url,restart,update_text):
'''
Send 'updatedetail' signal
@@ -330,6 +337,13 @@ class PackageKitBaseBackend:
'''
self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ def get_files(self, package):
+ '''
+ Implement the {backend}-get-files functionality
+ Needed to be implemented in a sub class
+ '''
+ self.error(ERROR_NOT_SUPPORTED, "This function is not implemented in this backend")
+
def get_updates(self, package):
'''
Implement the {backend}-get-updates functionality
diff --git a/src/pk-backend-python.c b/src/pk-backend-python.c
index da53c5d..f55dfce 100644
--- a/src/pk-backend-python.c
+++ b/src/pk-backend-python.c
@@ -53,6 +53,16 @@ pk_backend_python_get_description (PkBackend *backend, const gchar *package_id)
}
/**
+ * pk_backend_python_get_files:
+ */
+void
+pk_backend_python_get_files (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-files.py", package_id, NULL);
+}
+
+/**
* pk_backend_python_get_requires:
*/
void
diff --git a/src/pk-backend-python.h b/src/pk-backend-python.h
index a9901f9..23e7c8c 100644
--- a/src/pk-backend-python.h
+++ b/src/pk-backend-python.h
@@ -34,6 +34,9 @@ void pk_backend_python_get_depends (PkBackend *backend,
void pk_backend_python_get_description (PkBackend *backend,
const gchar *package_id);
+void pk_backend_python_get_files (PkBackend *backend,
+ const gchar *package_id);
+
void pk_backend_python_get_requires (PkBackend *backend,
const gchar *package_id);
commit 3d5088448af8e3733dfa2c63768c98e1aea06cb9
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sat Oct 27 17:24:58 2007 -0400
documentation: add GetFiles.
diff --git a/docs/pk-backends.xml b/docs/pk-backends.xml
index 4f1f9d4..5182653 100644
--- a/docs/pk-backends.xml
+++ b/docs/pk-backends.xml
@@ -91,6 +91,10 @@
<entry><literal>get-description.*</literal></entry>
</row>
<row>
+ <entry>Get Files</entry>
+ <entry><literal>get-files.*</literal></entry>
+ </row>
+ <row>
<entry>Update Package</entry>
<entry><literal>update.*</literal></entry>
</row>
@@ -187,6 +191,11 @@
<entry><literal>stdout</literal></entry>
</row>
<row>
+ <entry>Files</entry>
+ <entry><literal>files[tab]package_id[tab]file_list</literal></entry>
+ <entry><literal>stdout</literal></entry>
+ </row>
+ <row>
<entry>UpdateDetail</entry>
<entry><literal>package_id[tab]updates[tab]obsoletes[tab]url[tab]restart[tab]update_text</literal></entry>
<entry><literal>stdout</literal></entry>
diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index 658fecd..1a5058b 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -1056,6 +1056,40 @@
</para>
</sect2>
+ <sect2 id="api-get-files">
+ <title>Get Files</title>
+ <para>
+ GetFiles should return the file list of that
+ <literal>package_id</literal>.
+ </para>
+ <para>
+ The arguments are:
+ </para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Option</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>package_id</literal></entry>
+ <entry>A single, valid, package ID.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ <para>
+ This method typically emits
+ <literal>Progress</literal>,
+ <literal>Status</literal> and
+ <literal>Error</literal> and
+ <literal>Files</literal>.
+ </para>
+ </sect2>
+
<sect2 id="api-update">
<title>Update Package</title>
<para>
diff --git a/html/pk-faq.html b/html/pk-faq.html
index da5372d..f666b68 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -40,6 +40,7 @@ update-package | | X | | X | | X | X |
get-depends | | X | | X | | | X |
get-requires | X | | | X | | | X |
get-description | X | X | X | X | | X | X |
+get-files | | | | | | | |
get-update-detail | | | | | | | |
get-repo-list | | X | | X | X | X | X |
repo-enable | | X | | X | | X | |
commit 9f8a716ab7b936d25f38e428cf15ead8e0c84c95
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sat Oct 27 17:19:31 2007 -0400
completion: Support 'get files'.
diff --git a/contrib/pk-completion.bash b/contrib/pk-completion.bash
index b2f4b53..a962a62 100755
--- a/contrib/pk-completion.bash
+++ b/contrib/pk-completion.bash
@@ -88,6 +88,7 @@ _pkcon_get ()
depends
requires
description
+ files
updatedetail
actions
groups
commit f6d04d164021cb7d98e52a6c7259f302d1b1aeaf
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sun Oct 28 19:30:40 2007 -0400
Don't send the filelist over dbus in Description
diff --git a/client/pk-console.c b/client/pk-console.c
index 56645fa..49e01a6 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -804,7 +804,7 @@ static void
pk_console_description_cb (PkClient *client, const gchar *package_id,
const gchar *licence, PkGroupEnum group,
const gchar *description, const gchar *url,
- gulong size, const gchar *filelist, gpointer data)
+ gulong size, gpointer data)
{
/* if on console, clear the progress bar line */
if (is_console == TRUE && printed_bar == TRUE) {
@@ -816,8 +816,6 @@ pk_console_description_cb (PkClient *client, const gchar *package_id,
g_print (" group: '%s'\n", pk_group_enum_to_text (group));
g_print (" description: '%s'\n", description);
g_print (" size: '%ld' bytes\n", size);
- /* filelist is probably too long to just dump to the screen */
- /* g_print (" files: '%s'\n", filelist); */
g_print (" url: '%s'\n", url);
}
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 12e8fdb..cc4cb49 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -468,7 +468,6 @@ pk_client_description_cb (DBusGProxy *proxy,
const gchar *description,
const gchar *url,
guint64 size,
- const gchar *filelist,
PkClient *client)
{
PkGroupEnum group;
@@ -481,10 +480,10 @@ pk_client_description_cb (DBusGProxy *proxy,
}
group = pk_group_enum_from_text (group_text);
- pk_debug ("emit description %s, %s, %i, %s, %s, %ld, %s",
- package_id, licence, group, description, url, (long int) size, filelist);
+ pk_debug ("emit description %s, %s, %i, %s, %s, %ld",
+ package_id, licence, group, description, url, (long int) size);
g_signal_emit (client , signals [PK_CLIENT_DESCRIPTION], 0,
- package_id, licence, group, description, url, size, filelist);
+ package_id, licence, group, description, url, size);
}
/**
@@ -2298,9 +2297,9 @@ pk_client_class_init (PkClientClass *klass)
signals [PK_CLIENT_DESCRIPTION] =
g_signal_new ("description",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64_STRING,
- G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64,
+ G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_UINT64);
signals [PK_CLIENT_FILES] =
g_signal_new ("files",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -2433,10 +2432,10 @@ pk_client_init (PkClient *client)
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* Description */
- dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64_STRING,
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64,
- G_TYPE_STRING, G_TYPE_INVALID);
+ G_TYPE_INVALID);
/* Files */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING,
@@ -2505,7 +2504,7 @@ pk_client_init (PkClient *client)
dbus_g_proxy_add_signal (proxy, "Description",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64,
- G_TYPE_STRING, G_TYPE_INVALID);
+ G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "Description",
G_CALLBACK (pk_client_description_cb), client, NULL);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 76bc4c8..da49896 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -868,12 +868,12 @@ pk_backend_description (PkBackend *backend, const gchar *package_id,
/* replace unsafe chars */
description_safe = pk_string_replace_unsafe (description);
- pk_debug ("emit description %s, %s, %i, %s, %s, %ld, %s",
+ pk_debug ("emit description %s, %s, %i, %s, %s, %ld",
package_id, licence, group, description_safe, url,
- size, filelist);
+ size);
g_signal_emit (backend, signals [PK_BACKEND_DESCRIPTION], 0,
package_id, licence, group, description_safe, url,
- size, filelist);
+ size);
g_free (description_safe);
return TRUE;
}
@@ -1825,9 +1825,9 @@ pk_backend_class_init (PkBackendClass *klass)
signals [PK_BACKEND_DESCRIPTION] =
g_signal_new ("description",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64_STRING,
- G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_UINT64, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64,
+ G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_UINT64);
signals [PK_BACKEND_FILES] =
g_signal_new ("files",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 32589a7..63d49b0 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -432,7 +432,7 @@ pk_engine_require_restart_cb (PkBackend *backend, PkRestartEnum restart, const g
static void
pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gchar *licence, PkGroupEnum group,
const gchar *detail, const gchar *url,
- guint64 size, const gchar *filelist, PkEngine *engine)
+ guint64 size, PkEngine *engine)
{
PkTransactionItem *item;
const gchar *group_text;
@@ -447,10 +447,10 @@ pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gch
}
group_text = pk_group_enum_to_text (group);
- pk_debug ("emitting description tid:%s, %s, %s, %s, %s, %s, %ld, %s",
- item->tid, package_id, licence, group_text, detail, url, (long int) size, filelist);
+ pk_debug ("emitting description tid:%s, %s, %s, %s, %s, %s, %ld",
+ item->tid, package_id, licence, group_text, detail, url, (long int) size);
g_signal_emit (engine, signals [PK_ENGINE_DESCRIPTION], 0,
- item->tid, package_id, licence, group_text, detail, url, size, filelist);
+ item->tid, package_id, licence, group_text, detail, url, size);
}
/**
@@ -2486,9 +2486,9 @@ pk_engine_class_init (PkEngineClass *klass)
signals [PK_ENGINE_DESCRIPTION] =
g_signal_new ("description",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64_STRING,
- G_TYPE_NONE, 8, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64,
+ G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64);
signals [PK_ENGINE_FILES] =
g_signal_new ("files",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index c6d0688..526ccc8 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -115,7 +115,6 @@
<arg type="s" name="detail" direction="out"/>
<arg type="s" name="url" direction="out"/>
<arg type="t" name="size" direction="out"/> <!-- size of package file in bytes -->
- <arg type="s" name="file_list" direction="out"/> <!-- list of files and dirs separated by ';' -->
</signal>
<signal name="Files">
<arg type="s" name="tid" direction="out"/>
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index d8ccd58..585636a 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -16,8 +16,8 @@ VOID:STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING
-VOID:STRING,STRING,UINT,STRING,STRING,UINT64,STRING
-VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT64,STRING
+VOID:STRING,STRING,UINT,STRING,STRING,UINT64
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT64
VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT
VOID:STRING,STRING,BOOL
VOID:STRING,STRING,STRING,BOOL
commit 681e997a61dd02dd89c37143deb94e77fa50f6f3
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 28 22:53:56 2007 +0000
make method names sane
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 72f2bc8..ce8f69c 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -176,10 +176,10 @@ static PkEnumMatch enum_sig_type[] = {
};
/**
- * pk_enum_enum_find_value:
+ * pk_enum_find_value:
*/
guint
-pk_enum_enum_find_value (PkEnumMatch *table, const gchar *string)
+pk_enum_find_value (PkEnumMatch *table, const gchar *string)
{
guint i;
const gchar *string_tmp;
@@ -201,10 +201,10 @@ pk_enum_enum_find_value (PkEnumMatch *table, const gchar *string)
}
/**
- * pk_enum_enum_find_string:
+ * pk_enum_find_string:
*/
const gchar *
-pk_enum_enum_find_string (PkEnumMatch *table, guint value)
+pk_enum_find_string (PkEnumMatch *table, guint value)
{
guint i;
guint tmp;
@@ -229,7 +229,7 @@ pk_enum_enum_find_string (PkEnumMatch *table, guint value)
PkSigTypeEnum
pk_sig_type_enum_from_text (const gchar *sig_type)
{
- return pk_enum_enum_find_value (enum_sig_type, sig_type);
+ return pk_enum_find_value (enum_sig_type, sig_type);
}
/**
@@ -238,7 +238,7 @@ pk_sig_type_enum_from_text (const gchar *sig_type)
const gchar *
pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
{
- return pk_enum_enum_find_string (enum_sig_type, sig_type);
+ return pk_enum_find_string (enum_sig_type, sig_type);
}
/**
@@ -247,7 +247,7 @@ pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
PkInfoEnum
pk_info_enum_from_text (const gchar *info)
{
- return pk_enum_enum_find_value (enum_info, info);
+ return pk_enum_find_value (enum_info, info);
}
/**
@@ -256,7 +256,7 @@ pk_info_enum_from_text (const gchar *info)
const gchar *
pk_info_enum_to_text (PkInfoEnum info)
{
- return pk_enum_enum_find_string (enum_info, info);
+ return pk_enum_find_string (enum_info, info);
}
/**
@@ -265,7 +265,7 @@ pk_info_enum_to_text (PkInfoEnum info)
PkExitEnum
pk_exit_enum_from_text (const gchar *exit)
{
- return pk_enum_enum_find_value (enum_exit, exit);
+ return pk_enum_find_value (enum_exit, exit);
}
/**
@@ -274,7 +274,7 @@ pk_exit_enum_from_text (const gchar *exit)
const gchar *
pk_exit_enum_to_text (PkExitEnum exit)
{
- return pk_enum_enum_find_string (enum_exit, exit);
+ return pk_enum_find_string (enum_exit, exit);
}
/**
@@ -283,7 +283,7 @@ pk_exit_enum_to_text (PkExitEnum exit)
PkStatusEnum
pk_status_enum_from_text (const gchar *status)
{
- return pk_enum_enum_find_value (enum_status, status);
+ return pk_enum_find_value (enum_status, status);
}
/**
@@ -292,7 +292,7 @@ pk_status_enum_from_text (const gchar *status)
const gchar *
pk_status_enum_to_text (PkStatusEnum status)
{
- return pk_enum_enum_find_string (enum_status, status);
+ return pk_enum_find_string (enum_status, status);
}
/**
@@ -301,7 +301,7 @@ pk_status_enum_to_text (PkStatusEnum status)
PkRoleEnum
pk_role_enum_from_text (const gchar *role)
{
- return pk_enum_enum_find_value (enum_role, role);
+ return pk_enum_find_value (enum_role, role);
}
/**
@@ -310,7 +310,7 @@ pk_role_enum_from_text (const gchar *role)
const gchar *
pk_role_enum_to_text (PkRoleEnum role)
{
- return pk_enum_enum_find_string (enum_role, role);
+ return pk_enum_find_string (enum_role, role);
}
/**
@@ -319,7 +319,7 @@ pk_role_enum_to_text (PkRoleEnum role)
PkErrorCodeEnum
pk_error_enum_from_text (const gchar *code)
{
- return pk_enum_enum_find_value (enum_error, code);
+ return pk_enum_find_value (enum_error, code);
}
/**
@@ -328,7 +328,7 @@ pk_error_enum_from_text (const gchar *code)
const gchar *
pk_error_enum_to_text (PkErrorCodeEnum code)
{
- return pk_enum_enum_find_string (enum_error, code);
+ return pk_enum_find_string (enum_error, code);
}
/**
@@ -337,7 +337,7 @@ pk_error_enum_to_text (PkErrorCodeEnum code)
PkRestartEnum
pk_restart_enum_from_text (const gchar *restart)
{
- return pk_enum_enum_find_value (enum_restart, restart);
+ return pk_enum_find_value (enum_restart, restart);
}
/**
@@ -346,7 +346,7 @@ pk_restart_enum_from_text (const gchar *restart)
const gchar *
pk_restart_enum_to_text (PkRestartEnum restart)
{
- return pk_enum_enum_find_string (enum_restart, restart);
+ return pk_enum_find_string (enum_restart, restart);
}
/**
@@ -355,7 +355,7 @@ pk_restart_enum_to_text (PkRestartEnum restart)
PkGroupEnum
pk_group_enum_from_text (const gchar *group)
{
- return pk_enum_enum_find_value (enum_group, group);
+ return pk_enum_find_value (enum_group, group);
}
/**
@@ -364,7 +364,7 @@ pk_group_enum_from_text (const gchar *group)
const gchar *
pk_group_enum_to_text (PkGroupEnum group)
{
- return pk_enum_enum_find_string (enum_group, group);
+ return pk_enum_find_string (enum_group, group);
}
/**
@@ -373,7 +373,7 @@ pk_group_enum_to_text (PkGroupEnum group)
PkFreqEnum
pk_freq_enum_from_text (const gchar *freq)
{
- return pk_enum_enum_find_value (enum_freq, freq);
+ return pk_enum_find_value (enum_freq, freq);
}
/**
@@ -382,7 +382,7 @@ pk_freq_enum_from_text (const gchar *freq)
const gchar *
pk_freq_enum_to_text (PkFreqEnum freq)
{
- return pk_enum_enum_find_string (enum_freq, freq);
+ return pk_enum_find_string (enum_freq, freq);
}
/**
@@ -391,7 +391,7 @@ pk_freq_enum_to_text (PkFreqEnum freq)
PkUpdateEnum
pk_update_enum_from_text (const gchar *update)
{
- return pk_enum_enum_find_value (enum_update, update);
+ return pk_enum_find_value (enum_update, update);
}
/**
@@ -400,7 +400,7 @@ pk_update_enum_from_text (const gchar *update)
const gchar *
pk_update_enum_to_text (PkUpdateEnum update)
{
- return pk_enum_enum_find_string (enum_update, update);
+ return pk_enum_find_string (enum_update, update);
}
/**
@@ -409,7 +409,7 @@ pk_update_enum_to_text (PkUpdateEnum update)
PkFilterEnum
pk_filter_enum_from_text (const gchar *filter)
{
- return pk_enum_enum_find_value (enum_filter, filter);
+ return pk_enum_find_value (enum_filter, filter);
}
/**
@@ -418,7 +418,7 @@ pk_filter_enum_from_text (const gchar *filter)
const gchar *
pk_filter_enum_to_text (PkFilterEnum filter)
{
- return pk_enum_enum_find_string (enum_filter, filter);
+ return pk_enum_find_string (enum_filter, filter);
}
/***************************************************************************
@@ -440,7 +440,7 @@ libst_enum (LibSelfTest *test)
/************************************************************/
libst_title (test, "find value");
- value = pk_enum_enum_find_value (enum_role, "search-file");
+ value = pk_enum_find_value (enum_role, "search-file");
if (PK_ROLE_ENUM_SEARCH_FILE) {
libst_success (test, NULL);
} else {
@@ -449,7 +449,7 @@ libst_enum (LibSelfTest *test)
/************************************************************/
libst_title (test, "find string");
- string = pk_enum_enum_find_string (enum_role, PK_ROLE_ENUM_SEARCH_FILE);
+ string = pk_enum_find_string (enum_role, PK_ROLE_ENUM_SEARCH_FILE);
if (strcmp (string, "search-file") == 0) {
libst_success (test, NULL);
} else {
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index d876442..cc61a09 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -169,9 +169,9 @@ typedef enum {
} PkSigTypeEnum;
/* general */
-guint pk_task_enum_find_value (PkEnumMatch *table,
+guint pk_enum_find_value (PkEnumMatch *table,
const gchar *string);
-const gchar *pk_task_enum_find_string (PkEnumMatch *table,
+const gchar *pk_enum_find_string (PkEnumMatch *table,
guint value);
PkSigTypeEnum pk_sig_type_enum_from_text (const gchar *sig_type);
commit 15dd3b61441720ebaa68c4ce2deb44bd317ed8be
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 28 22:50:23 2007 +0000
remove remnants of task from PkEnum
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 5c44f27..72f2bc8 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -30,7 +30,7 @@
#include "pk-debug.h"
#include "pk-enum.h"
-static PkEnumMatch task_exit[] = {
+static PkEnumMatch enum_exit[] = {
{PK_EXIT_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_EXIT_ENUM_SUCCESS, "success"},
{PK_EXIT_ENUM_FAILED, "failed"},
@@ -39,7 +39,7 @@ static PkEnumMatch task_exit[] = {
{0, NULL},
};
-static PkEnumMatch task_status[] = {
+static PkEnumMatch enum_status[] = {
{PK_STATUS_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_STATUS_ENUM_WAIT, "wait"},
{PK_STATUS_ENUM_SETUP, "setup"},
@@ -52,7 +52,7 @@ static PkEnumMatch task_status[] = {
{0, NULL},
};
-static PkEnumMatch task_role[] = {
+static PkEnumMatch enum_role[] = {
{PK_ROLE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_ROLE_ENUM_CANCEL, "cancel"},
{PK_ROLE_ENUM_RESOLVE, "resolve"},
@@ -78,7 +78,7 @@ static PkEnumMatch task_role[] = {
{0, NULL},
};
-static PkEnumMatch task_error[] = {
+static PkEnumMatch enum_error[] = {
{PK_ERROR_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_ERROR_ENUM_OOM, "out-of-memory"},
{PK_ERROR_ENUM_NO_CACHE, "no-cache"},
@@ -101,7 +101,7 @@ static PkEnumMatch task_error[] = {
{0, NULL},
};
-static PkEnumMatch task_restart[] = {
+static PkEnumMatch enum_restart[] = {
{PK_RESTART_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_RESTART_ENUM_NONE, "none"},
{PK_RESTART_ENUM_SYSTEM, "system"},
@@ -110,7 +110,7 @@ static PkEnumMatch task_restart[] = {
{0, NULL},
};
-static PkEnumMatch task_filter[] = {
+static PkEnumMatch enum_filter[] = {
{PK_FILTER_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_FILTER_ENUM_DEVELOPMENT, "devel"},
{PK_FILTER_ENUM_INSTALLED, "installed"},
@@ -121,7 +121,7 @@ static PkEnumMatch task_filter[] = {
{0, NULL},
};
-static PkEnumMatch task_group[] = {
+static PkEnumMatch enum_group[] = {
{PK_GROUP_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_GROUP_ENUM_ACCESSIBILITY, "accessibility"},
{PK_GROUP_ENUM_ACCESSORIES, "accessories"},
@@ -137,7 +137,7 @@ static PkEnumMatch task_group[] = {
{0, NULL},
};
-static PkEnumMatch task_freq[] = {
+static PkEnumMatch enum_freq[] = {
{PK_FREQ_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_FREQ_ENUM_HOURLY, "hourly"},
{PK_FREQ_ENUM_DAILY, "daily"},
@@ -146,7 +146,7 @@ static PkEnumMatch task_freq[] = {
{0, NULL},
};
-static PkEnumMatch task_update[] = {
+static PkEnumMatch enum_update[] = {
{PK_UPDATE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_UPDATE_ENUM_ALL, "all"},
{PK_UPDATE_ENUM_SECURITY, "security"},
@@ -154,7 +154,7 @@ static PkEnumMatch task_update[] = {
{0, NULL},
};
-static PkEnumMatch task_info[] = {
+static PkEnumMatch enum_info[] = {
{PK_INFO_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_INFO_ENUM_INSTALLED, "installed"},
{PK_INFO_ENUM_AVAILABLE, "available"},
@@ -169,17 +169,17 @@ static PkEnumMatch task_info[] = {
{0, NULL},
};
-static PkEnumMatch task_sig_type[] = {
+static PkEnumMatch enum_sig_type[] = {
{PK_SIGTYPE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_SIGTYPE_ENUM_GPG, "gpg"},
{0, NULL},
};
/**
- * pk_task_enum_find_value:
+ * pk_enum_enum_find_value:
*/
guint
-pk_task_enum_find_value (PkEnumMatch *table, const gchar *string)
+pk_enum_enum_find_value (PkEnumMatch *table, const gchar *string)
{
guint i;
const gchar *string_tmp;
@@ -201,10 +201,10 @@ pk_task_enum_find_value (PkEnumMatch *table, const gchar *string)
}
/**
- * pk_task_enum_find_string:
+ * pk_enum_enum_find_string:
*/
const gchar *
-pk_task_enum_find_string (PkEnumMatch *table, guint value)
+pk_enum_enum_find_string (PkEnumMatch *table, guint value)
{
guint i;
guint tmp;
@@ -229,7 +229,7 @@ pk_task_enum_find_string (PkEnumMatch *table, guint value)
PkSigTypeEnum
pk_sig_type_enum_from_text (const gchar *sig_type)
{
- return pk_task_enum_find_value (task_sig_type, sig_type);
+ return pk_enum_enum_find_value (enum_sig_type, sig_type);
}
/**
@@ -238,7 +238,7 @@ pk_sig_type_enum_from_text (const gchar *sig_type)
const gchar *
pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
{
- return pk_task_enum_find_string (task_sig_type, sig_type);
+ return pk_enum_enum_find_string (enum_sig_type, sig_type);
}
/**
@@ -247,7 +247,7 @@ pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
PkInfoEnum
pk_info_enum_from_text (const gchar *info)
{
- return pk_task_enum_find_value (task_info, info);
+ return pk_enum_enum_find_value (enum_info, info);
}
/**
@@ -256,7 +256,7 @@ pk_info_enum_from_text (const gchar *info)
const gchar *
pk_info_enum_to_text (PkInfoEnum info)
{
- return pk_task_enum_find_string (task_info, info);
+ return pk_enum_enum_find_string (enum_info, info);
}
/**
@@ -265,7 +265,7 @@ pk_info_enum_to_text (PkInfoEnum info)
PkExitEnum
pk_exit_enum_from_text (const gchar *exit)
{
- return pk_task_enum_find_value (task_exit, exit);
+ return pk_enum_enum_find_value (enum_exit, exit);
}
/**
@@ -274,7 +274,7 @@ pk_exit_enum_from_text (const gchar *exit)
const gchar *
pk_exit_enum_to_text (PkExitEnum exit)
{
- return pk_task_enum_find_string (task_exit, exit);
+ return pk_enum_enum_find_string (enum_exit, exit);
}
/**
@@ -283,7 +283,7 @@ pk_exit_enum_to_text (PkExitEnum exit)
PkStatusEnum
pk_status_enum_from_text (const gchar *status)
{
- return pk_task_enum_find_value (task_status, status);
+ return pk_enum_enum_find_value (enum_status, status);
}
/**
@@ -292,7 +292,7 @@ pk_status_enum_from_text (const gchar *status)
const gchar *
pk_status_enum_to_text (PkStatusEnum status)
{
- return pk_task_enum_find_string (task_status, status);
+ return pk_enum_enum_find_string (enum_status, status);
}
/**
@@ -301,7 +301,7 @@ pk_status_enum_to_text (PkStatusEnum status)
PkRoleEnum
pk_role_enum_from_text (const gchar *role)
{
- return pk_task_enum_find_value (task_role, role);
+ return pk_enum_enum_find_value (enum_role, role);
}
/**
@@ -310,7 +310,7 @@ pk_role_enum_from_text (const gchar *role)
const gchar *
pk_role_enum_to_text (PkRoleEnum role)
{
- return pk_task_enum_find_string (task_role, role);
+ return pk_enum_enum_find_string (enum_role, role);
}
/**
@@ -319,7 +319,7 @@ pk_role_enum_to_text (PkRoleEnum role)
PkErrorCodeEnum
pk_error_enum_from_text (const gchar *code)
{
- return pk_task_enum_find_value (task_error, code);
+ return pk_enum_enum_find_value (enum_error, code);
}
/**
@@ -328,7 +328,7 @@ pk_error_enum_from_text (const gchar *code)
const gchar *
pk_error_enum_to_text (PkErrorCodeEnum code)
{
- return pk_task_enum_find_string (task_error, code);
+ return pk_enum_enum_find_string (enum_error, code);
}
/**
@@ -337,7 +337,7 @@ pk_error_enum_to_text (PkErrorCodeEnum code)
PkRestartEnum
pk_restart_enum_from_text (const gchar *restart)
{
- return pk_task_enum_find_value (task_restart, restart);
+ return pk_enum_enum_find_value (enum_restart, restart);
}
/**
@@ -346,7 +346,7 @@ pk_restart_enum_from_text (const gchar *restart)
const gchar *
pk_restart_enum_to_text (PkRestartEnum restart)
{
- return pk_task_enum_find_string (task_restart, restart);
+ return pk_enum_enum_find_string (enum_restart, restart);
}
/**
@@ -355,7 +355,7 @@ pk_restart_enum_to_text (PkRestartEnum restart)
PkGroupEnum
pk_group_enum_from_text (const gchar *group)
{
- return pk_task_enum_find_value (task_group, group);
+ return pk_enum_enum_find_value (enum_group, group);
}
/**
@@ -364,7 +364,7 @@ pk_group_enum_from_text (const gchar *group)
const gchar *
pk_group_enum_to_text (PkGroupEnum group)
{
- return pk_task_enum_find_string (task_group, group);
+ return pk_enum_enum_find_string (enum_group, group);
}
/**
@@ -373,7 +373,7 @@ pk_group_enum_to_text (PkGroupEnum group)
PkFreqEnum
pk_freq_enum_from_text (const gchar *freq)
{
- return pk_task_enum_find_value (task_freq, freq);
+ return pk_enum_enum_find_value (enum_freq, freq);
}
/**
@@ -382,7 +382,7 @@ pk_freq_enum_from_text (const gchar *freq)
const gchar *
pk_freq_enum_to_text (PkFreqEnum freq)
{
- return pk_task_enum_find_string (task_freq, freq);
+ return pk_enum_enum_find_string (enum_freq, freq);
}
/**
@@ -391,7 +391,7 @@ pk_freq_enum_to_text (PkFreqEnum freq)
PkUpdateEnum
pk_update_enum_from_text (const gchar *update)
{
- return pk_task_enum_find_value (task_update, update);
+ return pk_enum_enum_find_value (enum_update, update);
}
/**
@@ -400,7 +400,7 @@ pk_update_enum_from_text (const gchar *update)
const gchar *
pk_update_enum_to_text (PkUpdateEnum update)
{
- return pk_task_enum_find_string (task_update, update);
+ return pk_enum_enum_find_string (enum_update, update);
}
/**
@@ -409,7 +409,7 @@ pk_update_enum_to_text (PkUpdateEnum update)
PkFilterEnum
pk_filter_enum_from_text (const gchar *filter)
{
- return pk_task_enum_find_value (task_filter, filter);
+ return pk_enum_enum_find_value (enum_filter, filter);
}
/**
@@ -418,7 +418,7 @@ pk_filter_enum_from_text (const gchar *filter)
const gchar *
pk_filter_enum_to_text (PkFilterEnum filter)
{
- return pk_task_enum_find_string (task_filter, filter);
+ return pk_enum_enum_find_string (enum_filter, filter);
}
/***************************************************************************
@@ -440,7 +440,7 @@ libst_enum (LibSelfTest *test)
/************************************************************/
libst_title (test, "find value");
- value = pk_task_enum_find_value (task_role, "search-file");
+ value = pk_enum_enum_find_value (enum_role, "search-file");
if (PK_ROLE_ENUM_SEARCH_FILE) {
libst_success (test, NULL);
} else {
@@ -449,7 +449,7 @@ libst_enum (LibSelfTest *test)
/************************************************************/
libst_title (test, "find string");
- string = pk_task_enum_find_string (task_role, PK_ROLE_ENUM_SEARCH_FILE);
+ string = pk_enum_enum_find_string (enum_role, PK_ROLE_ENUM_SEARCH_FILE);
if (strcmp (string, "search-file") == 0) {
libst_success (test, NULL);
} else {
commit f1614f2c703bbd768ac2b157f3dfcb993f2e8f2b
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 28 22:45:37 2007 +0000
export the enum stuff, we need this in gnome-packagekit
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 323cf91..5c44f27 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -30,11 +30,6 @@
#include "pk-debug.h"
#include "pk-enum.h"
-typedef struct {
- guint value;
- const gchar *string;
-} PkEnumMatch;
-
static PkEnumMatch task_exit[] = {
{PK_EXIT_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_EXIT_ENUM_SUCCESS, "success"},
@@ -183,7 +178,7 @@ static PkEnumMatch task_sig_type[] = {
/**
* pk_task_enum_find_value:
*/
-static guint
+guint
pk_task_enum_find_value (PkEnumMatch *table, const gchar *string)
{
guint i;
@@ -208,7 +203,7 @@ pk_task_enum_find_value (PkEnumMatch *table, const gchar *string)
/**
* pk_task_enum_find_string:
*/
-static const gchar *
+const gchar *
pk_task_enum_find_string (PkEnumMatch *table, guint value)
{
guint i;
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index e3748a1..d876442 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -27,6 +27,11 @@
G_BEGIN_DECLS
+typedef struct {
+ guint value;
+ const gchar *string;
+} PkEnumMatch;
+
/* what we asked to do */
typedef enum {
PK_ROLE_ENUM_CANCEL,
@@ -163,6 +168,12 @@ typedef enum {
PK_SIGTYPE_ENUM_UNKNOWN
} PkSigTypeEnum;
+/* general */
+guint pk_task_enum_find_value (PkEnumMatch *table,
+ const gchar *string);
+const gchar *pk_task_enum_find_string (PkEnumMatch *table,
+ guint value);
+
PkSigTypeEnum pk_sig_type_enum_from_text (const gchar *sig_type);
const gchar *pk_sig_type_enum_to_text (PkSigTypeEnum sig_type);
commit 5256a1464d8fdb290e6f348e76fdde260c6580e9
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 28 22:42:00 2007 +0000
rename PkTaskEnumMatch to PkEnumMatch
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index fcee276..323cf91 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -33,9 +33,9 @@
typedef struct {
guint value;
const gchar *string;
-} PkTaskEnumMatch;
+} PkEnumMatch;
-static PkTaskEnumMatch task_exit[] = {
+static PkEnumMatch task_exit[] = {
{PK_EXIT_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_EXIT_ENUM_SUCCESS, "success"},
{PK_EXIT_ENUM_FAILED, "failed"},
@@ -44,7 +44,7 @@ static PkTaskEnumMatch task_exit[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_status[] = {
+static PkEnumMatch task_status[] = {
{PK_STATUS_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_STATUS_ENUM_WAIT, "wait"},
{PK_STATUS_ENUM_SETUP, "setup"},
@@ -57,7 +57,7 @@ static PkTaskEnumMatch task_status[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_role[] = {
+static PkEnumMatch task_role[] = {
{PK_ROLE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_ROLE_ENUM_CANCEL, "cancel"},
{PK_ROLE_ENUM_RESOLVE, "resolve"},
@@ -83,7 +83,7 @@ static PkTaskEnumMatch task_role[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_error[] = {
+static PkEnumMatch task_error[] = {
{PK_ERROR_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_ERROR_ENUM_OOM, "out-of-memory"},
{PK_ERROR_ENUM_NO_CACHE, "no-cache"},
@@ -106,7 +106,7 @@ static PkTaskEnumMatch task_error[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_restart[] = {
+static PkEnumMatch task_restart[] = {
{PK_RESTART_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_RESTART_ENUM_NONE, "none"},
{PK_RESTART_ENUM_SYSTEM, "system"},
@@ -115,7 +115,7 @@ static PkTaskEnumMatch task_restart[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_filter[] = {
+static PkEnumMatch task_filter[] = {
{PK_FILTER_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_FILTER_ENUM_DEVELOPMENT, "devel"},
{PK_FILTER_ENUM_INSTALLED, "installed"},
@@ -126,7 +126,7 @@ static PkTaskEnumMatch task_filter[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_group[] = {
+static PkEnumMatch task_group[] = {
{PK_GROUP_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_GROUP_ENUM_ACCESSIBILITY, "accessibility"},
{PK_GROUP_ENUM_ACCESSORIES, "accessories"},
@@ -142,7 +142,7 @@ static PkTaskEnumMatch task_group[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_freq[] = {
+static PkEnumMatch task_freq[] = {
{PK_FREQ_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_FREQ_ENUM_HOURLY, "hourly"},
{PK_FREQ_ENUM_DAILY, "daily"},
@@ -151,7 +151,7 @@ static PkTaskEnumMatch task_freq[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_update[] = {
+static PkEnumMatch task_update[] = {
{PK_UPDATE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_UPDATE_ENUM_ALL, "all"},
{PK_UPDATE_ENUM_SECURITY, "security"},
@@ -159,7 +159,7 @@ static PkTaskEnumMatch task_update[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_info[] = {
+static PkEnumMatch task_info[] = {
{PK_INFO_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_INFO_ENUM_INSTALLED, "installed"},
{PK_INFO_ENUM_AVAILABLE, "available"},
@@ -174,16 +174,17 @@ static PkTaskEnumMatch task_info[] = {
{0, NULL},
};
-static PkTaskEnumMatch task_sig_type[] = {
+static PkEnumMatch task_sig_type[] = {
{PK_SIGTYPE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_SIGTYPE_ENUM_GPG, "gpg"},
+ {0, NULL},
};
/**
* pk_task_enum_find_value:
*/
static guint
-pk_task_enum_find_value (PkTaskEnumMatch *table, const gchar *string)
+pk_task_enum_find_value (PkEnumMatch *table, const gchar *string)
{
guint i;
const gchar *string_tmp;
@@ -208,7 +209,7 @@ pk_task_enum_find_value (PkTaskEnumMatch *table, const gchar *string)
* pk_task_enum_find_string:
*/
static const gchar *
-pk_task_enum_find_string (PkTaskEnumMatch *table, guint value)
+pk_task_enum_find_string (PkEnumMatch *table, guint value)
{
guint i;
guint tmp;
commit 72edb806ba76e6291c2933d0602fcdce6c9bd521
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Sat Oct 27 10:59:58 2007 -0400
Add GetFiles backend capability.
Eventually this will replace the file list from GetDescription.
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index fd1da1c..4373817 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -786,6 +786,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
NULL, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
NULL, /* get_updates */
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index a0b6c5c..9be3af3 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -204,6 +204,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
backend_get_description, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
backend_get_updates, /* get_updates */
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 51d114c..397865a 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -633,6 +633,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
+ NULL, /* get_files */
backend_get_requires, /* get_requires */
NULL, /* get_update_detail */
backend_get_updates, /* get_updates */
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 710c11b..3f0079e 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -71,6 +71,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
NULL, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index fe71ca8..429fe72 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -118,6 +118,17 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
}
/**
+ * backend_get_files:
+ */
+static void
+backend_get_files (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_files (backend, "gnome-power-manager;2.6.19;i386;fedora",
+ "/usr/share/man/man1;/usr/share/man/man1/gnome-power-manager.1.gz");
+ pk_backend_finished (backend);
+}
+/**
* backend_get_requires:
*/
static void
@@ -470,6 +481,7 @@ PK_BACKEND_OPTIONS (
backend_cancel, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
+ backend_get_files, /* get_files */
backend_get_requires, /* get_requires */
backend_get_update_detail, /* get_update_detail */
backend_get_updates, /* get_updates */
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 8fd7bbf..f4157b4 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -34,6 +34,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
+ NULL, /* get_files */
pk_backend_python_get_requires, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index dfbb720..d2b8345 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -35,6 +35,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
pk_backend_python_get_description, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index aa75124..63d56d7 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -105,6 +105,16 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
}
/**
+ * backend_get_files:
+ */
+static void
+backend_get_files (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_finished (backend);
+}
+
+/**
* backend_get_requires:
*/
static void
@@ -271,6 +281,7 @@ PK_BACKEND_OPTIONS (
backend_cancel, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
+ backend_get_files, /* get_files */
backend_get_requires, /* get_requires */
backend_get_update_detail, /* get_update_detail */
backend_get_updates, /* get_updates */
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index 52e5b83..acdffe8 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -34,6 +34,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
NULL, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
NULL, /* get_updates */
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 032c46b..299dc03 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -47,6 +47,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
NULL, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
NULL, /* get_updates */
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index bdd3ed4..6893ee8 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -101,6 +101,16 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
}
/**
+ * backend_get_description:
+ */
+static void
+backend_get_files (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_finished (backend);
+}
+
+/**
* backend_get_requires:
*/
static void
@@ -305,6 +315,7 @@ PK_BACKEND_OPTIONS (
backend_cancel, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
+ backend_get_files, /* get_files */
backend_get_requires, /* get_requires */
backend_get_update_detail, /* get_update_detail */
backend_get_updates, /* get_updates */
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index aec1b56..d6bdeed 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -94,6 +94,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
NULL, /* get_depends */
NULL, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
NULL, /* get_updates */
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 39884c6..5f3c08e 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -61,6 +61,7 @@ PK_BACKEND_OPTIONS (
pk_backend_python_cancel, /* cancel */
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
+ NULL, /* get_files */
NULL, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
diff --git a/client/pk-console.c b/client/pk-console.c
index f023c70..56645fa 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -349,6 +349,7 @@ const gchar *summary =
" get depends <package_id>\n"
" get requires <package_id>\n"
" get description <package_id>\n"
+ " get files <package_id>\n"
" get updatedetail <package_id>\n"
" get actions\n"
" get groups\n"
@@ -567,6 +568,24 @@ pk_console_get_description(PkClient *client, const gchar *package)
}
/**
+ * pk_console_get_files:
+ **/
+static gboolean
+pk_console_get_files (PkClient *client, const gchar *package)
+{
+ gboolean ret;
+ gchar *package_id;
+ package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
+ if (package_id == NULL) {
+ g_print ("Could not find a package with that name to get files\n");
+ return FALSE;
+ }
+ ret = pk_client_get_files (client, package_id);
+ g_free (package_id);
+ return ret;
+}
+
+/**
* pk_console_get_update_detail
**/
static gboolean
@@ -720,6 +739,13 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
} else {
wait = pk_console_get_description (client, details);
}
+ } else if (strcmp (value, "files") == 0) {
+ if (details == NULL) {
+ g_set_error (error, 0, 0, "you need to specify a package to find the files for");
+ return FALSE;
+ } else {
+ wait = pk_console_get_files (client, details);
+ }
} else if (strcmp (value, "updates") == 0) {
wait = pk_client_get_updates (client);
} else if (strcmp (value, "actions") == 0) {
@@ -796,6 +822,36 @@ pk_console_description_cb (PkClient *client, const gchar *package_id,
}
/**
+ * pk_console_files_cb:
+ **/
+static void
+pk_console_files_cb (PkClient *client, const gchar *package_id,
+ const gchar *filelist, gpointer data)
+{
+ gchar **filevector = g_strsplit (filelist, ";", 0);
+
+ /* if on console, clear the progress bar line */
+ if (is_console == TRUE && printed_bar == TRUE) {
+ g_print ("\n");
+ }
+
+ g_print ("Package files\n");
+
+ if (*filevector != NULL) {
+ gchar **current_file = filevector;
+
+ while (*current_file != NULL) {
+ g_print (" %s\n", *current_file);
+ current_file++;
+ }
+ } else {
+ g_print (" no files\n");
+ }
+
+ g_strfreev (filevector);
+}
+
+/**
* pk_console_repo_signature_required_cb:
**/
static void
@@ -886,6 +942,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_console_transaction_cb), NULL);
g_signal_connect (client, "description",
G_CALLBACK (pk_console_description_cb), NULL);
+ g_signal_connect (client, "files",
+ G_CALLBACK (pk_console_files_cb), NULL);
g_signal_connect (client, "repo-signature-required",
G_CALLBACK (pk_console_repo_signature_required_cb), NULL);
g_signal_connect (client, "update-detail",
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index a27d218..12e8fdb 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -74,6 +74,7 @@ struct PkClientPrivate
typedef enum {
PK_CLIENT_DESCRIPTION,
PK_CLIENT_ERROR_CODE,
+ PK_CLIENT_FILES,
PK_CLIENT_FINISHED,
PK_CLIENT_PACKAGE,
PK_CLIENT_PROGRESS_CHANGED,
@@ -487,6 +488,29 @@ pk_client_description_cb (DBusGProxy *proxy,
}
/**
+ * pk_client_files_cb:
+ */
+static void
+pk_client_files_cb (DBusGProxy *proxy,
+ const gchar *tid,
+ const gchar *package_id,
+ const gchar *filelist,
+ PkClient *client)
+{
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (PK_IS_CLIENT (client));
+
+ /* not us, ignore */
+ if (pk_client_should_proxy (client, tid) == FALSE) {
+ return;
+ }
+
+ pk_debug ("emit files %s, %s", package_id, filelist);
+ g_signal_emit (client , signals [PK_CLIENT_FILES], 0, package_id,
+ filelist);
+}
+
+/**
* pk_client_repo_signature_required_cb:
**/
static void
@@ -1386,6 +1410,49 @@ pk_client_get_description (PkClient *client, const gchar *package)
}
/**
+ * pk_client_get_files:
+ **/
+gboolean
+pk_client_get_files (PkClient *client, const gchar *package)
+{
+ 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_GET_FILES;
+ client->priv->xcached_package_id = g_strdup (package);
+
+ error = NULL;
+ ret = dbus_g_proxy_call (client->priv->proxy, "GetFiles", &error,
+ G_TYPE_STRING, client->priv->tid,
+ G_TYPE_STRING, package,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (error != NULL) {
+ const gchar *error_name;
+ error_name = pk_client_get_error_name (error);
+ pk_debug ("ERROR: %s: %s", error_name, error->message);
+ g_error_free (error);
+ }
+ if (ret == FALSE) {
+ /* abort as the DBUS method failed */
+ pk_warning ("GetFiles failed!");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
* pk_client_remove_package_action:
**/
gboolean
@@ -2148,6 +2215,8 @@ pk_client_requeue (PkClient *client)
pk_client_rollback (client, client->priv->xcached_transaction_id);
} else if (client->priv->role == PK_ROLE_ENUM_GET_DESCRIPTION) {
pk_client_get_description (client, client->priv->xcached_package_id);
+ } else if (client->priv->role == PK_ROLE_ENUM_GET_FILES) {
+ pk_client_get_files (client, client->priv->xcached_package_id);
} else if (client->priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
pk_client_get_requires (client, client->priv->xcached_package_id);
} else if (client->priv->role == PK_ROLE_ENUM_GET_UPDATES) {
@@ -2232,6 +2301,11 @@ pk_client_class_init (PkClientClass *klass)
0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64_STRING,
G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING);
+ signals [PK_CLIENT_FILES] =
+ g_signal_new ("files",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
signals [PK_CLIENT_REPO_SIGNATURE_REQUIRED] =
g_signal_new ("repo-signature-required",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -2364,6 +2438,11 @@ pk_client_init (PkClient *client)
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64,
G_TYPE_STRING, G_TYPE_INVALID);
+ /* Files */
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INVALID);
+
/* Repo Signature Required */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -2430,6 +2509,11 @@ pk_client_init (PkClient *client)
dbus_g_proxy_connect_signal (proxy, "Description",
G_CALLBACK (pk_client_description_cb), client, NULL);
+ dbus_g_proxy_add_signal (proxy, "Files",
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (proxy, "Files",
+ G_CALLBACK (pk_client_files_cb), client, NULL);
+
dbus_g_proxy_add_signal (proxy, "RepoSignatureRequired",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -2492,6 +2576,8 @@ pk_client_finalize (GObject *object)
G_CALLBACK (pk_client_transaction_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Description",
G_CALLBACK (pk_client_description_cb), client);
+ dbus_g_proxy_disconnect_signal (client->priv->proxy, "Files",
+ G_CALLBACK (pk_client_files_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "RepoSignatureRequired",
G_CALLBACK (pk_client_repo_signature_required_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "ErrorCode",
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 21040b3..3f81c51 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -103,6 +103,8 @@ gboolean pk_client_get_requires (PkClient *client,
const gchar *package_id);
gboolean pk_client_get_description (PkClient *client,
const gchar *package_id);
+gboolean pk_client_get_files (PkClient *client,
+ const gchar *package_id);
gboolean pk_client_remove_package (PkClient *client,
const gchar *package,
gboolean allow_deps);
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index fcee276..3f13f9c 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -65,6 +65,7 @@ static PkTaskEnumMatch task_role[] = {
{PK_ROLE_ENUM_GET_DEPENDS, "get-depends"},
{PK_ROLE_ENUM_GET_UPDATE_DETAIL, "get-update-detail"},
{PK_ROLE_ENUM_GET_DESCRIPTION, "get-description"},
+ {PK_ROLE_ENUM_GET_FILES, "get-files"},
{PK_ROLE_ENUM_GET_REQUIRES, "get-requires"},
{PK_ROLE_ENUM_GET_UPDATES, "get-updates"},
{PK_ROLE_ENUM_SEARCH_DETAILS, "search-details"},
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index e3748a1..f34c6d0 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -35,6 +35,7 @@ typedef enum {
PK_ROLE_ENUM_GET_DEPENDS,
PK_ROLE_ENUM_GET_UPDATE_DETAIL,
PK_ROLE_ENUM_GET_DESCRIPTION,
+ PK_ROLE_ENUM_GET_FILES,
PK_ROLE_ENUM_GET_REQUIRES,
PK_ROLE_ENUM_GET_UPDATES,
PK_ROLE_ENUM_SEARCH_DETAILS,
diff --git a/src/pk-backend-internal.h b/src/pk-backend-internal.h
index 8ac23d9..00991d8 100644
--- a/src/pk-backend-internal.h
+++ b/src/pk-backend-internal.h
@@ -73,6 +73,8 @@ gboolean pk_backend_get_update_detail (PkBackend *backend,
const gchar *package_id);
gboolean pk_backend_get_description (PkBackend *backend,
const gchar *package_id);
+gboolean pk_backend_get_files (PkBackend *backend,
+ const gchar *package_id);
gboolean pk_backend_get_requires (PkBackend *backend,
const gchar *package_id);
gboolean pk_backend_get_updates (PkBackend *backend);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 209ab6e..76bc4c8 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -95,6 +95,7 @@ enum {
PK_BACKEND_TRANSACTION_STATUS_CHANGED,
PK_BACKEND_PROGRESS_CHANGED,
PK_BACKEND_DESCRIPTION,
+ PK_BACKEND_FILES,
PK_BACKEND_PACKAGE,
PK_BACKEND_UPDATE_DETAIL,
PK_BACKEND_ERROR_CODE,
@@ -304,6 +305,14 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
group, sections[4], sections[5],
package_size, sections[7]);
}
+ } else if (strcmp (command, "files") == 0) {
+ if (size != 3) {
+ g_warning ("invalid command '%s'", command);
+ ret = FALSE;
+ goto out;
+ }
+
+ pk_backend_files (backend, sections[1], sections[2]);
} else if (strcmp (command, "repo-detail") == 0) {
if (size != 4) {
g_warning ("invalid command '%s'", command);
@@ -870,6 +879,23 @@ pk_backend_description (PkBackend *backend, const gchar *package_id,
}
/**
+ * pk_backend_files:
+ **/
+gboolean
+pk_backend_files (PkBackend *backend, const gchar *package_id,
+ const gchar *filelist)
+{
+ g_return_val_if_fail (backend != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+ pk_debug ("emit files %s, %s", package_id, filelist);
+ g_signal_emit (backend, signals [PK_BACKEND_FILES], 0,
+ package_id, filelist);
+
+ return TRUE;
+}
+
+/**
* pk_backend_updates_changed:
**/
gboolean
@@ -1142,6 +1168,9 @@ pk_backend_set_running (PkBackend *backend)
} else if (backend->priv->role == PK_ROLE_ENUM_GET_DESCRIPTION) {
backend->desc->get_description (backend,
backend->priv->xcached_package_id);
+ } else if (backend->priv->role == PK_ROLE_ENUM_GET_FILES) {
+ backend->desc->get_files (backend,
+ backend->priv->xcached_package_id);
} else if (backend->priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
backend->desc->get_requires (backend,
backend->priv->xcached_package_id);
@@ -1263,6 +1292,22 @@ pk_backend_get_description (PkBackend *backend, const gchar *package_id)
}
/**
+ * pk_backend_get_files:
+ */
+gboolean
+pk_backend_get_files (PkBackend *backend, const gchar *package_id)
+{
+ g_return_val_if_fail (backend != NULL, FALSE);
+ if (backend->desc->get_files == NULL) {
+ pk_backend_not_implemented_yet (backend, "GetFiles");
+ return FALSE;
+ }
+ backend->priv->xcached_package_id = g_strdup (package_id);
+ pk_backend_set_role (backend, PK_ROLE_ENUM_GET_FILES);
+ return TRUE;
+}
+
+/**
* pk_backend_get_requires:
*/
gboolean
@@ -1579,6 +1624,9 @@ pk_backend_get_actions (PkBackend *backend)
if (backend->desc->get_description != NULL) {
pk_enum_list_append (elist, PK_ROLE_ENUM_GET_DESCRIPTION);
}
+ if (backend->desc->get_files != NULL) {
+ pk_enum_list_append (elist, PK_ROLE_ENUM_GET_FILES);
+ }
if (backend->desc->get_requires != NULL) {
pk_enum_list_append (elist, PK_ROLE_ENUM_GET_REQUIRES);
}
@@ -1780,6 +1828,11 @@ pk_backend_class_init (PkBackendClass *klass)
0, NULL, NULL, pk_marshal_VOID__STRING_STRING_UINT_STRING_STRING_UINT64_STRING,
G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_UINT64, G_TYPE_STRING);
+ signals [PK_BACKEND_FILES] =
+ g_signal_new ("files",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
signals [PK_BACKEND_ERROR_CODE] =
g_signal_new ("error-code",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index b582c99..81b91bb 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -68,6 +68,9 @@ gboolean pk_backend_description (PkBackend *backend,
const gchar *url,
gulong size,
const gchar *filelist);
+gboolean pk_backend_files (PkBackend *backend,
+ const gchar *package_id,
+ const gchar *filelist);
gboolean pk_backend_error_code (PkBackend *backend,
guint code,
const gchar *details, ...);
@@ -122,6 +125,7 @@ struct _PkBackendDesc {
void (*cancel) (PkBackend *backend);
void (*get_depends) (PkBackend *backend, const gchar *package_id);
void (*get_description) (PkBackend *backend, const gchar *package_id);
+ void (*get_files) (PkBackend *backend, const gchar *package_id);
void (*get_requires) (PkBackend *backend, const gchar *package_id);
void (*get_update_detail) (PkBackend *backend, const gchar *package_id);
void (*get_updates) (PkBackend *backend);
@@ -145,7 +149,7 @@ struct _PkBackendDesc {
};
#define PK_BACKEND_OPTIONS(description, version, author, initialize, destroy, \
- get_groups, get_filters, cancel, get_depends, get_description, \
+ get_groups, get_filters, cancel, get_depends, get_description, get_files, \
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, \
@@ -161,6 +165,7 @@ struct _PkBackendDesc {
cancel, \
get_depends, \
get_description, \
+ get_files, \
get_requires, \
get_update_detail, \
get_updates, \
diff --git a/src/pk-engine.c b/src/pk-engine.c
index cf9b582..32589a7 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -88,6 +88,7 @@ enum {
PK_ENGINE_FINISHED,
PK_ENGINE_UPDATE_DETAIL,
PK_ENGINE_DESCRIPTION,
+ PK_ENGINE_FILES,
PK_ENGINE_ALLOW_INTERRUPT,
PK_ENGINE_LOCKED,
PK_ENGINE_REPO_DETAIL,
@@ -453,6 +454,30 @@ pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gch
}
/**
+ * pk_engine_files_cb:
+ **/
+static void
+pk_engine_files_cb (PkBackend *backend, const gchar *package_id,
+ const gchar *filelist, PkEngine *engine)
+{
+ PkTransactionItem *item;
+
+ g_return_if_fail (engine != NULL);
+ g_return_if_fail (PK_IS_ENGINE (engine));
+
+ item = pk_transaction_list_get_from_backend (engine->priv->transaction_list, backend);
+ if (item == NULL) {
+ pk_warning ("could not find backend");
+ return;
+ }
+
+ pk_debug ("emitting files tid:%s, %s, %s",
+ item->tid, package_id, filelist);
+ g_signal_emit (engine, signals [PK_ENGINE_FILES], 0,
+ item->tid, package_id, filelist);
+}
+
+/**
* pk_engine_finished_cb:
**/
static void
@@ -651,6 +676,8 @@ pk_engine_backend_new (PkEngine *engine)
G_CALLBACK (pk_engine_finished_cb), engine);
g_signal_connect (backend, "description",
G_CALLBACK (pk_engine_description_cb), engine);
+ g_signal_connect (backend, "files",
+ G_CALLBACK (pk_engine_files_cb), engine);
g_signal_connect (backend, "allow-interrupt",
G_CALLBACK (pk_engine_allow_interrupt_cb), engine);
g_signal_connect (backend, "change-transaction-data",
@@ -1459,6 +1486,63 @@ pk_engine_get_description (PkEngine *engine, const gchar *tid, const gchar *pack
}
/**
+ * pk_engine_get_files:
+ **/
+gboolean
+pk_engine_get_files (PkEngine *engine, const gchar *tid, const gchar *package_id, GError **error)
+{
+ gboolean ret;
+ PkTransactionItem *item;
+
+ g_return_val_if_fail (engine != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
+
+ pk_debug ("GetFiles method called: %s, %s", tid, package_id);
+
+ /* find pre-requested transaction id */
+ item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
+ if (item == NULL) {
+ g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
+ "transaction_id '%s' not found", tid);
+ return FALSE;
+ }
+
+ /* check for sanity */
+ ret = pk_validate_input (package_id);
+ if (ret == FALSE) {
+ *error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_INPUT_INVALID,
+ "Invalid input passed to daemon");
+ return FALSE;
+ }
+
+ /* check package_id */
+ ret = pk_package_id_check (package_id);
+ if (ret == FALSE) {
+ *error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_PACKAGE_ID_INVALID,
+ "The package id '%s' is not valid", package_id);
+ return FALSE;
+ }
+
+ /* create a new backend */
+ item->backend = pk_engine_backend_new (engine);
+ if (item->backend == NULL) {
+ g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
+ "Backend '%s' could not be initialized", engine->priv->backend);
+ return FALSE;
+ }
+
+ ret = pk_backend_get_files (item->backend, package_id);
+ if (ret == FALSE) {
+ g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
+ "Operation not yet supported by backend");
+ pk_engine_item_delete (engine, item);
+ return FALSE;
+ }
+ pk_engine_item_add (engine, item);
+ return TRUE;
+}
+
+/**
* pk_engine_update_system:
**/
void
@@ -2405,6 +2489,11 @@ pk_engine_class_init (PkEngineClass *klass)
0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64_STRING,
G_TYPE_NONE, 8, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING);
+ signals [PK_ENGINE_FILES] =
+ g_signal_new ("files",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
signals [PK_ENGINE_FINISHED] =
g_signal_new ("finished",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 90e9310..aef12cd 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -119,6 +119,10 @@ gboolean pk_engine_get_description (PkEngine *engine,
const gchar *tid,
const gchar *package_id,
GError **error);
+gboolean pk_engine_get_files (PkEngine *engine,
+ const gchar *tid,
+ const gchar *package_id,
+ GError **error);
gboolean pk_engine_resolve (PkEngine *engine,
const gchar *tid,
const gchar *filter,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 1542725..c6d0688 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -63,6 +63,10 @@
<arg type="s" name="tid" direction="in"/>
<arg type="s" name="package_id" direction="in"/>
</method>
+ <method name="GetFiles">
+ <arg type="s" name="tid" direction="in"/>
+ <arg type="s" name="package_id" direction="in"/>
+ </method>
<method name="RemovePackage">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg type="s" name="tid" direction="in"/>
@@ -113,6 +117,11 @@
<arg type="t" name="size" direction="out"/> <!-- size of package file in bytes -->
<arg type="s" name="file_list" direction="out"/> <!-- list of files and dirs separated by ';' -->
</signal>
+ <signal name="Files">
+ <arg type="s" name="tid" direction="out"/>
+ <arg type="s" name="package_id" direction="out"/>
+ <arg type="s" name="file_list" direction="out"/> <!-- list of files and dirs separated by ';' -->
+ </signal>
<signal name="UpdateDetail">
<arg type="s" name="tid" direction="out"/>
<arg type="s" name="package_id" direction="out"/>
More information about the PackageKit
mailing list