[PackageKit-commit] packagekit: Branch 'master' - 19 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Aug 7 09:02:56 PDT 2008
Makefile.am | 1
backends/alpm/pk-backend-alpm.c | 3
backends/dummy/pk-backend-dummy.c | 9
backends/poldek/pk-backend-poldek.c | 2
backends/yum/helpers/yumBackend.py | 17
backends/zypp/pk-backend-zypp.cpp | 597 ++++++++++++++--------------
backends/zypp/zypp-utils.cpp | 8
client/.gitignore | 1
client/pk-console.c | 37 +
configure.ac | 1
data/.gitignore | 2
docs/api/Makefile.am | 1
docs/html/files/.gitignore | 3
docs/html/files/session.c | 36 +
docs/html/files/system.c | 73 +++
docs/html/pk-faq.html | 11
docs/html/upload.sh | 1
libgbus/.gitignore | 11
libgbus/Makefile.am | 42 -
libgbus/libgbus-marshal.list | 2
libgbus/libgbus.c | 272 ------------
libgbus/libgbus.h | 69 ---
libpackagekit/Makefile.am | 12
libpackagekit/pk-client.c | 37 +
libpackagekit/pk-common.c | 59 ++
libpackagekit/pk-common.h | 2
libpackagekit/pk-connection.c | 16
libpackagekit/pk-dbus-monitor.c | 271 ++++++++++++
libpackagekit/pk-dbus-monitor.h | 69 +++
libpackagekit/pk-enum.c | 36 +
libpackagekit/pk-enum.h | 15
libpackagekit/pk-update-detail-obj.c | 21
libpackagekit/pk-update-detail-obj.h | 10
po/POTFILES.in | 3
po/pt_BR.po | 190 ++++----
policy/org.freedesktop.packagekit.policy.in | 2
python/packagekit/backend.py | 8
python/packagekit/daemonBackend.py | 6
src/Makefile.am | 1
src/pk-backend-dbus.c | 31 -
src/pk-backend-python.c | 14
src/pk-backend-spawn.c | 14
src/pk-backend.c | 18
src/pk-backend.h | 6
src/pk-interface-transaction.xml | 37 +
src/pk-marshal.list | 4
src/pk-network-unix.c | 6
src/pk-network.c | 10
src/pk-security-polkit.c | 2
src/pk-transaction.c | 46 +-
50 files changed, 1264 insertions(+), 881 deletions(-)
New commits:
commit ef4a0a5bce9dd2bdaaaa80fcf7e9432c9341a689
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 14:05:50 2008 +0100
API CHANGE: add 4 new fields to the UpdateDetail struct
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 52e905e..6a6378f 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -1111,7 +1111,8 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
gchar *installed_package_id = installed_pkg ? pkg_to_package_id_str (installed_pkg, ALPM_LOCAL_DB_ALIAS) : NULL;
pk_backend_update_detail (backend, package_ids[iterator], installed_package_id, "", "", "", "", PK_RESTART_ENUM_NONE,
- installed_pkg ? "Update to latest available version" : "Install as a dependency for another update");
+ installed_pkg ? "Update to latest available version" : "Install as a dependency for another update",
+ NULL, PK_UPDATE_STATE_ENUM_UNKNOWN, NULL, NULL);
g_free (installed_package_id);
}
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index b6a3838..ea4f03a 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -191,7 +191,8 @@ backend_get_update_detail_timeout (gpointer data)
"powertop;1.7-1.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for powertop",
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
- "", PK_RESTART_ENUM_NONE, "Update to newest upstream source");
+ "", PK_RESTART_ENUM_NONE, "Update to newest upstream source",
+ "", PK_UPDATE_STATE_ENUM_STABLE, "2008-07-31", NULL);
}
if (pk_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
pk_backend_update_detail (backend, package_id,
@@ -201,7 +202,8 @@ backend_get_update_detail_timeout (gpointer data)
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344;"
"http://bgzilla.gnome.org/result.php?#9876;GNOME Bugzilla #9876",
"http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
- PK_RESTART_ENUM_SYSTEM, "Update to newest version");
+ PK_RESTART_ENUM_SYSTEM, "Update to newest version",
+ "", PK_UPDATE_STATE_ENUM_UNSTABLE, "2008-06-28", NULL);
}
if (pk_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
pk_backend_update_detail (backend, package_id,
@@ -212,7 +214,8 @@ backend_get_update_detail_timeout (gpointer data)
"Update to latest whizz bang version\n"
"* support this new thing\n"
"* something else\n"
- "- and that new thing");
+ "- and that new thing",
+ "", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
}
}
pk_backend_finished (backend);
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 26c80a2..ef09c5a 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -2270,7 +2270,7 @@ backend_get_update_detail_thread (PkBackend *backend)
"",
cve_url ? cve_url : "",
PK_RESTART_ENUM_NONE,
- "");
+ "", NULL, PK_UPDATE_STATE_ENUM_UNKNOWN, NULL, NULL);
g_free (updates);
g_free (obsoletes);
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 57607c9..5a39b3a 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1332,18 +1332,19 @@ class PackageKitYumBackend(PackageKitBaseBackend):
urls['vendor'].append("%s;%s" % (href,title))
# other interesting data:
- # notice['issued'] = '2008-07-30 18:09:08'
- # notice['updated'] = presume date and time, not used
- # notice['status'] = 'stable'
+ changelog = ''
+ state = notice['status'] or ''
+ issued = notice['issued'] or ''
+ updated = notice['updated'] or ''
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
reboot = 'system'
else:
reboot = 'none'
- return self._format_str(desc),urls,reboot
+ return self._format_str(desc),urls,reboot,changelog,state,issued,updated
else:
- return "",urls,"none"
+ return "",urls,"none",'','','',''
def get_update_detail(self,package_ids):
'''
@@ -1357,11 +1358,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkg,inst = self._findPackage(package)
update = self._get_updated(pkg)
obsolete = self._get_obsoleted(pkg.name)
- desc,urls,reboot = self._get_update_extras(pkg)
+ desc,urls,reboot,changelog,state,issued,updated = self._get_update_extras(pkg)
cve_url = self._format_list(urls['cve'])
bz_url = self._format_list(urls['bugzilla'])
vendor_url = self._format_list(urls['vendor'])
- self.update_detail(package,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc)
+ self.update_detail(package,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc,changelog,state,issued,updated)
def repo_set_data(self,repoid,parameter,value):
'''
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 356442b..ade4c5d 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -674,7 +674,7 @@ backend_get_updates_thread (PkBackend *backend)
delete (candidates);
//delete (candidates2);
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage (backend, 100);
pk_backend_finished (backend);
return TRUE;
}
@@ -875,13 +875,14 @@ backend_get_update_detail_thread (PkBackend *backend)
pk_backend_update_detail (backend,
package_ids[i],
- updates, // updates
- obsoletes, // CURRENTLY CAUSES SEGFAULT obsoletes,
- "", // CURRENTLY CAUSES SEGFAULT solvable.vendor ().c_str (),
- bugzilla, // bugzilla
- cve, // cve
+ updates, // updates
+ obsoletes, // CURRENTLY CAUSES SEGFAULT obsoletes,
+ "", // CURRENTLY CAUSES SEGFAULT solvable.vendor ().c_str (),
+ bugzilla, // bugzilla
+ cve, // cve
restart,
- solvable.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
+ solvable.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (),
+ NULL, PK_UPDATE_STATE_ENUM_UNKNOWN, NULL, NULL);
g_free (bugzilla);
g_free (cve);
@@ -1739,11 +1740,11 @@ extern "C" PK_BACKEND_OPTIONS (
NULL, /* rollback */
backend_search_details, /* search_details */
backend_search_file, /* search_file */
- backend_search_group, /* search_group */
+ backend_search_group, /* search_group */
backend_search_name, /* search_name */
- NULL, /* service_pack */
+ NULL, /* service_pack */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
- backend_what_provides /* what_provides */
+ backend_what_provides /* what_provides */
);
diff --git a/client/pk-console.c b/client/pk-console.c
index 64b00e8..d5cc590 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -211,32 +211,51 @@ pk_console_transaction_cb (PkClient *client, const gchar *tid, const gchar *time
static void
pk_console_update_detail_cb (PkClient *client, const PkUpdateDetailObj *detail, gpointer data)
{
+ gchar *issued;
+ gchar *updated;
+
if (awaiting_space) {
g_print ("\n");
}
g_print ("%s\n", _("Update detail"));
g_print (" package: '%s-%s.%s'\n", detail->id->name, detail->id->version, detail->id->arch);
- if (pk_strzero (detail->updates) == FALSE) {
+ if (!pk_strzero (detail->updates)) {
g_print (" updates: '%s'\n", detail->updates);
}
- if (pk_strzero (detail->obsoletes) == FALSE) {
+ if (!pk_strzero (detail->obsoletes)) {
g_print (" obsoletes: '%s'\n", detail->obsoletes);
}
- if (pk_strzero (detail->vendor_url) == FALSE) {
+ if (!pk_strzero (detail->vendor_url)) {
g_print (" vendor URL: '%s'\n", detail->vendor_url);
}
- if (pk_strzero (detail->bugzilla_url) == FALSE) {
+ if (!pk_strzero (detail->bugzilla_url)) {
g_print (" bug URL: '%s'\n", detail->bugzilla_url);
}
- if (pk_strzero (detail->cve_url) == FALSE) {
+ if (!pk_strzero (detail->cve_url)) {
g_print (" cve URL: '%s'\n", detail->cve_url);
}
if (detail->restart != PK_RESTART_ENUM_NONE) {
g_print (" restart: '%s'\n", pk_restart_enum_to_text (detail->restart));
}
- if (pk_strzero (detail->update_text) == FALSE) {
+ if (!pk_strzero (detail->update_text)) {
g_print (" update_text:'%s'\n", detail->update_text);
}
+ if (!pk_strzero (detail->changelog)) {
+ g_print (" changelog: '%s'\n", detail->changelog);
+ }
+ if (detail->state != PK_UPDATE_STATE_ENUM_UNKNOWN) {
+ g_print (" state: '%s'\n", pk_update_state_enum_to_text (detail->state));
+ }
+ issued = pk_iso8601_from_date (detail->issued);
+ if (!pk_strzero (issued)) {
+ g_print (" issued: '%s'\n", issued);
+ }
+ updated = pk_iso8601_from_date (detail->updated);
+ if (!pk_strzero (updated)) {
+ g_print (" updated: '%s'\n", updated);
+ }
+ g_free (issued);
+ g_free (updated);
}
/**
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 2610b86..bb317f9 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -599,22 +599,40 @@ pk_client_transaction_cb (DBusGProxy *proxy, const gchar *old_tid, const gchar *
static void
pk_client_update_detail_cb (DBusGProxy *proxy, const gchar *package_id, const gchar *updates,
const gchar *obsoletes, const gchar *vendor_url, const gchar *bugzilla_url,
- const gchar *cve_url, const gchar *restart_text, const gchar *update_text, PkClient *client)
+ const gchar *cve_url, const gchar *restart_text, const gchar *update_text,
+ const gchar *changelog, const gchar *state_text, const gchar *issued_text,
+ const gchar *updated_text, PkClient *client)
{
PkRestartEnum restart;
PkUpdateDetailObj *detail;
PkPackageId *id;
+ GDate *issued;
+ GDate *updated;
+ PkUpdateStateEnum state;
g_return_if_fail (PK_IS_CLIENT (client));
- pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s, %s, %s",
- package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart_text, update_text);
+ pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
+ package_id, updates, obsoletes, vendor_url, bugzilla_url,
+ cve_url, restart_text, update_text, changelog,
+ state_text, issued_text, updated_text);
+
id = pk_package_id_new_from_string (package_id);
restart = pk_restart_enum_from_text (restart_text);
+ state = pk_update_state_enum_from_text (state_text);
+ issued = pk_iso8601_to_date (issued_text);
+ updated = pk_iso8601_to_date (updated_text);
detail = pk_update_detail_obj_new_from_data (id, updates, obsoletes, vendor_url,
- bugzilla_url, cve_url, restart, update_text);
+ bugzilla_url, cve_url, restart,
+ update_text, changelog, state,
+ issued, updated);
g_signal_emit (client, signals [PK_CLIENT_UPDATE_DETAIL], 0, detail);
+
+ if (issued != NULL)
+ g_date_free (issued);
+ if (updated != NULL)
+ g_date_free (updated);
pk_package_id_free (id);
pk_update_detail_obj_free (detail);
}
@@ -3198,6 +3216,7 @@ pk_client_set_tid (PkClient *client, const gchar *tid, GError **error)
dbus_g_proxy_add_signal (proxy, "UpdateDetail",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Details",
G_TYPE_STRING, G_TYPE_STRING,
@@ -3766,9 +3785,10 @@ pk_client_init (PkClient *client)
G_TYPE_BOOLEAN, G_TYPE_INVALID);
/* UpdateDetail */
- dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* Transaction */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_BOOL_STRING_UINT_STRING,
diff --git a/libpackagekit/pk-update-detail-obj.c b/libpackagekit/pk-update-detail-obj.c
index 64b5e2a..6dab36c 100644
--- a/libpackagekit/pk-update-detail-obj.c
+++ b/libpackagekit/pk-update-detail-obj.c
@@ -56,6 +56,10 @@ pk_update_detail_obj_new (void)
obj->cve_url = NULL;
obj->restart = 0;
obj->update_text = NULL;
+ obj->changelog = NULL;
+ obj->state = PK_UPDATE_STATE_ENUM_UNKNOWN;
+ obj->issued = NULL;
+ obj->updated = NULL;
return obj;
}
@@ -70,7 +74,8 @@ pk_update_detail_obj_new (void)
PkUpdateDetailObj *
pk_update_detail_obj_new_from_data (const PkPackageId *id, const gchar *updates, const gchar *obsoletes,
const gchar *vendor_url, const gchar *bugzilla_url, const gchar *cve_url,
- PkRestartEnum restart, const gchar *update_text)
+ PkRestartEnum restart, const gchar *update_text,
+ const gchar *changelog, PkUpdateStateEnum state, GDate *issued, GDate *updated)
{
PkUpdateDetailObj *obj = NULL;
@@ -84,6 +89,12 @@ pk_update_detail_obj_new_from_data (const PkPackageId *id, const gchar *updates,
obj->cve_url = g_strdup (cve_url);
obj->restart = restart;
obj->update_text = g_strdup (update_text);
+ obj->changelog = g_strdup (changelog);
+ obj->state = state;
+ if (issued != NULL)
+ obj->issued = g_date_new_dmy (issued->day, issued->month, issued->year);
+ if (updated != NULL)
+ obj->updated = g_date_new_dmy (updated->day, updated->month, updated->year);
return obj;
}
@@ -99,7 +110,8 @@ pk_update_detail_obj_copy (const PkUpdateDetailObj *obj)
g_return_val_if_fail (obj != NULL, NULL);
return pk_update_detail_obj_new_from_data (obj->id, obj->updates, obj->obsoletes,
obj->vendor_url, obj->bugzilla_url, obj->cve_url,
- obj->restart, obj->update_text);
+ obj->restart, obj->update_text,
+ obj->changelog, obj->state, obj->issued, obj->updated);
}
/**
@@ -121,6 +133,11 @@ pk_update_detail_obj_free (PkUpdateDetailObj *obj)
g_free (obj->bugzilla_url);
g_free (obj->cve_url);
g_free (obj->update_text);
+ g_free (obj->changelog);
+ if (obj->issued)
+ g_date_free (obj->issued);
+ if (obj->updated)
+ g_date_free (obj->updated);
g_free (obj);
return TRUE;
}
diff --git a/libpackagekit/pk-update-detail-obj.h b/libpackagekit/pk-update-detail-obj.h
index c6c31d0..d585d1f 100644
--- a/libpackagekit/pk-update-detail-obj.h
+++ b/libpackagekit/pk-update-detail-obj.h
@@ -43,6 +43,10 @@ typedef struct
gchar *cve_url;
PkRestartEnum restart;
gchar *update_text;
+ gchar *changelog;
+ PkUpdateStateEnum state;
+ GDate *issued;
+ GDate *updated;
} PkUpdateDetailObj;
PkUpdateDetailObj *pk_update_detail_obj_new (void);
@@ -54,7 +58,11 @@ PkUpdateDetailObj *pk_update_detail_obj_new_from_data (const PkPackageId *id,
const gchar *bugzilla_url,
const gchar *cve_url,
PkRestartEnum restart,
- const gchar *update_text);
+ const gchar *update_text,
+ const gchar *changelog,
+ PkUpdateStateEnum state,
+ GDate *issued,
+ GDate *updated);
gboolean pk_update_detail_obj_free (PkUpdateDetailObj *obj);
G_END_DECLS
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 9fbea16..1337d1d 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -148,7 +148,7 @@ class PackageKitBaseBackend:
print >> sys.stdout,"files\t%s\t%s" % (id,file_list)
sys.stdout.flush()
- def update_detail(self,id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text):
+ def update_detail(self,id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text,changelog,state,issued,updated):
'''
Send 'updatedetail' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@@ -159,8 +159,12 @@ class PackageKitBaseBackend:
@param cve_url:
@param restart:
@param update_text:
+ @param changelog:
+ @param state:
+ @param issued:
+ @param updated:
'''
- print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text)
+ print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text,changelog,state,issued,updated)
sys.stdout.flush()
def require_restart(self,restart_type,details):
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index b6a111f..a0514f8 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -277,9 +277,9 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
- signature='ssssssss')
- def UpdateDetail(self,package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update):
- pklog.info("UpdateDetail (%s,%s,%s,%s,%s,%s,%s,%s)" % (package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update))
+ signature='ssssssssssss')
+ def UpdateDetail(self,package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update,changelog,state,issued,updated):
+ pklog.info("UpdateDetail (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % (package_id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update,changelog,state,issued,updated))
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 95e7b95..720cf2b 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -167,12 +167,17 @@ pk_backend_dbus_update_detail_cb (DBusGProxy *proxy, const gchar *package_id,
const gchar *updates, const gchar *obsoletes,
const gchar *vendor_url, const gchar *bugzilla_url,
const gchar *cve_url, const gchar *restart_text,
- const gchar *update_text, PkBackendDbus *backend_dbus)
+ const gchar *update_text, const gchar *changelog,
+ const gchar *state, const gchar *issued,
+ const gchar *updated, PkBackendDbus *backend_dbus)
{
pk_debug ("got signal");
pk_backend_update_detail (backend_dbus->priv->backend, package_id, updates,
obsoletes, vendor_url, bugzilla_url, cve_url,
- pk_restart_enum_from_text (restart_text), update_text);
+ pk_restart_enum_from_text (restart_text),
+ update_text, changelog,
+ pk_update_state_enum_from_text (state),
+ issued, updated);
}
/**
@@ -477,6 +482,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service)
dbus_g_proxy_add_signal (proxy, "UpdateDetail",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Finished",
G_TYPE_STRING, G_TYPE_INVALID);
@@ -1528,9 +1534,10 @@ pk_backend_dbus_init (PkBackendDbus *backend_dbus)
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
/* UpdateDetail */
- dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* Transaction */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_BOOL_STRING_UINT_STRING,
diff --git a/src/pk-backend-python.c b/src/pk-backend-python.c
index a154a8f..66d4d17 100644
--- a/src/pk-backend-python.c
+++ b/src/pk-backend-python.c
@@ -238,15 +238,23 @@ pk_backend_python_update_detail_cb (PyObject *self, PyObject *args)
const gchar *cve_url;
const gchar *restart_text;
const gchar *update_text;
+ const gchar *changelog;
+ const gchar *state;
+ const gchar *issued;
+ const gchar *updated;
PkBackendPython *python = PK_BACKEND_PYTHON (pk_backend_python_object);
pk_debug ("got signal");
- PyArg_ParseTuple (args, "ssssssss", &package_id, &updates, &obsoletes,
- &vendor_url, &bugzilla_url, &cve_url, &restart_text, &update_text);
+ PyArg_ParseTuple (args, "ssssssssssss", &package_id, &updates, &obsoletes,
+ &vendor_url, &bugzilla_url, &cve_url, &restart_text,
+ &update_text, &changelog, &state, &issued, &updated);
pk_backend_update_detail (python->priv->backend, package_id, updates,
obsoletes, vendor_url, bugzilla_url, cve_url,
- pk_restart_enum_from_text (restart_text), update_text);
+ pk_restart_enum_from_text (restart_text),
+ update_text, changelog,
+ pk_update_state_enum_from_text (state),
+ issued, updated);
return Py_BuildValue("");
}
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index cd9624d..17d6c89 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -92,6 +92,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
PkMessageEnum message_enum;
PkRestartEnum restart_enum;
PkSigTypeEnum sig_type;
+ PkUpdateStateEnum update_state_enum;
g_return_val_if_fail (PK_IS_BACKEND_SPAWN (backend_spawn), FALSE);
@@ -169,7 +170,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
goto out;
}
} else if (pk_strequal (command, "updatedetail")) {
- if (size != 9) {
+ if (size != 13) {
pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
@@ -181,13 +182,15 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line)
ret = FALSE;
goto out;
}
-
+ update_state_enum = pk_update_state_enum_from_text (sections[10]);
text = g_strdup (sections[8]);
/* convert ; to \n as we can't emit them on stdout */
g_strdelimit (text, ";", '\n');
- pk_backend_update_detail (backend_spawn->priv->backend, sections[1], sections[2],
- sections[3], sections[4], sections[5],
- sections[6], restart, text);
+ pk_backend_update_detail (backend_spawn->priv->backend, sections[1],
+ sections[2], sections[3], sections[4],
+ sections[5], sections[6], restart, text,
+ sections[9], update_state_enum,
+ sections[11], sections[12]);
g_free (text);
} else if (pk_strequal (command, "percentage")) {
if (size != 2) {
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 98abb7b..cac5019 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -985,11 +985,15 @@ pk_backend_update_detail (PkBackend *backend, const gchar *package_id,
const gchar *updates, const gchar *obsoletes,
const gchar *vendor_url, const gchar *bugzilla_url,
const gchar *cve_url, PkRestartEnum restart,
- const gchar *update_text)
+ const gchar *update_text, const gchar *changelog,
+ PkUpdateStateEnum state, const gchar *issued_text,
+ const gchar *updated_text)
{
gchar *update_text_safe;
PkUpdateDetailObj *detail;
PkPackageId *id;
+ GDate *issued;
+ GDate *updated;
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (package_id != NULL, FALSE);
@@ -1001,18 +1005,28 @@ pk_backend_update_detail (PkBackend *backend, const gchar *package_id,
return FALSE;
}
+ /* convert dates */
+ issued = pk_iso8601_to_date (issued_text);
+ updated = pk_iso8601_to_date (updated_text);
+
/* replace unsafe chars */
update_text_safe = pk_strsafe (update_text);
/* form PkUpdateDetailObj struct */
id = pk_package_id_new_from_string (package_id);
detail = pk_update_detail_obj_new_from_data (id, updates, obsoletes, vendor_url,
- bugzilla_url, cve_url, restart, update_text_safe);
+ bugzilla_url, cve_url, restart,
+ update_text_safe, changelog,
+ state, issued, updated);
g_signal_emit (backend, signals [PK_BACKEND_UPDATE_DETAIL], 0, detail);
pk_package_id_free (id);
pk_update_detail_obj_free (detail);
g_free (update_text_safe);
+ if (issued != NULL)
+ g_date_free (issued);
+ if (updated != NULL)
+ g_date_free (updated);
return TRUE;
}
diff --git a/src/pk-backend.h b/src/pk-backend.h
index ebc857d..6f50253 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -96,7 +96,11 @@ gboolean pk_backend_update_detail (PkBackend *backend,
const gchar *bugzilla_url,
const gchar *cve_url,
PkRestartEnum restart,
- const gchar *update_text);
+ const gchar *update_text,
+ const gchar *changelog,
+ PkUpdateStateEnum state,
+ const gchar *issued,
+ const gchar *updated);
gboolean pk_backend_require_restart (PkBackend *backend,
PkRestartEnum restart,
const gchar *details);
diff --git a/src/pk-interface-transaction.xml b/src/pk-interface-transaction.xml
index 4bc4250..fb59409 100644
--- a/src/pk-interface-transaction.xml
+++ b/src/pk-interface-transaction.xml
@@ -2003,6 +2003,43 @@
</doc:summary>
</doc:doc>
</arg>
+ <arg type="s" name="changelog" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The ChangeLog text describing the changes since the last version.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="state" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The state of the update, e.g. <literal>stable</literal> or
+ <literal>testing</literal>.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="issued" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The ISO8601 encoded date that the update was issued.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="s" name="updated" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The ISO8601 encoded date that the update was updated.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
</signal>
</interface>
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index ace2354..40646e0 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -14,8 +14,10 @@ VOID:STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING
-VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index dcee768..30c7f51 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -739,7 +739,10 @@ static void
pk_transaction_update_detail_cb (PkBackend *backend, const PkUpdateDetailObj *detail, PkTransaction *transaction)
{
const gchar *restart_text;
+ const gchar *state_text;
gchar *package_id;
+ gchar *issued;
+ gchar *updated;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -749,9 +752,17 @@ pk_transaction_update_detail_cb (PkBackend *backend, const PkUpdateDetailObj *de
restart_text = pk_restart_enum_to_text (detail->restart);
package_id = pk_package_id_to_string (detail->id);
+ state_text = pk_update_state_enum_to_text (detail->state);
+ issued = pk_iso8601_from_date (detail->issued);
+ updated = pk_iso8601_from_date (detail->updated);
+
g_signal_emit (transaction, signals [PK_TRANSACTION_UPDATE_DETAIL], 0,
package_id, detail->updates, detail->obsoletes, detail->vendor_url,
- detail->bugzilla_url, detail->cve_url, restart_text, detail->update_text);
+ detail->bugzilla_url, detail->cve_url, restart_text, detail->update_text,
+ detail->changelog, state_text, issued, updated);
+
+ g_free (issued);
+ g_free (updated);
g_free (package_id);
}
@@ -1850,12 +1861,22 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
detail = pk_update_detail_list_get_obj (transaction->priv->update_detail_list, id);
pk_package_id_free (id);
if (detail != NULL) {
+ gchar *issued;
+ gchar *updated;
+ const gchar *state_text;
package_id = pk_package_id_to_string (detail->id);
+ issued = pk_iso8601_from_date (detail->issued);
+ updated = pk_iso8601_from_date (detail->updated);
+ state_text = pk_update_state_enum_to_text (detail->state);
+
/* emulate the backend */
g_signal_emit (transaction, signals [PK_TRANSACTION_UPDATE_DETAIL], 0,
package_id, detail->updates, detail->obsoletes,
detail->vendor_url, detail->bugzilla_url, detail->cve_url,
- pk_restart_enum_to_text (detail->restart), detail->update_text);
+ pk_restart_enum_to_text (detail->restart), detail->update_text,
+ detail->changelog, state_text, issued, updated);
+ g_free (issued);
+ g_free (updated);
g_free (package_id);
} else {
pk_debug ("not got %s", package_ids[i]);
@@ -3226,8 +3247,9 @@ pk_transaction_class_init (PkTransactionClass *klass)
signals [PK_TRANSACTION_UPDATE_DETAIL] =
g_signal_new ("update-detail",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 8, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 12, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
g_type_class_add_private (klass, sizeof (PkTransactionPrivate));
commit 3108f299637c59ae4736d6d854d6bd34ec6ceccb
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 14:01:38 2008 +0100
trivial: make the new ISO8601 functions a little more sane
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 07af693..57d057c 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -186,14 +186,19 @@ pk_iso8601_difference (const gchar *isodate)
}
/**
- * pk_date_to_iso8601:
+ * pk_iso8601_from_date:
+ * @isodate: a %GDate to convert
+ *
+ * Return value: If valid then a new ISO8601 date, else NULL
**/
gchar *
-pk_date_to_iso8601 (const GDate *date)
+pk_iso8601_from_date (const GDate *date)
{
gsize retval;
gchar iso_date[128];
+ if (date == NULL)
+ return NULL;
retval = g_date_strftime (iso_date, 128, "%F", date);
if (retval == 0)
return NULL;
@@ -201,33 +206,40 @@ pk_date_to_iso8601 (const GDate *date)
}
/**
- * pk_date_set_iso8601:
- **/
-gboolean
-pk_date_set_iso8601 (GDate *date, const gchar *iso_date)
-{
- gboolean ret;
- g_date_set_parse (date, iso_date);
- ret = g_date_valid (date);
- return ret;
-}
-
-/**
- * pk_date_from_iso8601:
+ * pk_iso8601_to_date:
+ * @isodate: The ISO8601 date to convert
+ *
+ * Return value: If valid then a new %GDate, else NULL
**/
GDate *
-pk_date_from_iso8601 (const gchar *iso_date)
+pk_iso8601_to_date (const gchar *iso_date)
{
gboolean ret;
+ guint retval;
+ guint d, m, y;
GTimeVal time;
GDate *date = NULL;
+ if (pk_strzero (iso_date))
+ goto out;
+
+ /* try to parse complete ISO8601 date */
ret = g_time_val_from_iso8601 (iso_date, &time);
- if (!ret)
+ if (ret) {
+ date = g_date_new ();
+ g_date_set_time_val (date, &time);
goto out;
+ }
- date = g_date_new ();
- g_date_set_parse (date, iso_date);
+ /* g_time_val_from_iso8601() blows goats and won't
+ * accept a valid ISO8601 formatted date without a
+ * time value - try and parse this case */
+ retval = sscanf (iso_date, "%i-%i-%i", &y, &m, &d);
+ if (retval == 3) {
+ date = g_date_new_dmy (d, m, y);
+ goto out;
+ }
+ pk_warning ("could not parse '%s'", iso_date);
out:
return date;
}
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index f8ae74d..e152678 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -102,12 +102,10 @@ gboolean pk_strcmp_sections (const gchar *id1,
gchar *pk_iso8601_present (void)
G_GNUC_WARN_UNUSED_RESULT;
guint pk_iso8601_difference (const gchar *isodate);
+gchar *pk_iso8601_from_date (const GDate *date);
+GDate *pk_iso8601_to_date (const gchar *iso_date);
gchar *pk_get_distro_id (void)
G_GNUC_WARN_UNUSED_RESULT;
-gchar *pk_date_to_iso8601 (const GDate *date);
-gboolean pk_date_set_iso8601 (GDate *date,
- const gchar *iso_date);
-GDate *pk_date_from_iso8601 (const gchar *iso_date);
G_END_DECLS
commit 436c8e94bfad55bee2e08692bc5080485c39e80f
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 14:01:09 2008 +0100
trivial: correct the registered sig on RepoSignatureRequired -- this didn't matter until now
as the UpdateDetail has the correct signature which means we didn't get an error
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 80c9248..2610b86 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -3749,10 +3749,11 @@ pk_client_init (PkClient *client)
G_TYPE_NONE, 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,
+ /* RepoSignatureRequired */
+ 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, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* Package */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING,
commit 61191e8524984afd6f7ff0fdd12072339b9e1bc7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 12:15:00 2008 +0100
add some convenience helpers for managing iso8601 dates
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 5abd04a..07af693 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -186,6 +186,53 @@ pk_iso8601_difference (const gchar *isodate)
}
/**
+ * pk_date_to_iso8601:
+ **/
+gchar *
+pk_date_to_iso8601 (const GDate *date)
+{
+ gsize retval;
+ gchar iso_date[128];
+
+ retval = g_date_strftime (iso_date, 128, "%F", date);
+ if (retval == 0)
+ return NULL;
+ return g_strdup (iso_date);
+}
+
+/**
+ * pk_date_set_iso8601:
+ **/
+gboolean
+pk_date_set_iso8601 (GDate *date, const gchar *iso_date)
+{
+ gboolean ret;
+ g_date_set_parse (date, iso_date);
+ ret = g_date_valid (date);
+ return ret;
+}
+
+/**
+ * pk_date_from_iso8601:
+ **/
+GDate *
+pk_date_from_iso8601 (const gchar *iso_date)
+{
+ gboolean ret;
+ GTimeVal time;
+ GDate *date = NULL;
+
+ ret = g_time_val_from_iso8601 (iso_date, &time);
+ if (!ret)
+ goto out;
+
+ date = g_date_new ();
+ g_date_set_parse (date, iso_date);
+out:
+ return date;
+}
+
+/**
* pk_strvalidate_char:
* @item: A single char to test
*
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index fb20184..f8ae74d 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -104,6 +104,10 @@ gchar *pk_iso8601_present (void)
guint pk_iso8601_difference (const gchar *isodate);
gchar *pk_get_distro_id (void)
G_GNUC_WARN_UNUSED_RESULT;
+gchar *pk_date_to_iso8601 (const GDate *date);
+gboolean pk_date_set_iso8601 (GDate *date,
+ const gchar *iso_date);
+GDate *pk_date_from_iso8601 (const gchar *iso_date);
G_END_DECLS
commit 0a90a79d4a82a760eb8afc602703de089742f218
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 12:12:43 2008 +0100
Add PkUpdateStatus enumerated types for the upcoming UpdateDetail API change
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index d96bd9f..e13d8bb 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -251,6 +251,14 @@ static PkEnumMatch enum_update[] = {
{0, NULL}
};
+static PkEnumMatch enum_update_state[] = {
+ {PK_UPDATE_STATE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
+ {PK_UPDATE_STATE_ENUM_TESTING, "testing"},
+ {PK_UPDATE_STATE_ENUM_UNSTABLE, "unstable"},
+ {PK_UPDATE_STATE_ENUM_STABLE, "stable"},
+ {0, NULL}
+};
+
static PkEnumMatch enum_info[] = {
{PK_INFO_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_INFO_ENUM_INSTALLED, "installed"},
@@ -1019,6 +1027,34 @@ pk_update_enum_to_text (PkUpdateEnum update)
}
/**
+ * pk_update_state_enum_from_text:
+ * @update_state: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. %PK_UPDATE_STATE_ENUM_STABLE
+ **/
+PkUpdateStateEnum
+pk_update_state_enum_from_text (const gchar *update_state)
+{
+ return pk_enum_find_value (enum_update_state, update_state);
+}
+
+/**
+ * pk_update_state_enum_to_text:
+ * @update_state: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "testing"
+ **/
+const gchar *
+pk_update_state_enum_to_text (PkUpdateStateEnum update_state)
+{
+ return pk_enum_find_string (enum_update_state, update_state);
+}
+
+/**
* pk_filter_enum_from_text:
* @filter: Text describing the enumerated type
*
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index c64c559..21461b3 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -325,6 +325,18 @@ typedef enum {
} PkUpdateEnum;
/**
+ * PkUpdateStateEnum:
+ *
+ * What state the update is in
+ **/
+typedef enum {
+ PK_UPDATE_STATE_ENUM_STABLE,
+ PK_UPDATE_STATE_ENUM_UNSTABLE,
+ PK_UPDATE_STATE_ENUM_TESTING,
+ PK_UPDATE_STATE_ENUM_UNKNOWN
+} PkUpdateStateEnum;
+
+/**
* PkInfoEnum:
*
* The enumerated types used in Package() - these have to refer to a specific
@@ -521,6 +533,9 @@ const gchar *pk_info_enum_to_text (PkInfoEnum info);
PkUpdateEnum pk_update_enum_from_text (const gchar *update);
const gchar *pk_update_enum_to_text (PkUpdateEnum update);
+PkUpdateStateEnum pk_update_state_enum_from_text (const gchar *update_state);
+const gchar *pk_update_state_enum_to_text (PkUpdateStateEnum update_state);
+
PkFreqEnum pk_freq_enum_from_text (const gchar *freq);
const gchar *pk_freq_enum_to_text (PkFreqEnum freq);
commit 68917da75e422d96129bf84e3f1bd592659d6764
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 12:10:45 2008 +0100
trivial: remove == FALSE from pk-console.c, i don't like it
diff --git a/client/pk-console.c b/client/pk-console.c
index 2a45324..64b00e8 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -280,7 +280,7 @@ pk_console_pulse_bar (PulseState *pulse_state)
} else {
pulse_state->position++;
}
- } else if (pulse_state->move_forward == FALSE) {
+ } else if (!pulse_state->move_forward) {
if (pulse_state->position == 1) {
pulse_state->move_forward = TRUE;
} else {
@@ -728,7 +728,7 @@ pk_console_remove_packages (PkClient *client, gchar **packages, GError **error)
remove = pk_console_get_prompt (_("Okay to remove additional packages?"), FALSE);
/* we chickened out */
- if (remove == FALSE) {
+ if (!remove) {
g_print ("%s\n", _("Cancelled!"));
ret = FALSE;
goto out;
@@ -1125,7 +1125,7 @@ pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointe
if (awaiting_space) {
g_print ("\n");
}
- if (connected == FALSE) {
+ if (!connected) {
g_print ("%s\n", _("The daemon crashed mid-transaction!"));
exit (2);
}
commit dbda31ae277f6b1dccf3f319a31e43b9819d6f90
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 10:31:54 2008 +0100
trivial: remove commented out includes
diff --git a/docs/html/files/system.c b/docs/html/files/system.c
index b1e94de..47b499f 100644
--- a/docs/html/files/system.c
+++ b/docs/html/files/system.c
@@ -1,10 +1,6 @@
-//#include <pk-package-ids.h>
#include <pk-enum.h>
#include <pk-client.h>
#include <pk-control.h>
-//#include <pk-package-id.h>
-//#include <pk-common.h>
-//#include <pk-connection.h>
/**
* main:
commit 12a8462f6f59c0ba34e3b09ffcca8d59acdf4f2c
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 10:26:37 2008 +0100
trivial: add a system client example into the FAQ
diff --git a/docs/html/files/.gitignore b/docs/html/files/.gitignore
new file mode 100644
index 0000000..7802a1d
--- /dev/null
+++ b/docs/html/files/.gitignore
@@ -0,0 +1,3 @@
+system
+session
+
diff --git a/docs/html/files/installer.c b/docs/html/files/installer.c
deleted file mode 100644
index 6f658fc..0000000
--- a/docs/html/files/installer.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <dbus/dbus-glib.h>
-
-/**
- * main:
- **/
-int
-main (int argc, char *argv[])
-{
- DBusGConnection *connection;
- DBusGProxy *proxy;
- GError *error = NULL;
- gboolean ret;
-
- g_type_init ();
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- proxy = dbus_g_proxy_new_for_name (connection,
- "org.freedesktop.PackageKit",
- "/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit");
-
- /* execute sync method */
- ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,
- G_TYPE_STRING, "openoffice-clipart",
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (!ret) {
- g_warning ("failed: %s", error->message);
- g_error_free (error);
- }
- return 0;
-}
-
diff --git a/docs/html/files/session.c b/docs/html/files/session.c
new file mode 100644
index 0000000..cfdb1a6
--- /dev/null
+++ b/docs/html/files/session.c
@@ -0,0 +1,36 @@
+#include <dbus/dbus-glib.h>
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+ DBusGConnection *connection;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean ret;
+
+ /* init the types system */
+ g_type_init ();
+
+ /* get a session bus connection */
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+
+ /* connect to PackageKit */
+ proxy = dbus_g_proxy_new_for_name (connection,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit");
+
+ /* execute sync method */
+ ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,
+ G_TYPE_STRING, "openoffice-clipart",
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (!ret) {
+ g_warning ("failed: %s", error->message);
+ g_error_free (error);
+ }
+ return 0;
+}
+
diff --git a/docs/html/files/system.c b/docs/html/files/system.c
new file mode 100644
index 0000000..b1e94de
--- /dev/null
+++ b/docs/html/files/system.c
@@ -0,0 +1,77 @@
+//#include <pk-package-ids.h>
+#include <pk-enum.h>
+#include <pk-client.h>
+#include <pk-control.h>
+//#include <pk-package-id.h>
+//#include <pk-common.h>
+//#include <pk-connection.h>
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+ guint i;
+ guint length;
+ gboolean ret;
+ GError *error = NULL;
+ const PkPackageObj *obj;
+ PkPackageList *list = NULL;
+ PkControl *control = NULL;
+ PkClient *client = NULL;
+ PkRoleEnum roles;
+
+ /* init the types system */
+ g_type_init ();
+
+ /* find out if we can do GetUpdates */
+ control = pk_control_new ();
+ roles = pk_control_get_actions (control);
+ if (!pk_enums_contain (roles, PK_ROLE_ENUM_GET_UPDATES)) {
+ g_warning ("Backend does not support GetUpdates()");
+ goto out;
+ }
+
+ /* create a new client instance */
+ client = pk_client_new ();
+
+ /* save all the results as we are not using an async callback */
+ pk_client_set_use_buffer (client, TRUE, NULL);
+
+ /* block for the results, does not require gtk_main() or anything */
+ pk_client_set_synchronous (client, TRUE, NULL);
+
+ /* get the update list (but only return the newest updates) */
+ ret = pk_client_get_updates (client, PK_FILTER_ENUM_NEWEST, &error);
+ if (!ret) {
+ g_warning ("failed: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get the buffered package list */
+ list = pk_client_get_package_list (client);
+ if (list == NULL) {
+ g_warning ("failed to get buffered list");
+ goto out;
+ }
+
+ length = pk_package_list_get_size (list);
+ for (i=0; i<length; i++) {
+ /* get each package to be updated, and print to the screen */
+ obj = pk_package_list_get_obj (list, i);
+ g_print ("%i. %s-%s.%s\t%s\n", i, obj->id->name, obj->id->version, obj->id->arch, obj->summary);
+ }
+
+out:
+ /* free any GObjects we used */
+ if (list != NULL)
+ g_object_unref (list);
+ if (control != NULL)
+ g_object_unref (control);
+ if (client != NULL)
+ g_object_unref (client);
+ return 0;
+}
+
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index fd99929..ffd15f9 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -204,6 +204,17 @@ custom dialogs</a> without running the extra session process, then use libpackag
If you don't care, and just want things to <i>work</i> then
<a href="http://www.packagekit.org/pk-faq.html#session-methods">use the session interface</a>.
</p>
+<p>
+If you want a demo, you can download <a href="files/session.c">session.c</a> for a
+session example and <a href="files/system.c">system.c</a> as a system example.
+</p>
+<p>
+Compile with:
+</p>
+<pre>
+gcc -o session -Wall session.c `pkg-config --cflags --libs dbus-glib-1`
+gcc -o system -Wall system.c `pkg-config --cflags --libs packagekit`
+</pre>
<hr>
<h3><a name="session-methods">How do I use PackageKit in my application?</a></h3>
@@ -253,12 +264,6 @@ if (!ret) {
}
</pre>
<p>
-If you want a demo, you can download <a href="files/installer.c">this file</a> and then run:
-</p>
-<pre>
-gcc -o installer -Wall installer.c `pkg-config --cflags --libs dbus-glib-1`
-</pre>
-<p>
or in python...
</p>
<pre>
diff --git a/docs/html/upload.sh b/docs/html/upload.sh
index aae167b..1d70a6c 100755
--- a/docs/html/upload.sh
+++ b/docs/html/upload.sh
@@ -11,6 +11,7 @@ USER="hughsie"
SERVER="packagekit.org"
LOCATION="/srv/www/html"
+scp files/*.c $USER@$SERVER:/$LOCATION/files/
scp img/*.png $USER@$SERVER:/$LOCATION/img/
scp *.html $USER@$SERVER:/$LOCATION/
scp *.css $USER@$SERVER:/$LOCATION/
commit 29a21f19b087e3a939fc0b18b069f1fbccc71725
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 09:58:27 2008 +0100
remove the libgbus private library
Having a set of private and one shared library is causing a pain, so move the trivially small
LibGBus GObject into libpackagekit as PkDbusMonitor. This should fix compilation and fix the
code duplication
diff --git a/Makefile.am b/Makefile.am
index 7e753cb..ec3a4c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,6 @@ SUBDIRS = \
contrib \
data \
libselftest \
- libgbus \
libpackagekit \
src \
client \
diff --git a/configure.ac b/configure.ac
index 32148b2..cf45ec9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -534,7 +534,6 @@ data/org.freedesktop.PackageKitYumBackend.conf
data/org.freedesktop.PackageKitAptBackend.conf
data/tests/Makefile
libselftest/Makefile
-libgbus/Makefile
libpackagekit/Makefile
policy/Makefile
src/Makefile
diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am
index b9f9c4d..d6fe3d6 100644
--- a/docs/api/Makefile.am
+++ b/docs/api/Makefile.am
@@ -77,7 +77,6 @@ INCLUDES = \
-I$(top_builddir)/libpackagekit \
-I$(top_srcdir)/libpackagekit \
-I$(top_srcdir)/libselftest \
- -I$(top_srcdir)/libgbus \
$(NULL)
PK_LIBS = $(top_builddir)/libpackagekit/libpackagekit.la
diff --git a/libgbus/.gitignore b/libgbus/.gitignore
deleted file mode 100644
index e9199c5..0000000
--- a/libgbus/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-.libs
-*.o
-*.la
-*.lo
-*-marshal.c
-*-marshal.h
-*.gcov
-*.gcda
-*.gcno
-
diff --git a/libgbus/Makefile.am b/libgbus/Makefile.am
deleted file mode 100644
index 1162dda..0000000
--- a/libgbus/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-INCLUDES = \
- $(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
- -I$(top_srcdir)/libgbus-glib \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-
-noinst_LTLIBRARIES = \
- libgbus.la
-
-libgbus_la_SOURCES = \
- libgbus-marshal.h \
- libgbus-marshal.c \
- libgbus.c \
- libgbus.h
-libgbus_la_LIBADD = $(DBUS_LIBS) $(INTLLIBS) $(GLIB_LIBS)
-
-EXTRA_DIST = \
- libgbus-marshal.list
-
-BUILT_SOURCES = \
- libgbus-marshal.c \
- libgbus-marshal.h
-
-libgbus-marshal.c: libgbus-marshal.list
- echo "#include \"libgbus-marshal.h\"" > $@ && \
- @GLIB_GENMARSHAL@ $< --prefix=libgbus_marshal --body >> $@
-
-libgbus-marshal.h: libgbus-marshal.list
- @GLIB_GENMARSHAL@ $< --prefix=libgbus_marshal --header > $@
-
-clean-local:
- rm -f *~
- rm -f *.out
- rm -f *.gcno
- rm -f *.gcda
- rm -f gcov.txt
- rm -f gprof.txt
- rm -f $(BUILT_SOURCES)
-
-CLEANFILES = $(BUILT_SOURCES)
-
diff --git a/libgbus/libgbus-marshal.list b/libgbus/libgbus-marshal.list
deleted file mode 100644
index ebadca8..0000000
--- a/libgbus/libgbus-marshal.list
+++ /dev/null
@@ -1,2 +0,0 @@
-NONE:STRING,STRING,STRING
-
diff --git a/libgbus/libgbus.c b/libgbus/libgbus.c
deleted file mode 100644
index ce91b6b..0000000
--- a/libgbus/libgbus.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2006-2007 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus.h>
-
-#include <libgbus.h>
-
-static void libgbus_class_init (LibGBusClass *klass);
-static void libgbus_init (LibGBus *watch);
-static void libgbus_finalize (GObject *object);
-
-#define LIBGBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LIBGBUS_TYPE, LibGBusPrivate))
-
-struct LibGBusPrivate
-{
- LibGBusType bus_type;
- gchar *service;
- DBusGProxy *proxy;
- DBusGConnection *connection;
- const gchar *unique_name;
-};
-
-enum {
- CONNECTION_CHANGED,
- CONNECTION_REPLACED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (LibGBus, libgbus, G_TYPE_OBJECT)
-
-/**
- * name_owner_changed_cb:
- **/
-static void
-name_owner_changed_cb (DBusGProxy *proxy,
- const gchar *name,
- const gchar *prev,
- const gchar *new,
- LibGBus *libgbus)
-{
- guint new_len;
- guint prev_len;
-
- g_return_if_fail (IS_LIBGBUS (libgbus));
- if (libgbus->priv->proxy == NULL) {
- return;
- }
-
- /* not us */
- if (strcmp (name, libgbus->priv->service) != 0) {
- return;
- }
-
- /* ITS4: ignore, not used for allocation */
- new_len = strlen (new);
- /* ITS4: ignore, not used for allocation */
- prev_len = strlen (prev);
-
- /* something --> nothing */
- if (prev_len != 0 && new_len == 0) {
- g_signal_emit (libgbus, signals [CONNECTION_CHANGED], 0, FALSE);
- return;
- }
-
- /* nothing --> something */
- if (prev_len == 0 && new_len != 0) {
- g_signal_emit (libgbus, signals [CONNECTION_CHANGED], 0, TRUE);
- return;
- }
-
- /* something --> something (we've replaced the old process) */
- if (prev_len != 0 && new_len != 0) {
- /* only send this to the prev client */
- if (strcmp (libgbus->priv->unique_name, prev) == 0) {
- g_signal_emit (libgbus, signals [CONNECTION_REPLACED], 0);
- }
- return;
- }
-}
-
-/**
- * libgbus_assign:
- * @libgbus: This class instance
- * @bus_type: The bus type, either LIBGBUS_SESSION or LIBGBUS_SYSTEM
- * @service: The LIBGBUS service name
- * Return value: success
- *
- * Emits connection-changed(TRUE) if connection is alive - this means you
- * have to connect up the callback before this function is called.
- **/
-gboolean
-libgbus_assign (LibGBus *libgbus,
- LibGBusType bus_type,
- const gchar *service)
-{
- GError *error = NULL;
- gboolean connected;
- DBusConnection *conn;
-
- g_return_val_if_fail (IS_LIBGBUS (libgbus), FALSE);
- g_return_val_if_fail (service != NULL, FALSE);
-
- if (libgbus->priv->proxy != NULL) {
- g_warning ("already assigned!");
- return FALSE;
- }
-
- libgbus->priv->service = g_strdup (service);
- libgbus->priv->bus_type = bus_type;
-
- /* connect to correct bus */
- if (bus_type == LIBGBUS_SESSION) {
- libgbus->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- } else {
- libgbus->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- }
- if (error != NULL) {
- g_warning ("Cannot connect to bus: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- libgbus->priv->proxy = dbus_g_proxy_new_for_name_owner (libgbus->priv->connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS,
- &error);
- if (error != NULL) {
- g_warning ("Cannot connect to DBUS: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- dbus_g_proxy_add_signal (libgbus->priv->proxy, "NameOwnerChanged",
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (libgbus->priv->proxy, "NameOwnerChanged",
- G_CALLBACK (name_owner_changed_cb),
- libgbus, NULL);
-
- /* coldplug */
- connected = libgbus_is_connected (libgbus);
- if (connected == TRUE) {
- g_signal_emit (libgbus, signals [CONNECTION_CHANGED], 0, TRUE);
- }
-
- /* save this for the replaced check */
- conn = dbus_g_connection_get_connection (libgbus->priv->connection);
- libgbus->priv->unique_name = dbus_bus_get_unique_name (conn);
- return TRUE;
-}
-
-/**
- * libgbus_is_connected:
- * @libgbus: This class instance
- * Return value: if we are connected to a valid watch
- **/
-gboolean
-libgbus_is_connected (LibGBus *libgbus)
-{
- DBusError error;
- DBusConnection *conn;
- gboolean ret;
- g_return_val_if_fail (IS_LIBGBUS (libgbus), FALSE);
-
- /* get raw connection */
- conn = dbus_g_connection_get_connection (libgbus->priv->connection);
- dbus_error_init (&error);
- ret = dbus_bus_name_has_owner (conn, libgbus->priv->service, &error);
- if (dbus_error_is_set (&error)) {
- g_debug ("error: %s", error.message);
- dbus_error_free (&error);
- }
-
- return ret;
-}
-
-/**
- * libgbus_class_init:
- * @libgbus: This class instance
- **/
-static void
-libgbus_class_init (LibGBusClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = libgbus_finalize;
- g_type_class_add_private (klass, sizeof (LibGBusPrivate));
-
- signals [CONNECTION_CHANGED] =
- g_signal_new ("connection-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (LibGBusClass, connection_changed),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
- signals [CONNECTION_REPLACED] =
- g_signal_new ("connection-replaced",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (LibGBusClass, connection_replaced),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-/**
- * libgbus_init:
- * @libgbus: This class instance
- **/
-static void
-libgbus_init (LibGBus *libgbus)
-{
- libgbus->priv = LIBGBUS_GET_PRIVATE (libgbus);
-
- libgbus->priv->service = NULL;
- libgbus->priv->bus_type = LIBGBUS_SESSION;
- libgbus->priv->proxy = NULL;
-}
-
-/**
- * libgbus_finalize:
- * @object: This class instance
- **/
-static void
-libgbus_finalize (GObject *object)
-{
- LibGBus *libgbus;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_LIBGBUS (object));
-
- libgbus = LIBGBUS_OBJECT (object);
- libgbus->priv = LIBGBUS_GET_PRIVATE (libgbus);
-
- if (libgbus->priv->proxy != NULL) {
- g_object_unref (libgbus->priv->proxy);
- }
- G_OBJECT_CLASS (libgbus_parent_class)->finalize (object);
-}
-
-/**
- * libgbus_new:
- * Return value: new class instance.
- **/
-LibGBus *
-libgbus_new (void)
-{
- LibGBus *libgbus;
- libgbus = g_object_new (LIBGBUS_TYPE, NULL);
- return LIBGBUS_OBJECT (libgbus);
-}
-
diff --git a/libgbus/libgbus.h b/libgbus/libgbus.h
deleted file mode 100644
index 78697ab..0000000
--- a/libgbus/libgbus.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2006-2007 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __LIBGBUS_H
-#define __LIBGBUS_H
-
-#include <glib-object.h>
-#include <dbus/dbus-glib.h>
-
-G_BEGIN_DECLS
-
-#define LIBGBUS_TYPE (libgbus_get_type ())
-#define LIBGBUS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), LIBGBUS_TYPE, LibGBus))
-#define LIBGBUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), LIBGBUS_TYPE, LibGBusClass))
-#define IS_LIBGBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), LIBGBUS_TYPE))
-#define IS_LIBGBUS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), LIBGBUS_TYPE))
-#define LIBGBUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LIBGBUS_TYPE, LibGBusClass))
-
-typedef struct LibGBusPrivate LibGBusPrivate;
-
-typedef struct
-{
- GObject parent;
- LibGBusPrivate *priv;
-} LibGBus;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (* connection_changed) (LibGBus *watch,
- gboolean connected);
- void (* connection_replaced) (LibGBus *watch);
-} LibGBusClass;
-
-typedef enum {
- LIBGBUS_SESSION,
- LIBGBUS_SYSTEM
-} LibGBusType;
-
-GType libgbus_get_type (void);
-LibGBus *libgbus_new (void);
-
-gboolean libgbus_assign (LibGBus *libgbus,
- LibGBusType bus_type,
- const gchar *service);
-gboolean libgbus_is_connected (LibGBus *libgbus);
-
-G_END_DECLS
-
-#endif /* __LIBGBUS_H */
-
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index 14bf3f6..ab32df8 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -7,17 +7,12 @@ INCLUDES = \
$(POLKIT_CFLAGS) \
$(SQLITE_CFLAGS) \
-I$(top_srcdir)/libpackagekit \
- -I$(top_srcdir)/libgbus \
-I$(top_srcdir)/libselftest \
-DPK_DB_DIR=\""$(PK_DB_DIR)"\" \
-DPK_LOG_DIR=\""$(PK_LOG_DIR)"\" \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-GBUS_LIBS = \
- $(top_builddir)/libgbus/libgbus.la \
- $(NULL)
-
SELFTEST_LIBS = \
$(top_builddir)/libselftest/libselftest.la \
$(NULL)
@@ -46,6 +41,7 @@ libpackagekit_include_HEADERS = \
pk-enum.h \
pk-common.h \
pk-client.h \
+ pk-dbus-monitor.h \
pk-catalog.h \
pk-control.h \
pk-task-list.h \
@@ -58,6 +54,8 @@ libpackagekit_la_SOURCES = \
pk-marshal.h \
pk-extra.c \
pk-extra.h \
+ pk-dbus-monitor.c \
+ pk-dbus-monitor.h \
pk-connection.c \
pk-connection.h \
pk-package-id.c \
@@ -91,7 +89,6 @@ libpackagekit_la_SOURCES = \
libpackagekit_la_LIBADD = \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
- $(GBUS_LIBS) \
$(POLKIT_LIBS) \
$(SQLITE_LIBS) \
$(NULL)
diff --git a/libpackagekit/pk-connection.c b/libpackagekit/pk-connection.c
index 5800656..219c180 100644
--- a/libpackagekit/pk-connection.c
+++ b/libpackagekit/pk-connection.c
@@ -41,7 +41,7 @@
#endif /* HAVE_UNISTD_H */
#include <glib/gi18n.h>
-#include <libgbus.h>
+#include <pk-dbus-monitor.h>
#include "pk-debug.h"
#include "pk-common.h"
@@ -56,7 +56,7 @@
**/
struct _PkConnectionPrivate
{
- LibGBus *libgbus;
+ PkDbusMonitor *monitor;
};
enum {
@@ -78,7 +78,7 @@ G_DEFINE_TYPE (PkConnection, pk_connection, G_TYPE_OBJECT)
gboolean
pk_connection_valid (PkConnection *connection)
{
- return libgbus_is_connected (connection->priv->libgbus);
+ return pk_dbus_monitor_is_connected (connection->priv->monitor);
}
/**
@@ -93,7 +93,7 @@ pk_connection_finalize (GObject *object)
connection = PK_CONNECTION (object);
g_return_if_fail (connection->priv != NULL);
- g_object_unref (connection->priv->libgbus);
+ g_object_unref (connection->priv->monitor);
G_OBJECT_CLASS (pk_connection_parent_class)->finalize (object);
}
@@ -124,7 +124,7 @@ pk_connection_class_init (PkConnectionClass *klass)
* pk_connection_connection_changed_cb:
**/
static void
-pk_connection_connection_changed_cb (LibGBus *libgbus, gboolean connected, PkConnection *connection)
+pk_connection_connection_changed_cb (PkDbusMonitor *pk_dbus_monitor, gboolean connected, PkConnection *connection)
{
pk_debug ("emit connection-changed: %i", connected);
g_signal_emit (connection , signals [CONNECTION_CHANGED], 0, connected);
@@ -137,12 +137,12 @@ static void
pk_connection_init (PkConnection *connection)
{
connection->priv = PK_CONNECTION_GET_PRIVATE (connection);
- connection->priv->libgbus = libgbus_new ();
- g_signal_connect (connection->priv->libgbus, "connection-changed",
+ connection->priv->monitor = pk_dbus_monitor_new ();
+ g_signal_connect (connection->priv->monitor, "connection-changed",
G_CALLBACK (pk_connection_connection_changed_cb), connection);
/* hardcode to PackageKit */
- libgbus_assign (connection->priv->libgbus, LIBGBUS_SYSTEM, PK_DBUS_SERVICE);
+ pk_dbus_monitor_assign (connection->priv->monitor, PK_DBUS_MONITOR_SYSTEM, PK_DBUS_SERVICE);
}
/**
diff --git a/libpackagekit/pk-dbus-monitor.c b/libpackagekit/pk-dbus-monitor.c
new file mode 100644
index 0000000..feb29dd
--- /dev/null
+++ b/libpackagekit/pk-dbus-monitor.c
@@ -0,0 +1,271 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2006-2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus.h>
+
+#include "pk-debug.h"
+#include "pk-marshal.h"
+#include "pk-dbus-monitor.h"
+
+static void pk_dbus_monitor_class_init (PkDbusMonitorClass *klass);
+static void pk_dbus_monitor_init (PkDbusMonitor *dbus_monitor);
+static void pk_dbus_monitor_finalize (GObject *object);
+
+#define PK_DBUS_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_DBUS_MONITOR, PkDbusMonitorPrivate))
+
+struct PkDbusMonitorPrivate
+{
+ PkDbusMonitorType bus_type;
+ gchar *service;
+ DBusGProxy *proxy;
+ DBusGConnection *connection;
+ const gchar *unique_name;
+};
+
+enum {
+ PK_DBUS_MONITOR_CONNECTION_CHANGED,
+ PK_DBUS_MONITOR_CONNECTION_REPLACED,
+ PK_DBUS_MONITOR_LAST_SIGNAL
+};
+
+static guint signals [PK_DBUS_MONITOR_LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (PkDbusMonitor, pk_dbus_monitor, G_TYPE_OBJECT)
+
+/**
+ * pk_dbus_monitor_name_owner_changed_cb:
+ **/
+static void
+pk_dbus_monitor_name_owner_changed_cb (DBusGProxy *proxy, const gchar *name,
+ const gchar *prev, const gchar *new,
+ PkDbusMonitor *monitor)
+{
+ guint new_len;
+ guint prev_len;
+
+ g_return_if_fail (PK_IS_DBUS_MONITOR (monitor));
+ if (monitor->priv->proxy == NULL) {
+ return;
+ }
+
+ /* not us */
+ if (strcmp (name, monitor->priv->service) != 0) {
+ return;
+ }
+
+ /* ITS4: ignore, not used for allocation */
+ new_len = strlen (new);
+ /* ITS4: ignore, not used for allocation */
+ prev_len = strlen (prev);
+
+ /* something --> nothing */
+ if (prev_len != 0 && new_len == 0) {
+ g_signal_emit (monitor, signals [PK_DBUS_MONITOR_CONNECTION_CHANGED], 0, FALSE);
+ return;
+ }
+
+ /* nothing --> something */
+ if (prev_len == 0 && new_len != 0) {
+ g_signal_emit (monitor, signals [PK_DBUS_MONITOR_CONNECTION_CHANGED], 0, TRUE);
+ return;
+ }
+
+ /* something --> something (we've replaced the old process) */
+ if (prev_len != 0 && new_len != 0) {
+ /* only send this to the prev client */
+ if (strcmp (monitor->priv->unique_name, prev) == 0) {
+ g_signal_emit (monitor, signals [PK_DBUS_MONITOR_CONNECTION_REPLACED], 0);
+ }
+ return;
+ }
+}
+
+/**
+ * pk_dbus_monitor_assign:
+ * @pk_dbus_monitor: This class instance
+ * @bus_type: The bus type, either PK_DBUS_MONITOR_SESSION or PK_DBUS_MONITOR_SYSTEM
+ * @service: The PK_DBUS_MONITOR service name
+ * Return value: success
+ *
+ * Emits connection-changed(TRUE) if connection is alive - this means you
+ * have to connect up the callback before this function is called.
+ **/
+gboolean
+pk_dbus_monitor_assign (PkDbusMonitor *monitor, PkDbusMonitorType bus_type, const gchar *service)
+{
+ GError *error = NULL;
+ gboolean connected;
+ DBusConnection *conn;
+
+ g_return_val_if_fail (PK_IS_DBUS_MONITOR (monitor), FALSE);
+ g_return_val_if_fail (service != NULL, FALSE);
+
+ if (monitor->priv->proxy != NULL) {
+ pk_warning ("already assigned!");
+ return FALSE;
+ }
+
+ monitor->priv->service = g_strdup (service);
+ monitor->priv->bus_type = bus_type;
+
+ /* connect to correct bus */
+ if (bus_type == PK_DBUS_MONITOR_SESSION) {
+ monitor->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ } else {
+ monitor->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ }
+ if (error != NULL) {
+ pk_warning ("Cannot connect to bus: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+ monitor->priv->proxy = dbus_g_proxy_new_for_name_owner (monitor->priv->connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS,
+ &error);
+ if (error != NULL) {
+ pk_warning ("Cannot connect to DBUS: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+ dbus_g_proxy_add_signal (monitor->priv->proxy, "NameOwnerChanged",
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (monitor->priv->proxy, "NameOwnerChanged",
+ G_CALLBACK (pk_dbus_monitor_name_owner_changed_cb),
+ monitor, NULL);
+
+ /* coldplug */
+ connected = pk_dbus_monitor_is_connected (monitor);
+ if (connected) {
+ g_signal_emit (monitor, signals [PK_DBUS_MONITOR_CONNECTION_CHANGED], 0, TRUE);
+ }
+
+ /* save this for the replaced check */
+ conn = dbus_g_connection_get_connection (monitor->priv->connection);
+ monitor->priv->unique_name = dbus_bus_get_unique_name (conn);
+ return TRUE;
+}
+
+/**
+ * pk_dbus_monitor_is_connected:
+ * @pk_dbus_monitor: This class instance
+ * Return value: if we are connected to a valid watch
+ **/
+gboolean
+pk_dbus_monitor_is_connected (PkDbusMonitor *monitor)
+{
+ DBusError error;
+ DBusConnection *conn;
+ gboolean ret;
+ g_return_val_if_fail (PK_IS_DBUS_MONITOR (monitor), FALSE);
+
+ /* get raw connection */
+ conn = dbus_g_connection_get_connection (monitor->priv->connection);
+ dbus_error_init (&error);
+ ret = dbus_bus_name_has_owner (conn, monitor->priv->service, &error);
+ if (dbus_error_is_set (&error)) {
+ pk_debug ("error: %s", error.message);
+ dbus_error_free (&error);
+ }
+
+ return ret;
+}
+
+/**
+ * pk_dbus_monitor_class_init:
+ * @klass: The PkDbusMonitorClass
+ **/
+static void
+pk_dbus_monitor_class_init (PkDbusMonitorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_dbus_monitor_finalize;
+ g_type_class_add_private (klass, sizeof (PkDbusMonitorPrivate));
+ signals [PK_DBUS_MONITOR_CONNECTION_CHANGED] =
+ g_signal_new ("connection-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PkDbusMonitorClass, connection_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+ signals [PK_DBUS_MONITOR_CONNECTION_REPLACED] =
+ g_signal_new ("connection-replaced",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PkDbusMonitorClass, connection_replaced),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+/**
+ * pk_dbus_monitor_init:
+ * @dbus_monitor: This class instance
+ **/
+static void
+pk_dbus_monitor_init (PkDbusMonitor *monitor)
+{
+ monitor->priv = PK_DBUS_MONITOR_GET_PRIVATE (monitor);
+ monitor->priv->service = NULL;
+ monitor->priv->bus_type = PK_DBUS_MONITOR_SESSION;
+ monitor->priv->proxy = NULL;
+}
+
+/**
+ * pk_dbus_monitor_finalize:
+ * @object: The object to finalize
+ **/
+static void
+pk_dbus_monitor_finalize (GObject *object)
+{
+ PkDbusMonitor *monitor;
+
+ g_return_if_fail (PK_IS_DBUS_MONITOR (object));
+
+ monitor = PK_DBUS_MONITOR (object);
+
+ g_return_if_fail (monitor->priv != NULL);
+ if (monitor->priv->proxy != NULL) {
+ g_object_unref (monitor->priv->proxy);
+ }
+
+ G_OBJECT_CLASS (pk_dbus_monitor_parent_class)->finalize (object);
+}
+
+/**
+ * pk_dbus_monitor_new:
+ *
+ * Return value: a new PkDbusMonitor object.
+ **/
+PkDbusMonitor *
+pk_dbus_monitor_new (void)
+{
+ PkDbusMonitor *monitor;
+ monitor = g_object_new (PK_TYPE_DBUS_MONITOR, NULL);
+ return PK_DBUS_MONITOR (monitor);
+}
+
diff --git a/libpackagekit/pk-dbus-monitor.h b/libpackagekit/pk-dbus-monitor.h
new file mode 100644
index 0000000..c261984
--- /dev/null
+++ b/libpackagekit/pk-dbus-monitor.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_DBUS_MONITOR_H
+#define __PK_DBUS_MONITOR_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_DBUS_MONITOR (pk_dbus_monitor_get_type ())
+#define PK_DBUS_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_DBUS_MONITOR, PkDbusMonitor))
+#define PK_DBUS_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_DBUS_MONITOR, PkDbusMonitorClass))
+#define PK_IS_DBUS_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_DBUS_MONITOR))
+#define PK_IS_DBUS_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_DBUS_MONITOR))
+#define PK_DBUS_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_DBUS_MONITOR, PkDbusMonitorClass))
+#define PK_DBUS_MONITOR_ERROR (pk_dbus_monitor_error_quark ())
+#define PK_DBUS_MONITOR_TYPE_ERROR (pk_dbus_monitor_error_get_type ())
+
+typedef struct PkDbusMonitorPrivate PkDbusMonitorPrivate;
+
+typedef struct
+{
+ GObject parent;
+ PkDbusMonitorPrivate *priv;
+} PkDbusMonitor;
+
+typedef struct
+{
+ GObjectClass parent_class;
+ void (* connection_changed) (PkDbusMonitor *watch,
+ gboolean connected);
+ void (* connection_replaced) (PkDbusMonitor *watch);
+} PkDbusMonitorClass;
+
+typedef enum {
+ PK_DBUS_MONITOR_SESSION,
+ PK_DBUS_MONITOR_SYSTEM
+} PkDbusMonitorType;
+
+GType pk_dbus_monitor_get_type (void) G_GNUC_CONST;
+PkDbusMonitor *pk_dbus_monitor_new (void);
+gboolean pk_dbus_monitor_assign (PkDbusMonitor *monitor,
+ PkDbusMonitorType bus_type,
+ const gchar *service);
+gboolean pk_dbus_monitor_is_connected (PkDbusMonitor *monitor);
+
+G_END_DECLS
+
+#endif /* __PK_DBUS_MONITOR_H */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 1230233..d0e4f94 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,11 +31,6 @@ INCLUDES = \
-DPK_DB_DIR=\""$(PK_DB_DIR)"\" \
-I$(top_srcdir)/libpackagekit \
-I$(top_srcdir)/libselftest \
- -I$(top_srcdir)/libgbus \
- $(NULL)
-
-GBUS_LIBS = \
- $(top_builddir)/libgbus/libgbus.la \
$(NULL)
pkbackendincludedir=$(includedir)/packagekit-backend
@@ -131,7 +126,6 @@ packagekitd_LDADD = \
$(PYTHON_LIBS) \
$(POLKIT_LIBS) \
$(SELFTEST_LIBS) \
- $(GBUS_LIBS) \
$(GIO_LIBS) \
$(NULL)
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 23d8757..95e7b95 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -39,7 +39,7 @@
#include <glib/gprintf.h>
#include <gmodule.h>
-#include <libgbus.h>
+#include <pk-dbus-monitor.h>
#include <dbus/dbus-glib.h>
#include <pk-common.h>
@@ -75,7 +75,7 @@ struct PkBackendDbusPrivate
GTimer *timer;
gchar *service;
gulong signal_finished;
- LibGBus *gbus;
+ PkDbusMonitor *monitor;
};
G_DEFINE_TYPE (PkBackendDbus, pk_backend_dbus, G_TYPE_OBJECT)
@@ -452,7 +452,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service)
}
/* watch */
- libgbus_assign (backend_dbus->priv->gbus, LIBGBUS_SYSTEM, service);
+ pk_dbus_monitor_assign (backend_dbus->priv->monitor, PK_DBUS_MONITOR_SYSTEM, service);
/* grab this */
pk_debug ("trying to activate %s", service);
@@ -1400,10 +1400,10 @@ pk_backend_dbus_what_provides (PkBackendDbus *backend_dbus, PkFilterEnum filters
}
/**
- * pk_backend_dbus_gbus_changed_cb:
+ * pk_backend_dbus_monitor_changed_cb:
**/
static void
-pk_backend_dbus_gbus_changed_cb (LibGBus *libgbus, gboolean is_active, PkBackendDbus *backend_dbus)
+pk_backend_dbus_monitor_changed_cb (PkDbusMonitor *pk_dbus_monitor, gboolean is_active, PkBackendDbus *backend_dbus)
{
gboolean ret;
g_return_if_fail (PK_IS_BACKEND_DBUS (backend_dbus));
@@ -1440,7 +1440,7 @@ pk_backend_dbus_finalize (GObject *object)
}
g_timer_destroy (backend_dbus->priv->timer);
g_object_unref (backend_dbus->priv->backend);
- g_object_unref (backend_dbus->priv->gbus);
+ g_object_unref (backend_dbus->priv->monitor);
G_OBJECT_CLASS (pk_backend_dbus_parent_class)->finalize (object);
}
@@ -1477,9 +1477,9 @@ pk_backend_dbus_init (PkBackendDbus *backend_dbus)
}
/* babysit the backend and do Init() again it when it crashes */
- backend_dbus->priv->gbus = libgbus_new ();
- g_signal_connect (backend_dbus->priv->gbus, "connection-changed",
- G_CALLBACK (pk_backend_dbus_gbus_changed_cb), backend_dbus);
+ backend_dbus->priv->monitor = pk_dbus_monitor_new ();
+ g_signal_connect (backend_dbus->priv->monitor, "connection-changed",
+ G_CALLBACK (pk_backend_dbus_monitor_changed_cb), backend_dbus);
/* ProgressChanged */
dbus_g_object_register_marshaller (pk_marshal_VOID__UINT_UINT_UINT_UINT,
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index f75d5f3..cd9624d 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -39,7 +39,6 @@
#include <glib/gprintf.h>
#include <gmodule.h>
-#include <libgbus.h>
#include <pk-common.h>
#include <pk-package-id.h>
diff --git a/src/pk-network.c b/src/pk-network.c
index 0ad839e..4486d01 100644
--- a/src/pk-network.c
+++ b/src/pk-network.c
@@ -39,7 +39,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#include <libgbus.h>
+#include <pk-dbus-monitor.h>
#include <glib/gi18n.h>
@@ -68,7 +68,7 @@ struct _PkNetworkPrivate
PkNetworkNm *net_nm;
PkNetworkUnix *net_unix;
PkConf *conf;
- LibGBus *nm_bus;
+ PkDbusMonitor *nm_bus;
};
enum {
@@ -171,9 +171,9 @@ pk_network_init (PkNetwork *network)
network->priv->use_unix = pk_conf_get_bool (network->priv->conf, "UseNetworkHeuristic");
/* check if NM is on the bus */
- network->priv->nm_bus = libgbus_new ();
- libgbus_assign (network->priv->nm_bus, LIBGBUS_SYSTEM, "org.freedesktop.NetworkManager");
- nm_alive = libgbus_is_connected (network->priv->nm_bus);
+ network->priv->nm_bus = pk_dbus_monitor_new ();
+ pk_dbus_monitor_assign (network->priv->nm_bus, PK_DBUS_MONITOR_SYSTEM, "org.freedesktop.NetworkManager");
+ nm_alive = pk_dbus_monitor_is_connected (network->priv->nm_bus);
/* NetworkManager isn't up, so we can't use it */
if (network->priv->use_nm && !nm_alive) {
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index e0fd353..dcee768 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -36,7 +36,7 @@
#include <fcntl.h>
#include <glib/gi18n.h>
-#include <libgbus.h>
+#include <pk-dbus-monitor.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -79,7 +79,7 @@ struct PkTransactionPrivate
gboolean emit_eula_required;
gboolean emit_signature_required;
gchar *locale;
- LibGBus *libgbus;
+ PkDbusMonitor *monitor;
PkBackend *backend;
PkInhibit *inhibit;
PkCache *cache;
@@ -234,7 +234,7 @@ pk_transaction_set_dbus_name (PkTransaction *transaction, const gchar *dbus_name
}
transaction->priv->dbus_name = g_strdup (dbus_name);
pk_debug ("assigning %s to %p", dbus_name, transaction);
- libgbus_assign (transaction->priv->libgbus, LIBGBUS_SYSTEM, dbus_name);
+ pk_dbus_monitor_assign (transaction->priv->monitor, PK_DBUS_MONITOR_SYSTEM, dbus_name);
return TRUE;
}
@@ -369,7 +369,7 @@ pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTra
* pk_transaction_caller_active_changed_cb:
**/
static void
-pk_transaction_caller_active_changed_cb (LibGBus *libgbus, gboolean is_active, PkTransaction *transaction)
+pk_transaction_caller_active_changed_cb (PkDbusMonitor *pk_dbus_monitor, gboolean is_active, PkTransaction *transaction)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -2220,7 +2220,7 @@ pk_transaction_is_caller_active (PkTransaction *transaction, gboolean *is_active
pk_debug ("is caller active");
- *is_active = libgbus_is_connected (transaction->priv->libgbus);
+ *is_active = pk_dbus_monitor_is_connected (transaction->priv->monitor);
return TRUE;
}
@@ -3277,8 +3277,8 @@ pk_transaction_init (PkTransaction *transaction)
g_signal_connect (transaction->priv->transaction_db, "transaction",
G_CALLBACK (pk_transaction_transaction_cb), transaction);
- transaction->priv->libgbus = libgbus_new ();
- g_signal_connect (transaction->priv->libgbus, "connection-changed",
+ transaction->priv->monitor = pk_dbus_monitor_new ();
+ g_signal_connect (transaction->priv->monitor, "connection-changed",
G_CALLBACK (pk_transaction_caller_active_changed_cb), transaction);
}
@@ -3316,7 +3316,7 @@ pk_transaction_finalize (GObject *object)
g_object_unref (transaction->priv->update_detail_list);
g_object_unref (transaction->priv->inhibit);
g_object_unref (transaction->priv->backend);
- g_object_unref (transaction->priv->libgbus);
+ g_object_unref (transaction->priv->monitor);
g_object_unref (transaction->priv->package_list);
g_object_unref (transaction->priv->transaction_list);
g_object_unref (transaction->priv->transaction_db);
commit d8bc0d6b71b035bf1346870d4b589d303ef84ba8
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 7 08:46:37 2008 +0100
add a g_type_init() as pointed out by Dorian Perkins, many thanks.
diff --git a/docs/html/files/installer.c b/docs/html/files/installer.c
index ded2439..6f658fc 100644
--- a/docs/html/files/installer.c
+++ b/docs/html/files/installer.c
@@ -11,6 +11,7 @@ main (int argc, char *argv[])
GError *error = NULL;
gboolean ret;
+ g_type_init ();
connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
proxy = dbus_g_proxy_new_for_name (connection,
"org.freedesktop.PackageKit",
commit dca22a42dc517076b4880ff7f24dd1098e73fb9c
Author: Igor Pires Soares <igorsoares at gmail.com>
Date: Wed Aug 6 18:20:10 2008 +0000
Updated Brazilian Portuguese translation
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 3c6dc2b..de85150 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-07-23 01:22+0000\n"
-"PO-Revision-Date: 2008-07-25 16:49-0300\n"
+"POT-Creation-Date: 2008-08-05 01:21+0000\n"
+"PO-Revision-Date: 2008-08-06 15:19-0300\n"
"Last-Translator: Igor Pires Soares <igor at projetofedora.org>\n"
"Language-Team: Brazilian Portuguese <fedora-trans-pt_br at redhat.com>\n"
"MIME-Version: 1.0\n"
@@ -19,236 +19,235 @@ msgstr ""
"X-Poedit-Language: Portuguese\n"
"X-Poedit-Country: BRAZIL\n"
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:217
msgid "Update detail"
msgstr "Detalhe da atualização"
-#: ../client/pk-console.c:413
+#: ../client/pk-console.c:418
msgid "A system restart is required"
msgstr "à necessário reiniciar o sistema"
-#: ../client/pk-console.c:415
+#: ../client/pk-console.c:420
msgid "A logout and login is required"
msgstr "à necessário sair da sessão e autenticar novamente"
-#: ../client/pk-console.c:417
+#: ../client/pk-console.c:422
msgid "An application restart is required"
msgstr "à necessário reiniciar a aplicação"
-#: ../client/pk-console.c:462
-#, c-format
-msgid "Please enter a number from 1 to %i: "
-msgstr "Por favor, insira um número entre 1 e %i: "
-
-#: ../client/pk-console.c:525
-msgid "Could not find a package match"
-msgstr "Não foi possÃvel encontrar um pacote correspondente"
-
-#: ../client/pk-console.c:539
+#: ../client/pk-console.c:515
msgid "There are multiple package matches"
msgstr "Há múltiplos pacotes correspondentes"
#. find out what package the user wants to use
-#: ../client/pk-console.c:546
+#: ../client/pk-console.c:522
msgid "Please enter the package number: "
msgstr "Por favor, insira o número do pacote: "
-#: ../client/pk-console.c:580
-msgid "Could not find a package with that name to install, or package already installed"
-msgstr "Não foi possÃvel encontrar um pacote com esse nome para instalar ou o pacote já está instalado"
+#: ../client/pk-console.c:556
+msgid "Could not find package to install"
+msgstr "Não foi possÃvel localizar o pacote a ser instalado"
-#: ../client/pk-console.c:726
-msgid "Could not find a package to remove"
-msgstr "Não foi possÃvel localizar um pacote a ser removido"
+#: ../client/pk-console.c:660
+msgid "Could not find package to remove"
+msgstr "Não foi possÃvel localizar o pacote a ser removido"
-#: ../client/pk-console.c:787
+#: ../client/pk-console.c:721
msgid "The following packages have to be removed"
msgstr "Os seguintes pacotes têm que ser removidos"
#. get user input
-#: ../client/pk-console.c:794
+#: ../client/pk-console.c:728
msgid "Okay to remove additional packages?"
msgstr "Os pacotes adicionais podem ser removidos?"
-#: ../client/pk-console.c:798
+#: ../client/pk-console.c:732
msgid "Cancelled!"
msgstr "Cancelado!"
-#: ../client/pk-console.c:832
-msgid "Could not find a package to download"
-msgstr "Não foi possÃvel localizar um pacote a ser baixado"
+#: ../client/pk-console.c:766
+msgid "Could not find package to download:"
+msgstr "Não foi possÃvel localizar o pacote a ser baixado:"
-#: ../client/pk-console.c:883
-msgid "Could not find a package with that name to update"
-msgstr "Não foi possÃvel encontrar um pacote com esse nome para ser atualizado"
+#: ../client/pk-console.c:817
+msgid "Could not find package to update"
+msgstr "Não foi possÃvel localizar o pacote a ser atualizado"
-#: ../client/pk-console.c:905
-msgid "Could not find what packages require this package"
-msgstr "Não foi possÃvel encontrar quais pacotes necessitam desse pacote"
+#: ../client/pk-console.c:839
+msgid "Could not find what packages require"
+msgstr "Não foi possÃvel localizar quais pacotes necessitam desse pacote"
-#: ../client/pk-console.c:926
-msgid "Could not get dependencies for this package"
-msgstr "Não foi possÃvel obter as dependências desse pacote"
+#: ../client/pk-console.c:860
+msgid "Could not get dependencies for"
+msgstr "Não foi possÃvel obter as dependências para"
-#: ../client/pk-console.c:947
-msgid "Could not find details for this package"
-msgstr "Não foi possÃvel localizar os detalhes deste pacote"
+#: ../client/pk-console.c:881
+msgid "Could not find details for"
+msgstr "Não foi possÃvel localizar os detalhes para"
-#: ../client/pk-console.c:968
+#: ../client/pk-console.c:904
msgid "Could not find the files for this package"
msgstr "Não foi possÃvel encontrar os arquivos para este pacote"
-#: ../client/pk-console.c:1050
+#: ../client/pk-console.c:911
+msgid "Could not get the file list"
+msgstr "Não foi possÃvel obter a lista de arquivos"
+
+#: ../client/pk-console.c:930
+msgid "Could not find the update details for"
+msgstr "Não foi possÃvel localizar os detalhes de atualização para"
+
+#: ../client/pk-console.c:991
msgid "Package description"
msgstr "Descrição do pacote"
-#: ../client/pk-console.c:1073
+#: ../client/pk-console.c:1014
msgid "Package files"
msgstr "Arquivos do pacote"
-#: ../client/pk-console.c:1081
+#: ../client/pk-console.c:1022
msgid "No files"
msgstr "Nenhum arquivo"
#. get user input
-#: ../client/pk-console.c:1113
+#: ../client/pk-console.c:1054
msgid "Okay to import key?"
msgstr "A chave pode ser importada?"
-#: ../client/pk-console.c:1116
+#: ../client/pk-console.c:1057
msgid "Did not import key"
msgstr "Não importar a chave"
#. get user input
-#: ../client/pk-console.c:1156
+#: ../client/pk-console.c:1097
msgid "Do you agree?"
msgstr "Você concorda?"
-#: ../client/pk-console.c:1159
+#: ../client/pk-console.c:1100
msgid "Did not agree to licence, task will fail"
msgstr "Se você não concordar com a licença a tarefa irá falhar"
-#: ../client/pk-console.c:1188
+#: ../client/pk-console.c:1129
msgid "The daemon crashed mid-transaction!"
msgstr "O daemon travou no meio da transação!"
#. header
-#: ../client/pk-console.c:1241
+#: ../client/pk-console.c:1182
msgid "PackageKit Console Interface"
msgstr "Interface em Console do PackageKit"
-#: ../client/pk-console.c:1241
+#: ../client/pk-console.c:1182
msgid "Subcommands:"
msgstr "Subcomandos:"
-#: ../client/pk-console.c:1349
+#: ../client/pk-console.c:1290
#: ../client/pk-monitor.c:104
#: ../src/pk-main.c:189
msgid "Show extra debugging information"
msgstr "Mostrar informações extras de depuração"
-#: ../client/pk-console.c:1351
+#: ../client/pk-console.c:1292
#: ../client/pk-monitor.c:106
msgid "Show the program version and exit"
msgstr "Mostrar a versão do programa e sair"
-#: ../client/pk-console.c:1353
+#: ../client/pk-console.c:1294
msgid "Set the filter, e.g. installed"
msgstr "Definir o filtro, p. ex.: instalados"
-#: ../client/pk-console.c:1355
+#: ../client/pk-console.c:1296
msgid "Exit without waiting for actions to complete"
msgstr "Sair sem esperar pelo término das ações"
-#: ../client/pk-console.c:1378
+#: ../client/pk-console.c:1319
msgid "Could not connect to system DBUS."
msgstr "Não foi possÃvel conectar ao DBUS do sistema."
-#: ../client/pk-console.c:1472
-msgid "You need to specify a search type"
-msgstr "Você precisa especificar um tipo de pesquisa"
+#: ../client/pk-console.c:1413
+msgid "You need to specify a search type, e.g. name"
+msgstr "Você precisa especificar um tipo de pesquisa, p. ex. nome"
-#: ../client/pk-console.c:1477
-#: ../client/pk-console.c:1484
-#: ../client/pk-console.c:1491
-#: ../client/pk-console.c:1498
-#: ../client/pk-console.c:1604
-#: ../client/pk-console.c:1611
-#: ../client/pk-console.c:1618
-#: ../client/pk-console.c:1625
+#: ../client/pk-console.c:1418
+#: ../client/pk-console.c:1425
+#: ../client/pk-console.c:1432
+#: ../client/pk-console.c:1439
+#: ../client/pk-console.c:1545
+#: ../client/pk-console.c:1552
+#: ../client/pk-console.c:1559
+#: ../client/pk-console.c:1566
msgid "You need to specify a search term"
msgstr "Você precisa especificar um termo de pesquisa"
-#: ../client/pk-console.c:1503
+#: ../client/pk-console.c:1444
msgid "Invalid search type"
msgstr "Tipo de pesquisa inválido"
-#: ../client/pk-console.c:1508
+#: ../client/pk-console.c:1449
msgid "You need to specify a package or file to install"
msgstr "Você precisa especificar um pacote ou programa a ser instalado"
-#: ../client/pk-console.c:1515
+#: ../client/pk-console.c:1456
msgid "You need to specify a type, key_id and package_id"
msgstr "Você precisa especificar um tipo, key_id e package_id"
-#: ../client/pk-console.c:1522
+#: ../client/pk-console.c:1463
msgid "You need to specify a package to remove"
msgstr "Você precisa especificar um pacote a ser removido"
-#: ../client/pk-console.c:1528
+#: ../client/pk-console.c:1469
msgid "You need to specify the package to download and the destination directory"
msgstr "Você precisa especificar o pacote a ser baixado e o diretório de destino"
-#: ../client/pk-console.c:1534
+#: ../client/pk-console.c:1475
msgid "You need to specify a eula-id"
msgstr "Você precisa especificar um eula-id"
-#: ../client/pk-console.c:1550
+#: ../client/pk-console.c:1491
msgid "You need to specify a package name to resolve"
msgstr "Você precisa especificar um nome de pacote a ser analisado"
-#: ../client/pk-console.c:1559
-#: ../client/pk-console.c:1566
+#: ../client/pk-console.c:1500
+#: ../client/pk-console.c:1507
msgid "You need to specify a repo name"
msgstr "Você precisa especificar um nome de repositório"
-#: ../client/pk-console.c:1573
+#: ../client/pk-console.c:1514
msgid "You need to specify a repo name/parameter and value"
msgstr "Você precisa especificar um nome/parâmetro de repositório e um valor"
-#: ../client/pk-console.c:1586
+#: ../client/pk-console.c:1527
msgid "You need to specify a time term"
msgstr "Você precisa especificar um termo de horário"
-#: ../client/pk-console.c:1591
+#: ../client/pk-console.c:1532
msgid "You need to specify a correct role"
msgstr "Você precisa especificar um papel correto"
-#: ../client/pk-console.c:1596
+#: ../client/pk-console.c:1537
msgid "Failed to get last time"
msgstr "Falha ao obter o último horário"
-#: ../client/pk-console.c:1632
+#: ../client/pk-console.c:1573
msgid "You need to specify a package to find the details for"
msgstr "Você precisa especificar o pacote para o qual você quer localizar os detalhes"
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1580
msgid "You need to specify a package to find the files for"
msgstr "Você precisa especificar o pacote para o qual você quer localizar os arquivos"
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1629
#, c-format
msgid "Option '%s' not supported"
msgstr "A opção \"%s\" não é suportada"
-#: ../client/pk-console.c:1699
-msgid "Command failed"
-msgstr "O comando falhou"
-
-#: ../client/pk-console.c:1703
+#: ../client/pk-console.c:1642
msgid "You don't have the necessary privileges for this operation"
msgstr "Você não tem os privilégios necessários para esta operação"
+#: ../client/pk-console.c:1644
+msgid "Command failed"
+msgstr "O comando falhou"
+
#: ../client/pk-import-desktop.c:279
#: ../client/pk-import-specspo.c:177
#, c-format
@@ -321,6 +320,19 @@ msgstr "Não foi possÃvel conectar ao barramento do sistema"
msgid "Error trying to start: %s\n"
msgstr "Erro ao tentar iniciar: %s\n"
+#~ msgid "Please enter a number from 1 to %i: "
+#~ msgstr "Por favor, insira um número entre 1 e %i: "
+#~ msgid "Could not find a package match"
+#~ msgstr "Não foi possÃvel encontrar um pacote correspondente"
+#~ msgid ""
+#~ "Could not find a package with that name to install, or package already "
+#~ "installed"
+#~ msgstr ""
+#~ "Não foi possÃvel encontrar um pacote com esse nome para instalar ou o "
+#~ "pacote já está instalado"
+#~ msgid "Could not find a package with that name to update"
+#~ msgstr ""
+#~ "Não foi possÃvel encontrar um pacote com esse nome para ser atualizado"
#~ msgid "Accept EULA"
#~ msgstr "Aceitar a licença EULA"
#~ msgid "Authentication is required to accept a EULA"
commit 45ba3845e135ce0de64b5e74327fdc6258faaccb
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 12:43:16 2008 +0100
bugfix: export libpackagekit with -export-dynamic so we can work with libtrash. fixes fd#16991
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index dfa24e0..14bf3f6 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -104,6 +104,9 @@ endif
libpackagekit_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -export-dynamic \
+ -no-undefined \
+ -export-symbols-regex '^pk_.*' \
$(NULL)
if PK_BUILD_TESTS
diff --git a/src/Makefile.am b/src/Makefile.am
index 242ffa3..1230233 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,10 @@ INCLUDES = \
-I$(top_srcdir)/libgbus \
$(NULL)
+GBUS_LIBS = \
+ $(top_builddir)/libgbus/libgbus.la \
+ $(NULL)
+
pkbackendincludedir=$(includedir)/packagekit-backend
pkbackendinclude_HEADERS = \
@@ -127,6 +131,7 @@ packagekitd_LDADD = \
$(PYTHON_LIBS) \
$(POLKIT_LIBS) \
$(SELFTEST_LIBS) \
+ $(GBUS_LIBS) \
$(GIO_LIBS) \
$(NULL)
commit b229acad7d30f98a53a335133c4ce544fe7e9c01
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 12:34:31 2008 +0100
trivial: fix make distcheck
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 01dcc13..7bce8d0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,10 +2,13 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
client/pk-console.c
+client/pk-generate-pack.c
client/pk-import-desktop.c
client/pk-import-specspo.c
client/pk-monitor.c
+client/pk-tools-common.c
data/packagekit-catalog.xml.in
+data/packagekit-pack.xml.in
policy/org.freedesktop.packagekit.policy.in
src/pk-main.c
commit 85e73bb7d478160990acbc30da620d05386072cf
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 10:55:35 2008 +0100
yum: fix up the GPG key reporting now that the yum API has changed to make public_key.fingerprint a function
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 05ff633..57607c9 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1065,7 +1065,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_BAD_GPG_SIGNATURE,
"GPG key not imported, and no GPG information was found.")
id = self._pkg_to_id(keyData['po'])
- fingerprint = keyData['fingerprint']
+ fingerprint = keyData['fingerprint']()
hex_fingerprint = "%02x" * len(fingerprint) % tuple(map(ord, fingerprint))
# Borrowed from http://mail.python.org/pipermail/python-list/2000-September/053490.html
commit 8ea1106a44568132947e29b75788d724827cf0e5
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 08:47:11 2008 +0100
check for a zero destination in the unix network fallback code to fix rh#453531
diff --git a/src/pk-network-unix.c b/src/pk-network-unix.c
index 74b266c..9cf363d 100644
--- a/src/pk-network-unix.c
+++ b/src/pk-network-unix.c
@@ -150,6 +150,12 @@ pk_network_unix_get_network_state (PkNetworkUnix *network_unix)
continue;
}
+ /* is destination zero (default route)? */
+ if (pk_strequal (sections[1], "00000000")) {
+ pk_debug ("destination %s is valid", sections[0]);
+ online = TRUE;
+ }
+
/* is gateway nonzero? */
if (!pk_strequal (sections[2], "00000000")) {
pk_debug ("interface %s is valid", sections[0]);
commit 6179b2be9dfb6fee4b4dd6300718ccfac310794c
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 07:30:19 2008 +0100
trivial: update some gitignore files
diff --git a/client/.gitignore b/client/.gitignore
index 662278f..76600ed 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -18,4 +18,5 @@ pk-generate-package-list
*.gcda
*.gcno
*.out
+*.pack
diff --git a/data/.gitignore b/data/.gitignore
index d1a4fa8..007ccb3 100644
--- a/data/.gitignore
+++ b/data/.gitignore
@@ -5,5 +5,5 @@ org.freedesktop.PackageKitYumBackend.conf
org.freedesktop.PackageKitYumBackend.service
org.freedesktop.PackageKitAptBackend.conf
org.freedesktop.PackageKitAptBackend.service
-packagekit-catalog.xml
+packagekit-*.xml
commit 3a18b34d831874a890fc1fee33c10c63b18a32c4
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 6 07:29:10 2008 +0100
update the FAQ with a working C example
diff --git a/docs/html/files/installer.c b/docs/html/files/installer.c
new file mode 100644
index 0000000..ded2439
--- /dev/null
+++ b/docs/html/files/installer.c
@@ -0,0 +1,30 @@
+#include <dbus/dbus-glib.h>
+
+/**
+ * main:
+ **/
+int
+main (int argc, char *argv[])
+{
+ DBusGConnection *connection;
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ gboolean ret;
+
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+ proxy = dbus_g_proxy_new_for_name (connection,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit");
+
+ /* execute sync method */
+ ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,
+ G_TYPE_STRING, "openoffice-clipart",
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (!ret) {
+ g_warning ("failed: %s", error->message);
+ g_error_free (error);
+ }
+ return 0;
+}
+
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index f8555ee..fd99929 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -253,6 +253,12 @@ if (!ret) {
}
</pre>
<p>
+If you want a demo, you can download <a href="files/installer.c">this file</a> and then run:
+</p>
+<pre>
+gcc -o installer -Wall installer.c `pkg-config --cflags --libs dbus-glib-1`
+</pre>
+<p>
or in python...
</p>
<pre>
commit 73b9dfdfc719dd70c7a1cde091e2730100650f62
Author: Stefan Haas <shaas at suse.de>
Date: Tue Aug 5 14:56:37 2008 +0200
zypp: changes for new api (thx to Wang Hoi)
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 2c02aa3..356442b 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -124,120 +124,122 @@ backend_destroy (PkBackend *backend)
static gboolean
backend_get_requires_thread (PkBackend *backend)
{
- PkPackageId *pi;
+ PkPackageId *pi = NULL;
gchar **package_ids;
- package_ids = pk_backend_get_string (backend, "package_ids");
- pi = pk_package_id_new_from_string (package_ids[0]);
- if (pi == NULL) {
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ if (package_ids == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
- pk_package_id_free (pi);
pk_backend_finished (backend);
return FALSE;
}
+
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, 0);
+
+ //TODO repair percentages
+ //pk_backend_set_percentage (backend, 0);
- zypp::sat::Solvable solvable = zypp_get_package_by_id (package_id);
- zypp::PoolItem package;
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
+
+ pi = pk_package_id_new_from_string (package_ids[i]);
- if (solvable.isSystem ()) {
- zypp::ResPool pool = zypp_build_pool (true);
+ zypp::sat::Solvable solvable = zypp_get_package_by_id (package_ids[i]);
+ zypp::PoolItem package;
- gboolean found = FALSE;
+ if (solvable.isSystem ()) {
+ zypp::ResPool pool = zypp_build_pool (true);
- for (zypp::ResPool::byIdent_iterator it = pool.byIdentBegin (zypp::ResKind::package, pi->name);
- it != pool.byIdentEnd (zypp::ResKind::package, pi->name); it++) {
- if (it->status ().isInstalled ()) {
- package = (*it);
- found = TRUE;
+ gboolean found = FALSE;
+
+ for (zypp::ResPool::byIdent_iterator it = pool.byIdentBegin (zypp::ResKind::package, pi->name);
+ it != pool.byIdentEnd (zypp::ResKind::package, pi->name); it++) {
+ if (it->status ().isInstalled ()) {
+ package = (*it);
+ found = TRUE;
+ }
}
- }
- if (found == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
+ if (found == FALSE) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
+ pk_package_id_free (pi);
+ pk_backend_finished (backend);
+ return FALSE;
+ }
- // set Package as to be uninstalled
- package.status ().setToBeUninstalled (zypp::ResStatus::USER);
- } else {
- if (solvable == zypp::sat::Solvable::noSolvable) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Package couldn't be found");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
+ // set Package as to be uninstalled
+ package.status ().setToBeUninstalled (zypp::ResStatus::USER);
+ } else {
+ if (solvable == zypp::sat::Solvable::noSolvable) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Package couldn't be found");
+ pk_package_id_free (pi);
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+
+ zypp::ResPool pool = zypp::ResPool::instance ();
+ package = pool.find (solvable);
+ //set Package as to be installed
+ package.status ().setToBeInstalled (zypp::ResStatus::USER);
}
+ // solver run
zypp::ResPool pool = zypp::ResPool::instance ();
- package = pool.find (solvable);
- //set Package as to be installed
- package.status ().setToBeInstalled (zypp::ResStatus::USER);
- }
+ zypp::Resolver solver(pool);
- pk_backend_set_percentage (backend, 40);
+ solver.setForceResolve (true);
- // solver run
- zypp::ResPool pool = zypp::ResPool::instance ();
- zypp::Resolver solver(pool);
-
- solver.setForceResolve (true);
-
- if (solver.resolvePool () == FALSE) {
- std::list<zypp::ResolverProblem_Ptr> problems = solver.problems ();
- for (std::list<zypp::ResolverProblem_Ptr>::iterator it = problems.begin (); it != problems.end (); it++){
- pk_warning("Solver problem (This should never happen): '%s'", (*it)->description ().c_str ());
+ if (solver.resolvePool () == FALSE) {
+ std::list<zypp::ResolverProblem_Ptr> problems = solver.problems ();
+ for (std::list<zypp::ResolverProblem_Ptr>::iterator it = problems.begin (); it != problems.end (); it++){
+ pk_warning("Solver problem (This should never happen): '%s'", (*it)->description ().c_str ());
+ }
+ pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, "Resolution failed");
+ pk_package_id_free (pi);
+ pk_backend_finished (backend);
+ return FALSE;
}
- pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, "Resolution failed");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
- pk_backend_set_percentage (backend, 60);
-
- // look for packages which would be uninstalled
- for (zypp::ResPool::byKind_iterator it = pool.byKindBegin (zypp::ResKind::package);
- it != pool.byKindEnd (zypp::ResKind::package); it++) {
- PkInfoEnum status = PK_INFO_ENUM_UNKNOWN;
-
- gboolean hit = FALSE;
-
- if (it->status ().isToBeUninstalled ()) {
- status = PK_INFO_ENUM_REMOVING;
- hit = TRUE;
- }else if (it->status ().isToBeInstalled ()) {
- status = PK_INFO_ENUM_INSTALLING;
- hit = TRUE;
- }else if (it->status ().isToBeUninstalledDueToUpgrade ()) {
- status = PK_INFO_ENUM_UPDATING;
- hit = TRUE;
- }else if (it->status ().isToBeUninstalledDueToObsolete ()) {
- status = PK_INFO_ENUM_OBSOLETING;
- hit = TRUE;
- }
+ // look for packages which would be uninstalled
+ for (zypp::ResPool::byKind_iterator it = pool.byKindBegin (zypp::ResKind::package);
+ it != pool.byKindEnd (zypp::ResKind::package); it++) {
+ PkInfoEnum status = PK_INFO_ENUM_UNKNOWN;
+
+ gboolean hit = FALSE;
+
+ if (it->status ().isToBeUninstalled ()) {
+ status = PK_INFO_ENUM_REMOVING;
+ hit = TRUE;
+ }else if (it->status ().isToBeInstalled ()) {
+ status = PK_INFO_ENUM_INSTALLING;
+ hit = TRUE;
+ }else if (it->status ().isToBeUninstalledDueToUpgrade ()) {
+ status = PK_INFO_ENUM_UPDATING;
+ hit = TRUE;
+ }else if (it->status ().isToBeUninstalledDueToObsolete ()) {
+ status = PK_INFO_ENUM_OBSOLETING;
+ hit = TRUE;
+ }
- if (hit) {
- gchar *package_id;
- package_id = pk_package_id_build ( it->resolvable ()->name ().c_str(),
- it->resolvable ()->edition ().asString ().c_str(),
- it->resolvable ()->arch ().c_str(),
- it->resolvable ()->repoInfo().alias ().c_str ());
+ if (hit) {
+ gchar *package_id;
+ package_id = pk_package_id_build ( it->resolvable ()->name ().c_str(),
+ it->resolvable ()->edition ().asString ().c_str(),
+ it->resolvable ()->arch ().c_str(),
+ it->resolvable ()->repoInfo().alias ().c_str ());
- pk_backend_package (backend, status, package_id, "");
- // FIXME There is something in our descriptions which let crash pk
- //it->resolvable ()->description ().c_str ());
+ pk_backend_package (backend, status, package_id, "");
+ // FIXME There is something in our descriptions which let crash pk
+ //it->resolvable ()->description ().c_str ());
- g_free (package_id);
+ g_free (package_id);
+ }
+ it->statusReset ();
}
- it->statusReset ();
- }
- // undo the status-change of the package and disable forceResolve
- package.statusReset ();
- solver.setForceResolve (false);
+ // undo the status-change of the package and disable forceResolve
+ package.statusReset ();
+ solver.setForceResolve (false);
+ }
pk_package_id_free (pi);
@@ -302,7 +304,7 @@ backend_get_depends_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
- package_ids = pk_backend_get_string (backend, "package_ids");
+ package_ids = pk_backend_get_strv (backend, "package_ids");
PkPackageId *pi = pk_package_id_new_from_string (package_ids[0]);
if (pi == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
@@ -462,87 +464,96 @@ backend_get_details_thread (PkBackend *backend)
gchar **package_ids;
PkPackageId *pi;
- package_ids = pk_backend_get_string (backend, "package_ids");
- pi = pk_package_id_new_from_string (package_ids[0]);
- if (pi == NULL) {
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ if (package_ids == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
- pk_package_id_free (pi);
pk_backend_finished (backend);
return FALSE;
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- std::vector<zypp::sat::Solvable> *v;
- std::vector<zypp::sat::Solvable> *v2;
- std::vector<zypp::sat::Solvable> *v3;
- v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
- v2 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::patch, TRUE);
- v3 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::srcpackage, TRUE);
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
- v->insert (v->end (), v2->begin (), v2->end ());
- v->insert (v->end (), v3->begin (), v3->end ());
+ pi = pk_package_id_new_from_string (package_ids[i]);
+ if (pi == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
+ pk_backend_finished (backend);
+ return FALSE;
+ }
- zypp::sat::Solvable package;
- for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
- it != v->end (); it++) {
- gchar *version = g_strdup (it->edition ().asString ().c_str ());
- gchar *arch = g_strdup (it->arch ().c_str ());
+ std::vector<zypp::sat::Solvable> *v;
+ std::vector<zypp::sat::Solvable> *v2;
+ std::vector<zypp::sat::Solvable> *v3;
+ v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
+ v2 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::patch, TRUE);
+ v3 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::srcpackage, TRUE);
- if (strcmp (pi->version, version) == 0 && strcmp (pi->arch, arch) == 0) {
- package = *it;
- break;
+ v->insert (v->end (), v2->begin (), v2->end ());
+ v->insert (v->end (), v3->begin (), v3->end ());
+
+ zypp::sat::Solvable package;
+ for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
+ it != v->end (); it++) {
+ gchar *version = g_strdup (it->edition ().asString ().c_str ());
+ gchar *arch = g_strdup (it->arch ().c_str ());
+
+ if (strcmp (pi->version, version) == 0 && strcmp (pi->arch, arch) == 0) {
+ package = *it;
+ break;
+ }
+ g_free (version);
+ g_free (arch);
}
- g_free (version);
- g_free (arch);
- }
- delete (v);
- delete (v2);
- delete (v3);
+ delete (v);
+ delete (v2);
+ delete (v3);
- if (package == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
+ if (package == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
+ pk_package_id_free (pi);
+ pk_backend_finished (backend);
+ return FALSE;
+ }
- try {
- PkGroupEnum group = get_enum_group (zypp_get_group (package));
+ try {
+ PkGroupEnum group = get_enum_group (zypp_get_group (package));
- if (package.isSystem ()){
- zypp::target::rpm::RpmHeader::constPtr rpmHeader = zypp_get_rpmHeader (package.name (), package.edition ());
+ if (package.isSystem ()){
+ zypp::target::rpm::RpmHeader::constPtr rpmHeader = zypp_get_rpmHeader (package.name (), package.edition ());
- pk_backend_details (backend,
- package_id, // package_id
- rpmHeader->tag_license ().c_str (), // const gchar *license
- group, // PkGroupEnum group
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
- rpmHeader->tag_url (). c_str (), // const gchar *url
- (gulong)rpmHeader->tag_archivesize ()); // gulong size
+ pk_backend_details (backend,
+ package_ids[i], // package_id
+ rpmHeader->tag_license ().c_str (), // const gchar *license
+ group, // PkGroupEnum group
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
+ rpmHeader->tag_url (). c_str (), // const gchar *url
+ (gulong)rpmHeader->tag_archivesize ()); // gulong size
- } else {
- pk_backend_details (backend,
- package_id,
- package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
- group,
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
- "TODO", //pkg->url ().c_str (),
- ((gulong)package.lookupNumAttribute (zypp::sat::SolvAttr::downloadsize) * 1024)); //pkg->size ());
- }
+ } else {
+ pk_backend_details (backend,
+ package_ids[i],
+ package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
+ group,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
+ "TODO", //pkg->url ().c_str (),
+ ((gulong)package.lookupNumAttribute (zypp::sat::SolvAttr::downloadsize) * 1024)); //pkg->size ());
+ }
- } catch (const zypp::target::rpm::RpmException &ex) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
- pk_backend_finished (backend);
+ } catch (const zypp::target::rpm::RpmException &ex) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
+ pk_backend_finished (backend);
- return FALSE;
- } catch (const zypp::Exception &ex) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, ex.asUserString ().c_str ());
- pk_backend_finished (backend);
+ return FALSE;
+ } catch (const zypp::Exception &ex) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, ex.asUserString ().c_str ());
+ pk_backend_finished (backend);
- return FALSE;
+ return FALSE;
+ }
+
+ pk_package_id_free (pi);
}
- pk_package_id_free (pi);
pk_backend_finished (backend);
return TRUE;
}
@@ -802,83 +813,81 @@ backend_install_files (PkBackend *backend, gboolean trusted, gchar **full_paths)
static gboolean
backend_get_update_detail_thread (PkBackend *backend)
{
- PkPackageId *pi;
gchar **package_ids;
- package_ids = pk_backend_get_string (backend, "package_ids");
- pi = pk_package_id_new_from_string (package_ids[0]);
- if (pi == NULL) {
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ if (package_ids == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
- pk_package_id_free (pi);
pk_backend_finished (backend);
return FALSE;
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- zypp::sat::Solvable solvable = zypp_get_package_by_id (package_id);
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
+ zypp::sat::Solvable solvable = zypp_get_package_by_id (package_ids[i]);
- zypp::Capabilities obs = solvable.obsoletes ();
- zypp::Capabilities upd = solvable.freshens ();
+ zypp::Capabilities obs = solvable.obsoletes ();
+ zypp::Capabilities upd = solvable.freshens ();
- gchar *obsoletes = zypp_build_package_id_capabilities (obs);
- gchar *updates = zypp_build_package_id_capabilities (upd);
+ gchar *obsoletes = zypp_build_package_id_capabilities (obs);
+ gchar *updates = zypp_build_package_id_capabilities (upd);
- PkRestartEnum restart = PK_RESTART_ENUM_NONE;
+ PkRestartEnum restart = PK_RESTART_ENUM_NONE;
- zypp::PoolItem item = zypp::ResPool::instance ().find (solvable);
+ zypp::PoolItem item = zypp::ResPool::instance ().find (solvable);
- gchar *bugzilla = new gchar ();
- gchar *cve = new gchar ();
+ gchar *bugzilla = new gchar ();
+ gchar *cve = new gchar ();
- if (zypp::isKind<zypp::Patch>(solvable)) {
- zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
- if (patch->rebootSuggested ()) {
- restart = PK_RESTART_ENUM_SYSTEM;
- } else if (patch->restartSuggested ()) {
- restart = PK_RESTART_ENUM_SESSION;
- }
+ if (zypp::isKind<zypp::Patch>(solvable)) {
+ zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
+ if (patch->rebootSuggested ()) {
+ restart = PK_RESTART_ENUM_SYSTEM;
+ } else if (patch->restartSuggested ()) {
+ restart = PK_RESTART_ENUM_SESSION;
+ }
- // Building links like "http://www.distro-update.org/page?moo;Bugfix release for kernel;http://www.test.de/bgz;test domain"
- for (zypp::Patch::ReferenceIterator it = patch->referencesBegin (); it != patch->referencesEnd (); it ++) {
- if (it.type () == "bugzilla") {
- if (strlen (bugzilla) == 0) {
- bugzilla = g_strconcat (it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
- } else {
- bugzilla = g_strconcat (bugzilla, ";", it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
- }
- } else {
- if (strlen (cve) == 0) {
- cve = g_strconcat (it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
+ // Building links like "http://www.distro-update.org/page?moo;Bugfix release for kernel;http://www.test.de/bgz;test domain"
+ for (zypp::Patch::ReferenceIterator it = patch->referencesBegin (); it != patch->referencesEnd (); it ++) {
+ if (it.type () == "bugzilla") {
+ if (strlen (bugzilla) == 0) {
+ bugzilla = g_strconcat (it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
+ } else {
+ bugzilla = g_strconcat (bugzilla, ";", it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
+ }
} else {
- cve = g_strconcat (cve, it.href ().c_str (), ";", it.title ().c_str (), ";", (gchar *)NULL);
+ if (strlen (cve) == 0) {
+ cve = g_strconcat (it.href ().c_str (), ";", it.title ().c_str (), (gchar *)NULL);
+ } else {
+ cve = g_strconcat (cve, it.href ().c_str (), ";", it.title ().c_str (), ";", (gchar *)NULL);
+ }
}
}
- }
- zypp::sat::SolvableSet content = patch->contents ();
+ zypp::sat::SolvableSet content = patch->contents ();
- for (zypp::sat::SolvableSet::const_iterator it = content.begin (); it != content.end (); it++) {
- obsoletes = g_strconcat (obsoletes, zypp_build_package_id_capabilities (it->obsoletes ()), " ", (gchar *)NULL);
- updates = g_strconcat (updates, zypp_build_package_id_capabilities (it->freshens ()), " ", (gchar *)NULL);
+ for (zypp::sat::SolvableSet::const_iterator it = content.begin (); it != content.end (); it++) {
+ obsoletes = g_strconcat (obsoletes, zypp_build_package_id_capabilities (it->obsoletes ()), " ", (gchar *)NULL);
+ updates = g_strconcat (updates, zypp_build_package_id_capabilities (it->freshens ()), " ", (gchar *)NULL);
+ }
}
- }
- pk_backend_update_detail (backend,
- package_id,
- updates, // updates
- obsoletes, // CURRENTLY CAUSES SEGFAULT obsoletes,
- "", // CURRENTLY CAUSES SEGFAULT solvable.vendor ().c_str (),
- bugzilla, // bugzilla
- cve, // cve
- restart,
- solvable.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
-
- g_free (bugzilla);
- g_free (cve);
- g_free (obsoletes);
- g_free (updates);
- pk_package_id_free (pi);
+ pk_backend_update_detail (backend,
+ package_ids[i],
+ updates, // updates
+ obsoletes, // CURRENTLY CAUSES SEGFAULT obsoletes,
+ "", // CURRENTLY CAUSES SEGFAULT solvable.vendor ().c_str (),
+ bugzilla, // bugzilla
+ cve, // cve
+ restart,
+ solvable.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
+
+ g_free (bugzilla);
+ g_free (cve);
+ g_free (obsoletes);
+ g_free (updates);
+ }
pk_backend_finished (backend);
return TRUE;
@@ -1161,45 +1170,46 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
static gboolean
backend_resolve_thread (PkBackend *backend)
{
- gchar **package_ids = pk_backend_get_string (backend, "package_ids");
- const gchar *package = package_ids[0];
+ gchar **package_ids = pk_backend_get_strv (backend, "package_ids");
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- std::vector<zypp::sat::Solvable> *v;
- std::vector<zypp::sat::Solvable> *v2;
- v = zypp_get_packages_by_name (package_id, zypp::ResKind::package, TRUE);
- v2 = zypp_get_packages_by_name (package_id, zypp::ResKind::srcpackage, TRUE);
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
+ std::vector<zypp::sat::Solvable> *v;
+ std::vector<zypp::sat::Solvable> *v2;
+ v = zypp_get_packages_by_name (package_ids[i], zypp::ResKind::package, TRUE);
+ v2 = zypp_get_packages_by_name (package_ids[i], zypp::ResKind::srcpackage, TRUE);
+
+ v->insert (v->end (), v2->begin (), v2->end ());
+
+ zypp::sat::Solvable package;
+ for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
+ it != v->end (); it++) {
+ const char *version = it->edition ().asString ().c_str ();
+ if (package == zypp::sat::Solvable::noSolvable) {
+ package = *it;
+ } else if (g_ascii_strcasecmp (version, package.edition ().asString ().c_str ()) > 0) {
+ package = *it;
+ }
+ }
- v->insert (v->end (), v2->begin (), v2->end ());
+ delete (v);
+ delete (v2);
- zypp::sat::Solvable package;
- for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
- it != v->end (); it++) {
- const char *version = it->edition ().asString ().c_str ();
- if (package == zypp::sat::Solvable::noSolvable) {
- package = *it;
- } else if (g_ascii_strcasecmp (version, package.edition ().asString ().c_str ()) > 0) {
- package = *it;
+ if (package == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
+ pk_backend_finished (backend);
+ return FALSE;
}
- }
-
- delete (v);
- delete (v2);
- if (package == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
- pk_backend_finished (backend);
- return FALSE;
+ const gchar *package_id = zypp_build_package_id_from_resolvable (package);
+ // TODO: Determine whether the package is installed and emit either PK_INFO_ENUM_AVAILABLE or PK_INFO_ENUM_INSTALLED
+ pk_backend_package (backend,
+ PK_INFO_ENUM_AVAILABLE,
+ package_id,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
}
- package_id = zypp_build_package_id_from_resolvable (package);
- // TODO: Determine whether the package is installed and emit either PK_INFO_ENUM_AVAILABLE or PK_INFO_ENUM_INSTALLED
- pk_backend_package (backend,
- PK_INFO_ENUM_AVAILABLE,
- package_id,
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
-
pk_backend_finished (backend);
return TRUE;
}
@@ -1350,8 +1360,8 @@ backend_get_repo_list (PkBackend *backend, PkFilterEnum filters)
std::list <zypp::RepoInfo> repos;
try
{
- //repos = manager.knownRepositories();
- repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
+ repos = manager.knownRepositories();
+ //repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
}
catch ( const zypp::Exception &e)
{
@@ -1410,69 +1420,73 @@ backend_get_files_thread (PkBackend *backend)
PkPackageId *pi;
gchar **package_ids;
- package_ids = pk_backend_get_string (backend, "package_ids");
- pi = pk_package_id_new_from_string (package_ids[0]);
- if (pi == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
- pk_package_id_free (pi);
-
- pk_backend_finished (backend);
- return FALSE;
- }
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
-
- std::vector<zypp::sat::Solvable> *v;
- std::vector<zypp::sat::Solvable> *v2;
- v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
- v2 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::srcpackage, TRUE);
-
- v->insert (v->end (), v2->begin (), v2->end ());
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+
+ for(uint i = 0; i < g_strv_length(package_ids); i++) {
+ pi = pk_package_id_new_from_string (package_ids[i]);
+ if (pi == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
+ pk_package_id_free (pi);
- zypp::sat::Solvable package;
- for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
- it != v->end (); it++) {
- char *version = g_strdup (it->edition ().asString ().c_str ());
- if (strcmp (pi->version, version) == 0) {
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+
+ std::vector<zypp::sat::Solvable> *v;
+ std::vector<zypp::sat::Solvable> *v2;
+ v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
+ v2 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::srcpackage, TRUE);
+
+ v->insert (v->end (), v2->begin (), v2->end ());
+
+ zypp::sat::Solvable package;
+ for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
+ it != v->end (); it++) {
+ char *version = g_strdup (it->edition ().asString ().c_str ());
+ if (strcmp (pi->version, version) == 0) {
+ g_free (version);
+ package = *it;
+ break;
+ }
g_free (version);
- package = *it;
- break;
}
- g_free (version);
- }
- delete (v);
- delete (v2);
+ delete (v);
+ delete (v2);
- if (package == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
- pk_package_id_free (pi);
+ if (package == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
+ pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
+ pk_backend_finished (backend);
+ return FALSE;
+ }
- std::string temp;
- if (package.isSystem ()){
- try {
- zypp::target::rpm::RpmHeader::constPtr rpmHeader = zypp_get_rpmHeader (package.name (), package.edition ());
- std::list<std::string> files = rpmHeader->tag_filenames ();
+ std::string temp;
+ if (package.isSystem ()){
+ try {
+ zypp::target::rpm::RpmHeader::constPtr rpmHeader = zypp_get_rpmHeader (package.name (), package.edition ());
+ std::list<std::string> files = rpmHeader->tag_filenames ();
- for (std::list<std::string>::iterator it = files.begin (); it != files.end (); it++) {
- temp.append (*it);
- temp.append (";");
- }
+ for (std::list<std::string>::iterator it = files.begin (); it != files.end (); it++) {
+ temp.append (*it);
+ temp.append (";");
+ }
- } catch (const zypp::target::rpm::RpmException &ex) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
- pk_backend_finished (backend);
- return FALSE;
+ } catch (const zypp::target::rpm::RpmException &ex) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+ } else {
+ temp = "Only available for installed packages";
}
- } else {
- temp = "Only available for installed packages";
+
+ pk_backend_files (backend, package_ids[i], temp.c_str ()); // file_list
+ pk_package_id_free (pi);
}
- pk_backend_files (backend, package_id, temp.c_str ()); // file_list
- pk_package_id_free (pi);
pk_backend_finished (backend);
return TRUE;
}
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 47e4e1e..168c476 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -165,8 +165,8 @@ zypp_build_pool (gboolean include_local)
zypp::RepoManager manager;
std::list<zypp::RepoInfo> repos;
try {
- //repos = manager.knownRepositories ();
- repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
+ repos = manager.knownRepositories ();
+ //repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
for (std::list<zypp::RepoInfo>::iterator it = repos.begin(); it != repos.end (); it++) {
zypp::RepoInfo repo (*it);
@@ -862,8 +862,8 @@ zypp_refresh_cache (PkBackend *backend, gboolean force)
std::list <zypp::RepoInfo> repos;
try
{
- //repos = manager.knownRepositories();
- repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
+ repos = manager.knownRepositories();
+ //repos = std::list<zypp::RepoInfo>(manager.repoBegin(),manager.repoEnd());
}
catch ( const zypp::Exception &e)
{
commit 0999e9cb36da84d30f0dcbb734974f92a969d1b6
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Mon Aug 4 20:10:19 2008 -0300
Fixed a typo in policy file (system"S")
diff --git a/policy/org.freedesktop.packagekit.policy.in b/policy/org.freedesktop.packagekit.policy.in
index 883c670..b2ee0df 100644
--- a/policy/org.freedesktop.packagekit.policy.in
+++ b/policy/org.freedesktop.packagekit.policy.in
@@ -91,7 +91,7 @@
</defaults>
</action>
- <action id="org.freedesktop.packagekit.systems-sources-configure">
+ <action id="org.freedesktop.packagekit.system-sources-configure">
<_description>Change software source parameters</_description>
<_message>Authentication is required to change software source parameters</_message>
<icon_name>pk-package-info</icon_name>
diff --git a/src/pk-security-polkit.c b/src/pk-security-polkit.c
index 30744af..6d6a1aa 100644
--- a/src/pk-security-polkit.c
+++ b/src/pk-security-polkit.c
@@ -114,7 +114,7 @@ pk_security_role_to_action (PkSecurity *security, gboolean trusted, PkRoleEnum r
policy = "org.freedesktop.packagekit.system-rollback";
} else if (role == PK_ROLE_ENUM_REPO_ENABLE ||
role == PK_ROLE_ENUM_REPO_SET_DATA) {
- policy = "org.freedesktop.packagekit.systems-sources-configure";
+ policy = "org.freedesktop.packagekit.system-sources-configure";
} else if (role == PK_ROLE_ENUM_REFRESH_CACHE) {
policy = "org.freedesktop.packagekit.system-sources-refresh";
} else if (role == PK_ROLE_ENUM_SET_PROXY_PRIVATE) {
More information about the PackageKit-commit
mailing list