[packagekit] packagekit: Branch 'master' - 18 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Feb 12 23:50:50 PST 2008
Makefile.am | 2
backends/apt/helpers/aptBackend.py | 273 ++++++++++-------
backends/apt/helpers/get-depends.py | 3
backends/apt/helpers/get-requires.py | 2
backends/apt/helpers/install-file.py | 20 +
backends/apt/helpers/repo-enable.py | 20 +
backends/apt/pk-apt-search-sqlite.cpp | 9
backends/apt/pk-sqlite-pkg-cache.cpp | 16
backends/apt/pk-sqlite-pkg-cache.h | 1
backends/zypp/pk-backend-zypp.cpp | 75 +++-
libpackagekit/pk-common.h | 2
libpackagekit/pk-debug.c | 1
libpackagekit/pk-debug.h | 18 +
libpackagekit/pk-enum.c | 130 ++++++++
libpackagekit/pk-extra-obj.c | 6
libpackagekit/pk-extra-obj.h | 5
libpackagekit/pk-extra.c | 11
libpackagekit/pk-extra.h | 6
libpackagekit/pk-package-id.h | 9
libpackagekit/pk-package-list.h | 5
src/pk-backend-dbus.c | 545 +++++++++++++---------------------
21 files changed, 683 insertions(+), 476 deletions(-)
New commits:
commit 6aa3a34dd577290e4a572a3eacd7582048f11f6c
Merge: 01d0463... a8f8376...
Author: Scott Reeves <sreeves at novell.com>
Date: Tue Feb 12 18:06:26 2008 -0700
Merge branch 'master' of git+ssh://sreeves@git.packagekit.org/srv/git/PackageKit
commit 01d04634bab588d9a2f50ce6571f55aac6be9baa
Author: Scott Reeves <sreeves at novell.com>
Date: Tue Feb 12 18:05:25 2008 -0700
move to PkBackendThread
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 8ab0b7e..bc3e70e 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -22,6 +22,7 @@
#include <gmodule.h>
#include <glib.h>
#include <pk-backend.h>
+#include <pk-backend-thread.h>
#include <unistd.h>
#include <pk-debug.h>
#include <string>
@@ -102,20 +103,26 @@ typedef struct {
*/
static std::map<PkBackend *, EventDirector *> _eventDirectors;
+static PkBackendThread *thread;
+
/**
- * backend_initialize:
+ * backend_initalize:
+ * This should only be run once per backend load, i.e. not every transaction
*/
static void
backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
-fprintf (stderr, "\n\n*** zypp_backend_initialize ***\n\n");
+ fprintf (stderr, "\n\n*** zypp_backend_initialize ***\n\n");
EventDirector *eventDirector = new EventDirector (backend);
_eventDirectors [backend] = eventDirector;
+
+ thread = pk_backend_thread_new ();
}
/**
- * backend_destroy
+ * backend_destroy:
+ * This should only be run once per backend load, i.e. not every transaction
*/
static void
backend_destroy (PkBackend *backend)
@@ -127,6 +134,8 @@ fprintf (stderr, "\n\n*** zypp_backend_destroy ***\n\n");
delete (eventDirector);
_eventDirectors.erase (backend);
}
+
+ g_object_unref (thread);
}
/**
@@ -167,7 +176,7 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
}
static gboolean
-backend_get_depends_thread (PkBackend *backend, gpointer data)
+backend_get_depends_thread (PkBackendThread *thread, gpointer data)
{
// Note: I talked with duncanmv in #zypp and he suggested the
// way we could suppor this method would be to mark the desired
@@ -179,6 +188,9 @@ backend_get_depends_thread (PkBackend *backend, gpointer data)
08:56 < duncanmv> which are the packages marked by the solver
08:56 < duncanmv> you can say that status toBeInstalled() and bySolver are requires
*/
+ PkBackend *backend;
+ backend = pk_backend_thread_get_backend (thread);
+
ThreadData *d = (ThreadData*) data;
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
@@ -323,15 +335,17 @@ backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recur
data->package_id = g_strdup (package_id);
data->type = DEPS_TYPE_DEPENDS;
- pk_backend_thread_create (backend, backend_get_depends_thread, data);
+ pk_backend_thread_create (thread, backend_get_depends_thread, data);
}
static gboolean
-backend_get_description_thread (PkBackend *backend, gpointer data)
+backend_get_description_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
PkPackageId *pi;
ThreadData *d = (ThreadData*) data;
+ backend = pk_backend_thread_get_backend (thread);
pi = pk_package_id_new_from_string (d->package_id);
if (pi == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
@@ -399,7 +413,7 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
pk_backend_finished (backend);
} else {
data->package_id = g_strdup(package_id);
- pk_backend_thread_create (backend, backend_get_description_thread, data);
+ pk_backend_thread_create (thread, backend_get_description_thread, data);
}
}
@@ -451,8 +465,11 @@ findArchUpdateItem (const zypp::ResPool & pool, zypp::PoolItem_Ref item)
}
static gboolean
-backend_get_updates_thread (PkBackend *backend, gpointer data)
+backend_get_updates_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
+
+ backend = pk_backend_thread_get_backend (thread);
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
@@ -500,12 +517,15 @@ static void
backend_get_updates (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_backend_thread_create (backend, backend_get_updates_thread, NULL);
+ pk_backend_thread_create (thread, backend_get_updates_thread, NULL);
}
static gboolean
-backend_install_package_thread (PkBackend *backend, gpointer data)
+backend_install_package_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
+
+ backend = pk_backend_thread_get_backend (thread);
gchar *package_id = (gchar *)data;
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
@@ -643,13 +663,16 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
//printf("package_id is %s\n", package_id);
gchar *package_to_install = g_strdup (package_id);
- pk_backend_thread_create (backend, backend_install_package_thread, package_to_install);
+ pk_backend_thread_create (thread, backend_install_package_thread, package_to_install);
}
static gboolean
-backend_refresh_cache_thread (PkBackend *backend, gpointer data)
+backend_refresh_cache_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
RefreshData *d = (RefreshData*) data;
+
+ backend = pk_backend_thread_get_backend (thread);
gboolean force = d->force;
g_free (d);
@@ -724,9 +747,12 @@ fprintf (stderr, "\n\n *** Building cache ***\n\n");
}
static gboolean
-backend_remove_package_thread (PkBackend *backend, gpointer data)
+backend_remove_package_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
RemovePackageData *d = (RemovePackageData *)data;
+
+ backend = pk_backend_thread_get_backend (thread);
PkPackageId *pi;
pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE);
@@ -836,7 +862,7 @@ backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean al
data->package_id = g_strdup (package_id);
data->deps_behavior = allow_deps == TRUE ? DEPS_ALLOW : DEPS_NO_ALLOW;
- pk_backend_thread_create (backend, backend_remove_package_thread, data);
+ pk_backend_thread_create (thread, backend_remove_package_thread, data);
}
/**
@@ -848,25 +874,30 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
g_return_if_fail (backend != NULL);
// check network state
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
+ /*
+ if (pk_network_is_online (backend) == FALSE) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache while offline");
pk_backend_finished (backend);
return;
}
+ */
RefreshData *data = g_new(RefreshData, 1);
if (data == NULL) {
pk_backend_error_code(backend, PK_ERROR_ENUM_OOM, "Failed to allocate memory in backend_refresh_cache");
pk_backend_finished (backend);
} else {
data->force = force;
- pk_backend_thread_create (backend, backend_refresh_cache_thread, data);
+ pk_backend_thread_create (thread, backend_refresh_cache_thread, data);
}
}
static gboolean
-backend_resolve_thread (PkBackend *backend, gpointer data)
+backend_resolve_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
gchar *package_id;
+
+ backend = pk_backend_thread_get_backend (thread);
ResolveData *rdata = (ResolveData*) data;
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
@@ -926,7 +957,7 @@ backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_i
} else {
data->name = g_strdup (package_id);
data->filter = g_strdup (filter);
- pk_backend_thread_create (backend, backend_resolve_thread, data);
+ pk_backend_thread_create (thread, backend_resolve_thread, data);
}
}
@@ -1024,10 +1055,12 @@ find_packages_real (PkBackend *backend, const gchar *search, const gchar *filter
}
static gboolean
-backend_find_packages_thread (PkBackend *backend, gpointer data)
+backend_find_packages_thread (PkBackendThread *thread, gpointer data)
{
+ PkBackend *backend;
FindData *d = (FindData*) data;
+ backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
find_packages_real (backend, d->search, d->filter, d->mode);
@@ -1054,7 +1087,7 @@ find_packages (PkBackend *backend, const gchar *search, const gchar *filter, gin
data->search = g_strdup(search);
data->filter = g_strdup(filter);
data->mode = mode;
- pk_backend_thread_create (backend, backend_find_packages_thread, data);
+ pk_backend_thread_create (thread, backend_find_packages_thread, data);
}
}
commit a8f8376cf45bb8363242da6eb3743fb628be4622
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Feb 13 00:37:12 2008 +0000
Apt: update to latest API (*way* out of date)
diff --git a/backends/apt/pk-apt-search-sqlite.cpp b/backends/apt/pk-apt-search-sqlite.cpp
index 329d9f4..640799d 100644
--- a/backends/apt/pk-apt-search-sqlite.cpp
+++ b/backends/apt/pk-apt-search-sqlite.cpp
@@ -23,11 +23,14 @@
#include <glib.h>
#include <string.h>
#include <pk-backend.h>
+#include <pk-backend-spawn.h>
#include "pk-sqlite-pkg-cache.h"
#include <apt-pkg/configuration.h>
#include <apt-pkg/init.h>
#include "pk-apt-build-db.h"
+static PkBackendSpawn *spawn;
+
/**
* backend_get_groups:
*/
@@ -99,7 +102,7 @@ backend_search_group (PkBackend *backend, const gchar *filter, const gchar *sear
{
g_return_if_fail (backend != NULL);
pk_backend_set_allow_cancel (backend, TRUE);
- pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
+ pk_backend_spawn_helper (spawn, "search-group.py", filter, search, NULL);
}
static gboolean inited = FALSE;
@@ -125,6 +128,10 @@ extern "C" void backend_init_search(PkBackend *backend)
//sqlite_set_installed_check(is_installed);
sqlite_init_cache(backend, APT_DB, apt_fname, apt_build_db);
g_free(apt_fname);
+
+ spawn = pk_backend_spawn_new ();
+ pk_backend_spawn_set_name (spawn, "apt-sqlite");
+
inited = TRUE;
}
}
diff --git a/backends/apt/pk-sqlite-pkg-cache.cpp b/backends/apt/pk-sqlite-pkg-cache.cpp
index 62534f1..f3df8c2 100644
--- a/backends/apt/pk-sqlite-pkg-cache.cpp
+++ b/backends/apt/pk-sqlite-pkg-cache.cpp
@@ -24,6 +24,7 @@
#include "pk-sqlite-pkg-cache.h"
static sqlite3 *db = NULL;
+static PkBackendThread *thread;
static gboolean(*is_installed) (const PkPackageId *) = NULL;
void sqlite_set_installed_check(gboolean(*func) (const PkPackageId *))
@@ -48,6 +49,8 @@ sqlite_init_cache(PkBackend *backend, const char* dbname, const char *compare_fn
struct stat st;
time_t db_age;
+ thread = pk_backend_thread_new ();
+
ret = sqlite3_open (dbname, &db);
g_assert(ret == SQLITE_OK);
g_assert(db!=NULL);
@@ -85,12 +88,14 @@ void sqlite_finish_cache(PkBackend *backend)
// sqlite_search_packages_thread
static gboolean
-sqlite_search_packages_thread (PkBackend *backend, gpointer data)
+sqlite_search_packages_thread (PkBackendThread *thread, gpointer data)
{
search_task *st = (search_task *) data;
int res;
gchar *sel;
+ PkBackend *backend;
+ backend = pk_backend_thread_get_backend (thread);
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
pk_backend_no_percentage_updates(backend);
@@ -168,7 +173,7 @@ backend_search_common(PkBackend * backend, const gchar * filter, const gchar * s
data->search = g_strdup(search);
data->filter = g_strdup(filter);
data->depth = which;
- pk_backend_thread_create (backend, func, data);
+ pk_backend_thread_create (thread, func, data);
}
}
@@ -191,11 +196,13 @@ sqlite_search_name (PkBackend *backend, const gchar *filter, const gchar *search
}
// sqlite_get_description_thread
-static gboolean sqlite_get_description_thread (PkBackend *backend, gpointer data)
+static gboolean sqlite_get_description_thread (PkBackendThread *thread, gpointer data)
{
desc_task *dt = (desc_task *) data;
int res;
+ PkBackend *backend;
+ backend = pk_backend_thread_get_backend (thread);
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
pk_backend_no_percentage_updates(backend);
@@ -247,7 +254,7 @@ sqlite_get_description (PkBackend *backend, const gchar *package_id)
return;
}
- pk_backend_thread_create (backend, sqlite_get_description_thread, data);
+ pk_backend_thread_create (thread, sqlite_get_description_thread, data);
return;
}
diff --git a/backends/apt/pk-sqlite-pkg-cache.h b/backends/apt/pk-sqlite-pkg-cache.h
index e9a77a2..74fa276 100644
--- a/backends/apt/pk-sqlite-pkg-cache.h
+++ b/backends/apt/pk-sqlite-pkg-cache.h
@@ -29,6 +29,7 @@ typedef enum {
} SearchDepth;
#include <pk-backend.h>
+#include <pk-backend-thread.h>
#include <sqlite3.h>
void sqlite_init_cache(PkBackend *backend, const char* dbname, const char* compare_fname, void (*build_db)(PkBackend *, sqlite3 *db));
commit da6d69c7c87a1c64b0316c39bdfbe81003438e54
Author: Tom Parker <palfrey at tevp.net>
Date: Sat Dec 29 01:47:30 2007 +0000
apt: Cleanup of Package class, by making it a subclass of apt.Package
There was a lot of duplication of properties before, and now they're
there automagically. Also, for the sake of maintaining a unified front,
a number of the support functions in Package have now gone to CamelCase,
and the _HYPHEN_PATTERN is embedded appropriately rather than being
a module-level item.
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index c2e4ac3..2c1da14 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -29,9 +29,7 @@ from urlparse import urlparse
from apt.debfile import DebPackage
from os import system
-_HYPHEN_PATTERN = re.compile(r'(\s|_)+')
-
-class Package(object):
+class Package(apt.Package):
def __str__(self):
return "Package %s, version %s"%(self.name,self._version)
@@ -41,17 +39,21 @@ class Package(object):
return False
return True
+ def __setParent(self,pkg):
+ for x in ["_pkg","_depcache","_records"]:
+ setattr(self,x,getattr(pkg,x))
+
def __init__(self, backend, pkg, data="",version=[]):
- self._pkg = pkg
+ self.__setParent(pkg)
self._version = version
self._data = data
self._backend = backend
wanted_ver = None
- if self.installed_version!=None and self._cmp_deps(version,self.installed_version):
- wanted_ver = self.installed_version
- elif self.installed_version == None and version == []:
- #self._pkg.markInstall(False,False)
- wanted_ver = self.candidate_version
+ if self.installedVersion!=None and self._cmp_deps(version,self.installedVersion):
+ wanted_ver = self.installedVersion
+ elif self.installedVersion == None and version == []:
+ #self.markInstall(False,False)
+ wanted_ver = self.candidateVersion
for ver in pkg._pkg.VersionList:
#print "vers",dir(ver),version,ver
@@ -74,9 +76,9 @@ class Package(object):
backend.error(ERROR_INTERNAL_ERROR,"Can't find version %s for %s"%(version,self.name))
def setVersion(self,version,compare="="):
- if version!=None and (self.installed_version == None or not apt_pkg.CheckDep(version,compare,self.installed_version)):
- self._pkg.markInstall(False,False)
- if self.candidate_version != version:
+ if version!=None and (self.installedVersion == None or not apt_pkg.CheckDep(version,compare,self.installedVersion)):
+ self.markInstall(False,False)
+ if self.candidateVersion != version:
if self._data == "":
for ver in pkg._pkg.VersionList:
f, index = ver.FileList.pop(0)
@@ -95,37 +97,13 @@ class Package(object):
if not self._backend._caches.has_key(origin):
self._backend._caches[origin] = apt.Cache(PackageKitProgress(self))
print "new cache for %s"%origin
- self._pkg = self._backend._caches[origin][name]
- self._pkg.markInstall(False,False)
- if not apt_pkg.CheckDep(self.candidate_version,compare,version):
+ self.__setParent(self._backend._caches[origin][name])
+ self.markInstall(False,False)
+ if not apt_pkg.CheckDep(self.candidateVersion,compare,version):
self._backend.error(ERROR_INTERNAL_ERROR,
- "Unable to locate package version %s (only got %s) for %s"%(version,self.candidate_version,name))
+ "Unable to locate package version %s (only got %s) for %s"%(version,self.candidateVersion,name))
return
- self._pkg.markKeep()
-
- @property
- def id(self):
- return self._pkg.id
-
- @property
- def name(self):
- return self._pkg.name
-
- @property
- def summary(self):
- return self._pkg.summary
-
- @property
- def description(self):
- return self._pkg.description
-
- @property
- def architecture(self):
- return self._pkg.architecture
-
- @property
- def section(self):
- return self._pkg.section
+ self.markKeep()
@property
def group(self):
@@ -155,44 +133,34 @@ class Package(object):
return "unknown"
@property
- def installed_version(self):
- return self._pkg.installedVersion
+ def isInstalled(self):
+ return super(self.__class__,self).isInstalled and self.installedVersion == self._version
@property
- def candidate_version(self):
- return self._pkg.candidateVersion
-
- @property
- def is_installed(self):
- return self._pkg.isInstalled and self.installed_version == self._version
-
- @property
- def is_upgradable(self):
- return self._pkg.isUpgradable
-
- @property
- def is_development(self):
+ def isDevelopment(self):
name = self.name.lower()
section = self.section.split('/')[-1].lower()
return name.endswith('-dev') or name.endswith('-dbg') or \
section in ('devel', 'libdevel')
@property
- def is_gui(self):
+ def isGui(self):
section = self.section.split('/')[-1].lower()
return section in ('x11', 'gnome', 'kde')
- def match_name(self, name):
+ _HYPHEN_PATTERN = re.compile(r'(\s|_)+')
+
+ def matchName(self, name):
needle = name.strip().lower()
haystack = self.name.lower()
- needle = _HYPHEN_PATTERN.sub('-', needle)
- haystack = _HYPHEN_PATTERN.sub('-', haystack)
+ needle = Package._HYPHEN_PATTERN.sub('-', needle)
+ haystack = Package._HYPHEN_PATTERN.sub('-', haystack)
if haystack.find(needle) >= 0:
return True
return False
- def match_details(self, details):
- if self.match_name(details):
+ def matchDetails(self, details):
+ if self.matchName(details):
return True
needle = details.strip().lower()
haystack = self.description.lower()
@@ -200,7 +168,7 @@ class Package(object):
return True
return False
- def match_group(self, name):
+ def matchGroup(self, name):
needle = name.strip().lower()
haystack = self.group
if haystack.startswith(needle):
@@ -233,7 +201,6 @@ class PackageKitProgress(apt.progress.OpProgress, apt.progress.FetchProgress):
self._backend.error(ERROR_INTERNAL_ERROR,
"Medium change needed")
-
class PackageKitAptBackend(PackageKitBaseBackend):
def __init__(self, args):
PackageKitBaseBackend.__init__(self, args)
@@ -260,7 +227,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
self.allow_cancel(True)
for package in self._do_search(filters,
- lambda pkg: pkg.match_name(key)):
+ lambda pkg: pkg.matchName(key)):
self._emit_package(package)
def search_details(self, filters, key):
@@ -270,7 +237,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
self.allow_cancel(True)
for package in self._do_search(filters,
- lambda pkg: pkg.match_details(key)):
+ lambda pkg: pkg.matchDetails(key)):
self._emit_package(package)
def search_group(self, filters, key):
@@ -280,7 +247,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
self.allow_cancel(True)
for package in self._do_search(filters,
- lambda pkg: pkg.match_group(key)):
+ lambda pkg: pkg.matchGroup(key)):
self._emit_package(package)
def search_file(self, filters, key):
@@ -313,7 +280,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
name, version, arch, data = self.get_package_from_id(package)
pkg = Package(self, self._apt_cache[name])
description = re.sub('\s+', ' ', pkg.description).strip()
- self.description(package, 'unknown', pkg.group, description, '', pkg._pkg.packageSize, '')
+ self.description(package, 'unknown', pkg.group, description, '', pkg.packageSize, '')
def resolve(self, name):
'''
@@ -327,9 +294,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.error(ERROR_PACKAGE_NOT_FOUND,"Can't find a package called '%s'"%name)
def _do_deps(self,inp,deps,recursive):
- inp._pkg.markInstall()
+ inp.markInstall()
newkeys = []
- for x in inp._pkg.candidateDependencies:
+ for x in inp.candidateDependencies:
n = x.or_dependencies[0].name
if not deps.has_key(n):
deps[n] = []
@@ -361,7 +328,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
def _do_reqs(self,inp,pkgs,recursive):
extra = []
fails = []
- for r in inp._pkg._pkg.RevDependsList:
+ for r in inp._pkg.RevDependsList:
ch = apt_pkg.CheckDep(inp._version,r.CompType,r.TargetVer)
v = (r.ParentPkg.Name,r.ParentVer.VerStr)
if not ch or v in fails:
@@ -480,7 +447,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
deps[pkg].append((ver,comp))
for n in deps.keys():
p = Package(self,self._apt_cache[n],version=deps[n])
- if not p.is_installed:
+ if not p.isInstalled:
p.markInstall()
assert self._apt_cache.getChanges()==[],"Don't handle install changes yet"
# FIXME: nasty hack. Need a better way in
@@ -494,7 +461,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
package._version,
package.architecture,
package._data)
- if package.is_installed:
+ if package.isInstalled:
status = INFO_INSTALLED
else:
status = INFO_AVAILABLE
@@ -511,21 +478,21 @@ class PackageKitAptBackend(PackageKitBaseBackend):
percentage = new_percentage
self.percentage(percentage)
package = Package(self, pkg)
- if package.installed_version is None and \
- package.candidate_version is None:
+ if package.installedVersion is None and \
+ package.candidateVersion is None:
continue
if not condition(package):
continue
continue
- vers = [x.VerStr for x in package._pkg._pkg.VersionList]
- if package.installed_version!=None:
- i = package.installed_version
+ vers = [x.VerStr for x in package._pkg.VersionList]
+ if package.installedVersion!=None:
+ i = package.installedVersion
if i in vers and vers[0]!=i:
del vers[vers.index(i)]
vers.insert(0,i)
for ver in vers:
- p = Package(self, package._pkg, version=[[ver,"="]])
+ p = Package(self, package, version=[[ver,"="]])
if self._do_filtering(p, filters):
yield p
self.percentage(100)
@@ -533,17 +500,17 @@ class PackageKitAptBackend(PackageKitBaseBackend):
def _do_filtering(self, package, filters):
if len(filters) == 0 or filters == ['none']:
return True
- if (FILTER_INSTALLED in filters) and (not package.is_installed):
+ if (FILTER_INSTALLED in filters) and (not package.isInstalled):
return False
- if (FILTER_NOT_INSTALLED in filters) and package.is_installed:
+ if (FILTER_NOT_INSTALLED in filters) and package.isInstalled:
return False
- if (FILTER_GUI in filters) and (not package.is_gui):
+ if (FILTER_GUI in filters) and (not package.isGui):
return False
- if (FILTER_NOT_GUI in filters) and package.is_gui:
+ if (FILTER_NOT_GUI in filters) and package.isGui:
return False
- if (FILTER_DEVELOPMENT in filters) and (not package.is_development):
+ if (FILTER_DEVELOPMENT in filters) and (not package.isDevelopment):
return False
- if (FILTER_NOT_DEVELOPMENT in filters) and package.is_development:
+ if (FILTER_NOT_DEVELOPMENT in filters) and package.isDevelopment:
return False
return True
commit 8864f0c70fd52dadce58d3d8fa151ef828a65e5a
Author: Tom Parker <palfrey at tevp.net>
Date: Sat Dec 29 00:22:02 2007 +0000
apt: Print ages of db and comparison when we rebuild sqlite
diff --git a/backends/apt/pk-sqlite-pkg-cache.cpp b/backends/apt/pk-sqlite-pkg-cache.cpp
index bf3245b..62534f1 100644
--- a/backends/apt/pk-sqlite-pkg-cache.cpp
+++ b/backends/apt/pk-sqlite-pkg-cache.cpp
@@ -62,6 +62,7 @@ sqlite_init_cache(PkBackend *backend, const char* dbname, const char *compare_fn
ret = sqlite3_exec(db, "select value from params where name = 'build_complete'", NULL, NULL, NULL);
if (ret != SQLITE_ERROR)
return;
+ pk_debug("ages are %lu for db, and %lu for comparism",db_age,st.st_mtime);
}
ret = sqlite3_exec(db,"drop table packages",NULL,NULL,NULL); // wipe it!
//g_assert(ret == SQLITE_OK);
commit 8e65165b2d538d177025651f8d60e10082ca2657
Author: Tom Parker <palfrey at tevp.net>
Date: Thu Dec 20 11:20:00 2007 +0000
apt: Make sure ordering of versions is installed one first
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index ed29805..c2e4ac3 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -517,8 +517,15 @@ class PackageKitAptBackend(PackageKitBaseBackend):
if not condition(package):
continue
continue
- for ver in package._pkg._pkg.VersionList:
- p = Package(self, package._pkg, version=[[ver.VerStr,"="]])
+ vers = [x.VerStr for x in package._pkg._pkg.VersionList]
+ if package.installed_version!=None:
+ i = package.installed_version
+ if i in vers and vers[0]!=i:
+ del vers[vers.index(i)]
+ vers.insert(0,i)
+
+ for ver in vers:
+ p = Package(self, package._pkg, version=[[ver,"="]])
if self._do_filtering(p, filters):
yield p
self.percentage(100)
commit b5e974fbafea607acc974085886207b6ec260aa3
Author: Tom Parker <palfrey at tevp.net>
Date: Thu Dec 20 11:08:23 2007 +0000
apt: Fix filtering for plain searching
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 35111a2..ed29805 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -516,10 +516,11 @@ class PackageKitAptBackend(PackageKitBaseBackend):
continue
if not condition(package):
continue
- if not self._do_filtering(package, filters):
continue
for ver in package._pkg._pkg.VersionList:
- yield Package(self, package._pkg, version=[[ver.VerStr,"="]])
+ p = Package(self, package._pkg, version=[[ver.VerStr,"="]])
+ if self._do_filtering(p, filters):
+ yield p
self.percentage(100)
def _do_filtering(self, package, filters):
commit eb73ea191ee61aed33b8efde97d5c97071c17176
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 23:01:36 2007 +0000
apt: Add initial install-file support
It's a nasty hack, spawning dpkg, and it can't cope with or-deps yet.
Patches welcome.
Oh, and fix locally installed package repo data.
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index ab3dc52..35111a2 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -16,7 +16,7 @@ import os
import re
from packagekit.backend import *
-import apt_pkg
+import apt_pkg,apt_inst
import warnings
warnings.filterwarnings(action='ignore', category=FutureWarning)
@@ -26,6 +26,8 @@ from aptsources.sourceslist import SourcesList
from sets import Set
from os.path import join,exists
from urlparse import urlparse
+from apt.debfile import DebPackage
+from os import system
_HYPHEN_PATTERN = re.compile(r'(\s|_)+')
@@ -57,8 +59,10 @@ class Package(object):
if (wanted_ver == None or wanted_ver == ver.VerStr) and self._cmp_deps(version,ver.VerStr):
f, index = ver.FileList.pop(0)
if self._data == "":
- if f.Origin!="" or f.Archive!="":
- self._data = "%s/%s"%(f.Origin,f.Archive)
+ if f.Origin=="" and f.Archive=="now":
+ self._data = "local_install"
+ elif f.Origin!="" or f.Archive!="":
+ self._data = "%s/%s"%(f.Origin.replace("/","_"),f.Archive.replace("/","_"))
else:
self._data = "%s/unknown"%f.Site
self._version = ver.VerStr
@@ -455,6 +459,35 @@ class PackageKitAptBackend(PackageKitBaseBackend):
except IOError,e:
self.error(ERROR_INTERNAL_ERROR, "Problem while trying to save repo settings to %s: %s"%(e.filename,e.strerror))
+ def install_file (self, inst_file):
+ '''
+ Implement the {backend}-install_file functionality
+ Install the package containing the inst_file file
+ '''
+ if not exists(inst_file):
+ self.error(ERROR_PACKAGE_NOT_FOUND,"Can't find %s"%inst_file)
+ return
+ deb = DebPackage(inst_file)
+ deps = {}
+ for k in ["Depends","Recommends"]:
+ if not deb._sections.has_key(k):
+ continue
+ for items in apt_pkg.ParseDepends(deb[k]):
+ assert len(items) == 1,"Can't handle or deps properly yet"
+ (pkg,ver,comp) = items[0]
+ if not deps.has_key(pkg):
+ deps[pkg] = []
+ deps[pkg].append((ver,comp))
+ for n in deps.keys():
+ p = Package(self,self._apt_cache[n],version=deps[n])
+ if not p.is_installed:
+ p.markInstall()
+ assert self._apt_cache.getChanges()==[],"Don't handle install changes yet"
+ # FIXME: nasty hack. Need a better way in
+ ret = system("dpkg -i %s"%inst_file)
+ if ret!=0:
+ self.error(ERROR_INTERNAL_ERROR,"Can't install package")
+
### Helpers ###
def _emit_package(self, package):
id = self.get_package_id(package.name,
diff --git a/backends/apt/helpers/install-file.py b/backends/apt/helpers/install-file.py
new file mode 100755
index 0000000..c323bf9
--- /dev/null
+++ b/backends/apt/helpers/install-file.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+# Copyright (C) 2007 Red Hat Inc, Seth Vidal <skvidal at fedoraproject.org>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from aptBackend import PackageKitAptBackend
+
+file_to_inst = sys.argv[1]
+backend = PackageKitAptBackend(sys.argv[1:])
+backend.install_file(file_to_inst)
+sys.exit(0)
\ No newline at end of file
commit 764fc02c1b3aec494156167af5800e38efc1543b
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 22:26:57 2007 +0000
apt: Debork get-description and add size
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 3627d03..ab3dc52 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -307,9 +307,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
self.status(STATUS_INFO)
name, version, arch, data = self.get_package_from_id(package)
- pkg = Package(self._apt_cache[name], self)
+ pkg = Package(self, self._apt_cache[name])
description = re.sub('\s+', ' ', pkg.description).strip()
- self.description(package, 'unknown', pkg.group, description, '', 0, '')
+ self.description(package, 'unknown', pkg.group, description, '', pkg._pkg.packageSize, '')
def resolve(self, name):
'''
commit d62f3d8e59b14b4590344bcf2f6284037b06fc27
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 22:21:26 2007 +0000
apt: Add recursion to get-depends
Also, fix resolve with invalid names, and shift get-requires' processing
of the "recursive" arg into a boolean into the aptBackend code.
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 6934df9..3627d03 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -316,27 +316,43 @@ class PackageKitAptBackend(PackageKitBaseBackend):
Implement the {backend}-resolve functionality
'''
self.status(STATUS_INFO)
- pkg = Package(self,self._apt_cache[name])
- self._emit_package(pkg)
-
- def get_depends(self,package):
+ try:
+ pkg = Package(self,self._apt_cache[name])
+ self._emit_package(pkg)
+ except KeyError:
+ self.error(ERROR_PACKAGE_NOT_FOUND,"Can't find a package called '%s'"%name)
+
+ def _do_deps(self,inp,deps,recursive):
+ inp._pkg.markInstall()
+ newkeys = []
+ for x in inp._pkg.candidateDependencies:
+ n = x.or_dependencies[0].name
+ if not deps.has_key(n):
+ deps[n] = []
+ newkeys.append(n)
+ deps[n].append((x.or_dependencies[0].version,x.or_dependencies[0].relation))
+ if recursive:
+ for n in newkeys:
+ try:
+ deps = self._do_deps(Package(self,self._apt_cache[n],version=deps[n]),deps,recursive)
+ except KeyError: # FIXME: we're assuming this is a virtual package, which we can't cope with yet
+ del deps[n]
+ continue
+ return deps
+
+ def get_depends(self,package, recursive):
'''
Implement the {backend}-get-depends functionality
'''
self.allow_cancel(True)
self.status(STATUS_INFO)
+ recursive = (recursive == "True")
name, version, arch, data = self.get_package_from_id(package)
pkg = Package(self,self._apt_cache[name],version=[(version,"=")],data=data)
pkg.setVersion(version)
- pkg._pkg.markInstall()
- deps = {}
- for x in pkg._pkg.candidateDependencies:
- n = x.or_dependencies[0].name
- if not deps.has_key(n):
- deps[n] = []
- deps[n].append((x.or_dependencies[0].version,x.or_dependencies[0].relation))
+ deps = self._do_deps(pkg, {}, recursive)
for n in deps.keys():
- self._emit_package(Package(self,self._apt_cache[n],version=deps[n]))
+ self._emit_package(Package(self,self._apt_cache[n],version=deps[n]))
def _do_reqs(self,inp,pkgs,recursive):
extra = []
@@ -365,8 +381,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
self.allow_cancel(True)
self.status(STATUS_INFO)
+ recursive = (recursive == "True")
name, version, arch, data = self.get_package_from_id(package)
- pkg = Package(self,self._apt_cache[name], version, data)
+ pkg = Package(self,self._apt_cache[name], version=[(version,"=")], data=data)
pkgs = Set()
self._do_reqs(pkg,pkgs, recursive)
diff --git a/backends/apt/helpers/get-depends.py b/backends/apt/helpers/get-depends.py
index b586a18..5e12d4c 100755
--- a/backends/apt/helpers/get-depends.py
+++ b/backends/apt/helpers/get-depends.py
@@ -13,6 +13,7 @@ import sys
from aptBackend import PackageKitAptBackend
package=sys.argv[1]
+recursive = sys.argv[2]
backend = PackageKitAptBackend(sys.argv[1:])
-backend.get_depends(package)
+backend.get_depends(package, recursive)
sys.exit(0)
diff --git a/backends/apt/helpers/get-requires.py b/backends/apt/helpers/get-requires.py
index e0fe567..e581010 100755
--- a/backends/apt/helpers/get-requires.py
+++ b/backends/apt/helpers/get-requires.py
@@ -16,5 +16,5 @@ package = sys.argv[1]
recursive = sys.argv[2]
backend = PackageKitAptBackend(sys.argv[1:])
-backend.get_requires(package, recursive == "True")
+backend.get_requires(package, recursive)
sys.exit(0)
commit 1fb89838dcc16a9492b4f785596d5c2246120133
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 20:43:13 2007 +0000
apt: Handle permissions failure on repo-enable
This shouldn't ever happen in practice, due to PackageKit running as
root, but it's nice to do the right thing anyways
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index ac86783..6934df9 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -433,7 +433,10 @@ class PackageKitAptBackend(PackageKitBaseBackend):
if not r["entry"].disabled == enable: # already there
return
r["entry"].set_enabled(enable)
- repo["__sources"].save()
+ try:
+ repo["__sources"].save()
+ except IOError,e:
+ self.error(ERROR_INTERNAL_ERROR, "Problem while trying to save repo settings to %s: %s"%(e.filename,e.strerror))
### Helpers ###
def _emit_package(self, package):
commit 76fe8a96a33bc9c9e0717eb9ecb6b87583b7807b
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 20:39:07 2007 +0000
apt: add repo enable
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 6521367..ac86783 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -239,13 +239,12 @@ class PackageKitAptBackend(PackageKitBaseBackend):
default = apt_pkg.Config.Find("APT::Default-Release")
if default=="":
d = get_distro()
- print d.id
if d.id == "Debian":
default = "stable"
elif d.id == "Ubuntu":
default = "main"
else:
- raise Exception
+ raise Exception,d.id
self._caches[default] = self._apt_cache
@@ -376,6 +375,8 @@ class PackageKitAptBackend(PackageKitBaseBackend):
repo = {}
sources = SourcesList()
+ repo["__sources"] = sources
+
root = apt_pkg.Config.FindDir("Dir::State::Lists")
#print root
for entry in sources:
@@ -415,8 +416,25 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
repo = self._build_repo_list()
for e in repo.keys():
+ if e == "__sources":
+ continue
self.repo_detail(repo[e]["entry"].line.strip(),e,not repo[e]["entry"].disabled)
+ def repo_enable(self, repoid, enable):
+ '''
+ Implement the {backend}-repo-enable functionality
+ '''
+ enable = (enable == "True")
+ repo = self._build_repo_list()
+ if not repo.has_key(repoid):
+ self.error(ERROR_REPO_NOT_FOUND,"Couldn't find repo '%s'"%repoid)
+ return
+ r = repo[repoid]
+ if not r["entry"].disabled == enable: # already there
+ return
+ r["entry"].set_enabled(enable)
+ repo["__sources"].save()
+
### Helpers ###
def _emit_package(self, package):
id = self.get_package_id(package.name,
diff --git a/backends/apt/helpers/repo-enable.py b/backends/apt/helpers/repo-enable.py
new file mode 100755
index 0000000..3cc36ae
--- /dev/null
+++ b/backends/apt/helpers/repo-enable.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#
+# Copyright (C) 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.
+
+import sys
+
+from aptBackend import PackageKitAptBackend
+repoid = sys.argv[1]
+state=sys.argv[2]
+backend = PackageKitAptBackend(sys.argv[2:])
+backend.repo_enable(repoid,state)
+backend.unLock()
+sys.exit(0)
commit 50edcac81adfad2a2e90ad4d292f6e1ca18abc46
Author: Tom Parker <palfrey at tevp.net>
Date: Wed Dec 19 20:25:55 2007 +0000
apt: Refactor repo list building into utility function
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 6853938..6521367 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -372,12 +372,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
pkgs = Set()
self._do_reqs(pkg,pkgs, recursive)
- def get_repo_list(self):
- '''
- Implement the {backend}-get-repo-list functionality
- '''
- self.allow_cancel(True)
- self.status(STATUS_INFO)
+ def _build_repo_list(self):
+ repo = {}
+
sources = SourcesList()
root = apt_pkg.Config.FindDir("Dir::State::Lists")
#print root
@@ -404,11 +401,21 @@ class PackageKitAptBackend(PackageKitBaseBackend):
suite = l.split(" ",1)[1].strip()
assert origin!="" and suite!=""
name = "%s/%s"%(origin,suite)
+ if entry.type == "deb-src":
+ name += "-src"
- #print entry
- #print name
- self.repo_detail(entry.line.strip(),name,not entry.disabled)
- #print
+ repo[name] = {"entry":entry}
+ return repo
+
+ def get_repo_list(self):
+ '''
+ Implement the {backend}-get-repo-list functionality
+ '''
+ self.allow_interrupt(True)
+ self.status(STATUS_INFO)
+ repo = self._build_repo_list()
+ for e in repo.keys():
+ self.repo_detail(repo[e]["entry"].line.strip(),e,not repo[e]["entry"].disabled)
### Helpers ###
def _emit_package(self, package):
commit d18419cfce21551a40ac77852d3aaf66b407a8e3
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 12 22:52:37 2008 +0000
more gtk-doc markup
diff --git a/libpackagekit/pk-debug.h b/libpackagekit/pk-debug.h
index 320c5c4..4846aaa 100644
--- a/libpackagekit/pk-debug.h
+++ b/libpackagekit/pk-debug.h
@@ -28,9 +28,27 @@
G_BEGIN_DECLS
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/**
+ * pk_debug:
+ *
+ * Non critical debugging
+ */
#define pk_debug(...) pk_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+/**
+ * pk_warning:
+ *
+ * Important debugging
+ */
#define pk_warning(...) pk_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+/**
+ * pk_error:
+ *
+ * Critical debugging, with exit
+ */
#define pk_error(...) pk_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
#elif defined(__GNUC__) && __GNUC__ >= 3
#define pk_debug(...) pk_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
#define pk_warning(...) pk_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 7c86a76..c78da34 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -417,6 +417,11 @@ pk_enum_find_string (PkEnumMatch *table, guint value)
/**
* pk_sig_type_enum_from_text:
+ * @sig_type: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
*/
PkSigTypeEnum
pk_sig_type_enum_from_text (const gchar *sig_type)
@@ -426,6 +431,11 @@ pk_sig_type_enum_from_text (const gchar *sig_type)
/**
* pk_sig_type_enum_to_text:
+ * @sig_type: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
@@ -435,6 +445,11 @@ pk_sig_type_enum_to_text (PkSigTypeEnum sig_type)
/**
* pk_info_enum_from_text:
+ * @info: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
*/
PkInfoEnum
pk_info_enum_from_text (const gchar *info)
@@ -444,6 +459,11 @@ pk_info_enum_from_text (const gchar *info)
/**
* pk_info_enum_to_text:
+ * @info: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_info_enum_to_text (PkInfoEnum info)
@@ -453,6 +473,11 @@ pk_info_enum_to_text (PkInfoEnum info)
/**
* pk_exit_enum_from_text:
+ * @exit: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
*/
PkExitEnum
pk_exit_enum_from_text (const gchar *exit)
@@ -462,6 +487,11 @@ pk_exit_enum_from_text (const gchar *exit)
/**
* pk_exit_enum_to_text:
+ * @exit: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_exit_enum_to_text (PkExitEnum exit)
@@ -471,6 +501,11 @@ pk_exit_enum_to_text (PkExitEnum exit)
/**
* pk_status_enum_from_text:
+ * @status: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkStatusEnum
pk_status_enum_from_text (const gchar *status)
@@ -480,6 +515,11 @@ pk_status_enum_from_text (const gchar *status)
/**
* pk_status_enum_to_text:
+ * @status: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_status_enum_to_text (PkStatusEnum status)
@@ -489,6 +529,11 @@ pk_status_enum_to_text (PkStatusEnum status)
/**
* pk_role_enum_from_text:
+ * @role: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkRoleEnum
pk_role_enum_from_text (const gchar *role)
@@ -498,6 +543,11 @@ pk_role_enum_from_text (const gchar *role)
/**
* pk_role_enum_to_text:
+ * @role: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_role_enum_to_text (PkRoleEnum role)
@@ -507,6 +557,11 @@ pk_role_enum_to_text (PkRoleEnum role)
/**
* pk_error_enum_from_text:
+ * @code: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkErrorCodeEnum
pk_error_enum_from_text (const gchar *code)
@@ -516,6 +571,11 @@ pk_error_enum_from_text (const gchar *code)
/**
* pk_error_enum_to_text:
+ * @code: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_error_enum_to_text (PkErrorCodeEnum code)
@@ -525,6 +585,11 @@ pk_error_enum_to_text (PkErrorCodeEnum code)
/**
* pk_restart_enum_from_text:
+ * @restart: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkRestartEnum
pk_restart_enum_from_text (const gchar *restart)
@@ -534,6 +599,11 @@ pk_restart_enum_from_text (const gchar *restart)
/**
* pk_restart_enum_to_text:
+ * @restart: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_restart_enum_to_text (PkRestartEnum restart)
@@ -543,6 +613,11 @@ pk_restart_enum_to_text (PkRestartEnum restart)
/**
* pk_message_enum_from_text:
+ * @message: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkMessageEnum
pk_message_enum_from_text (const gchar *message)
@@ -552,6 +627,11 @@ pk_message_enum_from_text (const gchar *message)
/**
* pk_message_enum_to_text:
+ * @message: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_message_enum_to_text (PkMessageEnum message)
@@ -561,6 +641,11 @@ pk_message_enum_to_text (PkMessageEnum message)
/**
* pk_group_enum_from_text:
+ * @group: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkGroupEnum
pk_group_enum_from_text (const gchar *group)
@@ -570,6 +655,11 @@ pk_group_enum_from_text (const gchar *group)
/**
* pk_group_enum_to_text:
+ * @group: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_group_enum_to_text (PkGroupEnum group)
@@ -579,6 +669,11 @@ pk_group_enum_to_text (PkGroupEnum group)
/**
* pk_freq_enum_from_text:
+ * @freq: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkFreqEnum
pk_freq_enum_from_text (const gchar *freq)
@@ -588,6 +683,11 @@ pk_freq_enum_from_text (const gchar *freq)
/**
* pk_freq_enum_to_text:
+ * @freq: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_freq_enum_to_text (PkFreqEnum freq)
@@ -597,6 +697,11 @@ pk_freq_enum_to_text (PkFreqEnum freq)
/**
* pk_update_enum_from_text:
+ * @update: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkUpdateEnum
pk_update_enum_from_text (const gchar *update)
@@ -606,6 +711,11 @@ pk_update_enum_from_text (const gchar *update)
/**
* pk_update_enum_to_text:
+ * @update: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_update_enum_to_text (PkUpdateEnum update)
@@ -615,6 +725,11 @@ pk_update_enum_to_text (PkUpdateEnum update)
/**
* pk_filter_enum_from_text:
+ * @filter: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkFilterEnum
pk_filter_enum_from_text (const gchar *filter)
@@ -624,6 +739,11 @@ pk_filter_enum_from_text (const gchar *filter)
/**
* pk_filter_enum_to_text:
+ * @filter: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_filter_enum_to_text (PkFilterEnum filter)
@@ -633,6 +753,11 @@ pk_filter_enum_to_text (PkFilterEnum filter)
/**
* pk_license_enum_from_text:
+ * @licence: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
**/
PkLicenseEnum
pk_license_enum_from_text (const gchar *license)
@@ -642,6 +767,11 @@ pk_license_enum_from_text (const gchar *license)
/**
* pk_license_enum_to_text:
+ * @license: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
**/
const gchar *
pk_license_enum_to_text (PkLicenseEnum license)
diff --git a/libpackagekit/pk-extra-obj.h b/libpackagekit/pk-extra-obj.h
index 0d9025c..0a5a43f 100644
--- a/libpackagekit/pk-extra-obj.h
+++ b/libpackagekit/pk-extra-obj.h
@@ -27,6 +27,11 @@
G_BEGIN_DECLS
+/**
+ * PkExtraObj:
+ *
+ * The cached structure for the extra fields from the metadata store
+ */
typedef struct {
PkPackageId *id;
gchar *icon;
diff --git a/libpackagekit/pk-package-list.h b/libpackagekit/pk-package-list.h
index 4d4da2c..731ccab 100644
--- a/libpackagekit/pk-package-list.h
+++ b/libpackagekit/pk-package-list.h
@@ -47,6 +47,11 @@ typedef struct
GObjectClass parent_class;
} PkPackageListClass;
+/**
+ * PkPackageItem:
+ *
+ * A cached store for the complete Package object
+ */
typedef struct
{
PkInfoEnum info;
commit 3f17d0059a64a6a5c0501213f8a1fd30bcb59a07
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 12 22:39:16 2008 +0000
some more gtk-doc markup
diff --git a/libpackagekit/pk-extra-obj.c b/libpackagekit/pk-extra-obj.c
index ef713bf..8333534 100644
--- a/libpackagekit/pk-extra-obj.c
+++ b/libpackagekit/pk-extra-obj.c
@@ -20,10 +20,10 @@
*/
/**
- * SECTION:pk-package-id
- * @short_description: Functionality to modify a PackageID
+ * SECTION:pk-extra-obj
+ * @short_description: Client object access to extra metadata about a package
*
- * ExtraObject's are difficult to read and create.
+ * Extra metadata such as icon name and localised summary may be stored here
*/
#include "config.h"
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index aeef0a2..4ce7317 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -19,6 +19,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+/**
+ * SECTION:pk-extra
+ * @short_description: Client singleton access to extra metadata about a package
+ *
+ * Extra metadata such as icon name and localised summary may be stored here
+ */
+
#include "config.h"
#include <stdlib.h>
diff --git a/libpackagekit/pk-extra.h b/libpackagekit/pk-extra.h
index 0dcf8a4..d244578 100644
--- a/libpackagekit/pk-extra.h
+++ b/libpackagekit/pk-extra.h
@@ -36,7 +36,11 @@ G_BEGIN_DECLS
#define PK_IS_EXTRA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_EXTRA))
#define PK_EXTRA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_EXTRA, PkExtraClass))
-/* convenience */
+/**
+ * PK_EXTRA_DEFAULT_DATABASE:
+ *
+ * The default location for the database, for client convenience
+ */
#define PK_EXTRA_DEFAULT_DATABASE "/var/lib/PackageKit/extra-data.db"
typedef struct PkExtraPrivate PkExtraPrivate;
diff --git a/libpackagekit/pk-package-id.h b/libpackagekit/pk-package-id.h
index 55750d6..33a687b 100644
--- a/libpackagekit/pk-package-id.h
+++ b/libpackagekit/pk-package-id.h
@@ -26,6 +26,11 @@
G_BEGIN_DECLS
+/**
+ * PkPackageId:
+ *
+ * Cached object to represent a package ID.
+ **/
typedef struct {
gchar *name;
gchar *version;
commit 6bcd9b20cfa1e51eaf06c43baddf2037da820533
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 12 22:30:32 2008 +0000
fix some warnings in gtk-doc
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index 0652c3c..de4cd5a 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -71,7 +71,7 @@ gchar *pk_strbuild_va (const gchar *first_element,
gboolean pk_strcmp_sections (const gchar *id1,
const gchar *id2,
guint parts,
- guint match);
+ guint compare);
gboolean pk_filter_check (const gchar *filter);
gchar *pk_iso8601_present (void);
guint pk_iso8601_difference (const gchar *isodate);
diff --git a/libpackagekit/pk-debug.c b/libpackagekit/pk-debug.c
index f9e8e62..36bd9cb 100644
--- a/libpackagekit/pk-debug.c
+++ b/libpackagekit/pk-debug.c
@@ -136,6 +136,7 @@ pk_error_real (const gchar *func, const gchar *file, const int line, const gchar
/**
* pk_debug_enabled:
+ *
* Return value: If we have debugging enabled
**/
gboolean
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index 3090cf7..aeef0a2 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -65,7 +65,7 @@ static gpointer pk_extra_object = NULL;
/**
* pk_extra_set_locale:
* @extra: a valid #PkExtra instance
- * @tid: a transaction id
+ * @locale: a correct locale
*
* Return value: %TRUE if set correctly
**/
@@ -356,7 +356,7 @@ pk_extra_set_package_detail (PkExtra *extra, const gchar *package, const gchar *
/**
* pk_extra_set_database:
* @extra: a valid #PkExtra instance
- * @tid: a transaction id
+ * @filename: a valid database
*
* Return value: %TRUE if set correctly
**/
diff --git a/libpackagekit/pk-package-id.h b/libpackagekit/pk-package-id.h
index 05a3217..55750d6 100644
--- a/libpackagekit/pk-package-id.h
+++ b/libpackagekit/pk-package-id.h
@@ -46,8 +46,8 @@ gchar *pk_package_id_build (const gchar *name,
gchar *pk_package_id_to_string (PkPackageId *ident);
gboolean pk_package_id_free (PkPackageId *ident);
gboolean pk_package_id_check (const gchar *package_id);
-gboolean pk_package_id_equal (const gchar *tid1,
- const gchar *tid2);
+gboolean pk_package_id_equal (const gchar *pid1,
+ const gchar *pid2);
G_END_DECLS
commit 3ae10207d1afc82cdb12272db03c361dac012f94
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 12 21:51:48 2008 +0000
enable gtk-doc in the DISTCHECK_CONFIGURE_FLAGS
diff --git a/Makefile.am b/Makefile.am
index 1ea49a9..2794ffc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -87,5 +87,5 @@ MAINTAINERCLEANFILES = \
aclocal.m4 \
$(NULL)
-DISTCHECK_CONFIGURE_FLAGS = --disable-tests --disable-gcov
+DISTCHECK_CONFIGURE_FLAGS = --disable-gcov --enable-gtk-doc
commit 4399e052ac62243fa7fe4363950a6b50fcd69627
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 12 21:27:51 2008 +0000
make the dbus backend asyncronous
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 774d792..c196166 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -72,25 +72,42 @@ struct PkBackendDbusPrivate
G_DEFINE_TYPE (PkBackendDbus, pk_backend_dbus, G_TYPE_OBJECT)
/**
- * pk_backend_dbus_lock:
+ * pk_backend_dbus_proxy_async_callback:
**/
-static gboolean
-pk_backend_dbus_lock (PkBackendDbus *backend_dbus)
+static void
+pk_backend_dbus_proxy_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
- gboolean ret;
GError *error = NULL;
+ PkBackendDbus *backend_dbus = user_data;
- g_return_val_if_fail (backend_dbus != NULL, FALSE);
+ /* we're done */
+ dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+ pk_debug ("dbus call finished %p", call);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Lock", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
+ /* did we fail? */
if (error != NULL) {
- pk_warning ("%s", error->message);
+ pk_warning ("message %s", error->message);
pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
pk_backend_finished (backend_dbus->priv->backend);
g_error_free (error);
}
- return ret;
+}
+
+/**
+ * pk_backend_dbus_lock:
+ **/
+static gboolean
+pk_backend_dbus_lock (PkBackendDbus *backend_dbus)
+{
+ DBusGProxyCall *call;
+
+ g_return_val_if_fail (backend_dbus != NULL, FALSE);
+
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Lock",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -99,20 +116,15 @@ pk_backend_dbus_lock (PkBackendDbus *backend_dbus)
static gboolean
pk_backend_dbus_unlock (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Unlock", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Unlock",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -295,8 +307,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
const gchar *interface, const gchar *path)
{
DBusGProxy *proxy;
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -388,15 +399,11 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
backend_dbus->priv->path = g_strdup (path);
/* manually init the backend, which should get things spawned for us */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Init", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Init",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
return TRUE;
}
@@ -407,20 +414,15 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
gboolean
pk_backend_dbus_kill (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Exit", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Exit",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -429,20 +431,15 @@ pk_backend_dbus_kill (PkBackendDbus *backend_dbus)
gboolean
pk_backend_dbus_cancel (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Cancel", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Cancel",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -451,20 +448,15 @@ pk_backend_dbus_cancel (PkBackendDbus *backend_dbus)
gboolean
pk_backend_dbus_get_updates (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetUpdates", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetUpdates",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -473,20 +465,15 @@ pk_backend_dbus_get_updates (PkBackendDbus *backend_dbus)
gboolean
pk_backend_dbus_get_repo_list (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetRepoList", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetRepoList",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ return TRUE;
}
/**
@@ -495,8 +482,7 @@ pk_backend_dbus_get_repo_list (PkBackendDbus *backend_dbus)
gboolean
pk_backend_dbus_refresh_cache (PkBackendDbus *backend_dbus, gboolean force)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -504,22 +490,18 @@ pk_backend_dbus_refresh_cache (PkBackendDbus *backend_dbus, gboolean force)
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "RefreshCache", &error,
- G_TYPE_BOOLEAN, force,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "RefreshCache",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_BOOLEAN, force,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -528,8 +510,7 @@ pk_backend_dbus_refresh_cache (PkBackendDbus *backend_dbus, gboolean force)
gboolean
pk_backend_dbus_update_system (PkBackendDbus *backend_dbus)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -537,21 +518,17 @@ pk_backend_dbus_update_system (PkBackendDbus *backend_dbus)
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "UpdateSystem", &error,
- G_TYPE_INVALID, G_TYPE_INVALID);
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "UpdateSystem",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -560,8 +537,7 @@ pk_backend_dbus_update_system (PkBackendDbus *backend_dbus)
gboolean
pk_backend_dbus_repo_enable (PkBackendDbus *backend_dbus, const gchar *rid, gboolean enabled)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -569,23 +545,19 @@ pk_backend_dbus_repo_enable (PkBackendDbus *backend_dbus, const gchar *rid, gboo
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Resolve", &error,
- G_TYPE_STRING, rid,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Resolve",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, rid,
G_TYPE_STRING, enabled,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -594,8 +566,7 @@ pk_backend_dbus_repo_enable (PkBackendDbus *backend_dbus, const gchar *rid, gboo
gboolean
pk_backend_dbus_repo_set_data (PkBackendDbus *backend_dbus, const gchar *rid, const gchar *parameter, const gchar *value)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -603,24 +574,20 @@ pk_backend_dbus_repo_set_data (PkBackendDbus *backend_dbus, const gchar *rid, co
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Resolve", &error,
- G_TYPE_STRING, rid,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Resolve",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, rid,
G_TYPE_STRING, parameter,
G_TYPE_STRING, value,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -629,8 +596,7 @@ pk_backend_dbus_repo_set_data (PkBackendDbus *backend_dbus, const gchar *rid, co
gboolean
pk_backend_dbus_resolve (PkBackendDbus *backend_dbus, const gchar *filter, const gchar *package)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -638,23 +604,19 @@ pk_backend_dbus_resolve (PkBackendDbus *backend_dbus, const gchar *filter, const
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Resolve", &error,
- G_TYPE_STRING, filter,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Resolve",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, filter,
G_TYPE_STRING, package,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -663,8 +625,7 @@ pk_backend_dbus_resolve (PkBackendDbus *backend_dbus, const gchar *filter, const
gboolean
pk_backend_dbus_rollback (PkBackendDbus *backend_dbus, const gchar *transaction_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -672,22 +633,18 @@ pk_backend_dbus_rollback (PkBackendDbus *backend_dbus, const gchar *transaction_
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "Rollback", &error,
- G_TYPE_STRING, transaction_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "Rollback",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, transaction_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -696,8 +653,7 @@ pk_backend_dbus_rollback (PkBackendDbus *backend_dbus, const gchar *transaction_
gboolean
pk_backend_dbus_search_name (PkBackendDbus *backend_dbus, const gchar *filter, const gchar *search)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -705,23 +661,19 @@ pk_backend_dbus_search_name (PkBackendDbus *backend_dbus, const gchar *filter, c
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "SearchName", &error,
- G_TYPE_STRING, filter,
- G_TYPE_STRING, search,
- G_TYPE_INVALID, G_TYPE_INVALID);
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "SearchName",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, filter,
+ G_TYPE_STRING, search,
+ G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -730,8 +682,7 @@ pk_backend_dbus_search_name (PkBackendDbus *backend_dbus, const gchar *filter, c
gboolean
pk_backend_dbus_search_details (PkBackendDbus *backend_dbus, const gchar *filter, const gchar *search)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -739,23 +690,19 @@ pk_backend_dbus_search_details (PkBackendDbus *backend_dbus, const gchar *filter
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "SearchDetails", &error,
- G_TYPE_STRING, filter,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "SearchDetails",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, filter,
G_TYPE_STRING, search,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -764,8 +711,7 @@ pk_backend_dbus_search_details (PkBackendDbus *backend_dbus, const gchar *filter
gboolean
pk_backend_dbus_search_group (PkBackendDbus *backend_dbus, const gchar *filter, const gchar *search)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -773,23 +719,19 @@ pk_backend_dbus_search_group (PkBackendDbus *backend_dbus, const gchar *filter,
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "SearchGroup", &error,
- G_TYPE_STRING, filter,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "SearchGroup",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, filter,
G_TYPE_STRING, search,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -798,8 +740,7 @@ pk_backend_dbus_search_group (PkBackendDbus *backend_dbus, const gchar *filter,
gboolean
pk_backend_dbus_search_file (PkBackendDbus *backend_dbus, const gchar *filter, const gchar *search)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -807,23 +748,19 @@ pk_backend_dbus_search_file (PkBackendDbus *backend_dbus, const gchar *filter, c
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "SearchFile", &error,
- G_TYPE_STRING, filter,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "SearchFile",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, filter,
G_TYPE_STRING, search,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -832,8 +769,7 @@ pk_backend_dbus_search_file (PkBackendDbus *backend_dbus, const gchar *filter, c
gboolean
pk_backend_dbus_get_depends (PkBackendDbus *backend_dbus, const gchar *package_id, gboolean recursive)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -841,23 +777,19 @@ pk_backend_dbus_get_depends (PkBackendDbus *backend_dbus, const gchar *package_i
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetDepends", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetDepends",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_BOOLEAN, recursive,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -866,8 +798,7 @@ pk_backend_dbus_get_depends (PkBackendDbus *backend_dbus, const gchar *package_i
gboolean
pk_backend_dbus_get_requires (PkBackendDbus *backend_dbus, const gchar *package_id, gboolean recursive)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -875,23 +806,19 @@ pk_backend_dbus_get_requires (PkBackendDbus *backend_dbus, const gchar *package_
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetRequires", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetRequires",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_BOOLEAN, recursive,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -900,8 +827,7 @@ pk_backend_dbus_get_requires (PkBackendDbus *backend_dbus, const gchar *package_
gboolean
pk_backend_dbus_get_update_detail (PkBackendDbus *backend_dbus, const gchar *package_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -909,22 +835,18 @@ pk_backend_dbus_get_update_detail (PkBackendDbus *backend_dbus, const gchar *pac
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetUpdateDetail", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetUpdateDetail",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -933,8 +855,7 @@ pk_backend_dbus_get_update_detail (PkBackendDbus *backend_dbus, const gchar *pac
gboolean
pk_backend_dbus_get_description (PkBackendDbus *backend_dbus, const gchar *package_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -942,22 +863,18 @@ pk_backend_dbus_get_description (PkBackendDbus *backend_dbus, const gchar *packa
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetDescription", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetDescription",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -966,8 +883,7 @@ pk_backend_dbus_get_description (PkBackendDbus *backend_dbus, const gchar *packa
gboolean
pk_backend_dbus_get_files (PkBackendDbus *backend_dbus, const gchar *package_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -975,22 +891,18 @@ pk_backend_dbus_get_files (PkBackendDbus *backend_dbus, const gchar *package_id)
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetFiles", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "GetFiles",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -999,8 +911,7 @@ pk_backend_dbus_get_files (PkBackendDbus *backend_dbus, const gchar *package_id)
gboolean
pk_backend_dbus_remove_package (PkBackendDbus *backend_dbus, const gchar *package_id, gboolean allow_deps)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -1008,23 +919,19 @@ pk_backend_dbus_remove_package (PkBackendDbus *backend_dbus, const gchar *packag
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "RemovePackage", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "RemovePackage",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_BOOLEAN, allow_deps,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -1033,8 +940,7 @@ pk_backend_dbus_remove_package (PkBackendDbus *backend_dbus, const gchar *packag
gboolean
pk_backend_dbus_install_package (PkBackendDbus *backend_dbus, const gchar *package_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -1042,22 +948,18 @@ pk_backend_dbus_install_package (PkBackendDbus *backend_dbus, const gchar *packa
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "InstallPackage", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "InstallPackage",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -1066,8 +968,7 @@ pk_backend_dbus_install_package (PkBackendDbus *backend_dbus, const gchar *packa
gboolean
pk_backend_dbus_update_package (PkBackendDbus *backend_dbus, const gchar *package_id)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -1075,22 +976,18 @@ pk_backend_dbus_update_package (PkBackendDbus *backend_dbus, const gchar *packag
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "UpdatePackage", &error,
- G_TYPE_STRING, package_id,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "UpdatePackage",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, package_id,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -1099,8 +996,7 @@ pk_backend_dbus_update_package (PkBackendDbus *backend_dbus, const gchar *packag
gboolean
pk_backend_dbus_install_file (PkBackendDbus *backend_dbus, const gchar *full_path)
{
- gboolean ret;
- GError *error = NULL;
+ DBusGProxyCall *call;
g_return_val_if_fail (backend_dbus != NULL, FALSE);
@@ -1108,22 +1004,18 @@ pk_backend_dbus_install_file (PkBackendDbus *backend_dbus, const gchar *full_pat
pk_backend_dbus_lock (backend_dbus);
/* do the action */
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "InstallFile", &error,
- G_TYPE_STRING, full_path,
+ call = dbus_g_proxy_begin_call (backend_dbus->priv->proxy, "InstallFile",
+ pk_backend_dbus_proxy_async_callback,
+ backend_dbus, NULL,
+ G_TYPE_STRING, full_path,
G_TYPE_INVALID, G_TYPE_INVALID);
/* unlock the backend if we failed */
- if (ret == FALSE) {
+ if (call == NULL) {
pk_backend_dbus_unlock (backend_dbus);
+ return FALSE;
}
-
- if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
- }
- return ret;
+ return TRUE;
}
/**
@@ -1175,10 +1067,7 @@ pk_backend_dbus_init (PkBackendDbus *backend_dbus)
/* get connection */
backend_dbus->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (error != NULL) {
- pk_warning ("%s", error->message);
- pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
- pk_backend_finished (backend_dbus->priv->backend);
- g_error_free (error);
+ pk_error ("unable to get system connection %s", error->message);
}
/* ProgressChanged */
More information about the PackageKit
mailing list