[PackageKit-commit] packagekit: Branch 'master' - 16 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Feb 15 07:55:26 PST 2011
RELEASE | 10 +-
backends/conary/conaryBackend.py | 29 +-----
backends/conary/pk-backend-conary.c | 3
backends/entropy/entropyBackend.py | 11 +-
backends/slapt/pk-backend-slapt.c | 160 ++++++++++++++++++------------------
backends/zif/pk-backend-zif.c | 45 +++++++++-
configure.ac | 10 ++
contrib/PackageKit.spec.in | 1
lib/packagekit-glib2/pk-common.c | 13 ++
src/pk-engine.c | 4
src/pk-transaction.c | 4
11 files changed, 174 insertions(+), 116 deletions(-)
New commits:
commit 017a4464524e29389893e13514bf78212903bd5b
Author: Jesse Zhang <zh.jesse at gmail.com>
Date: Thu Feb 10 20:26:27 2011 +0800
conary: not need to call _get_package_update before _do_package_update
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index c7545d9..2b7a2a7 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -598,9 +598,6 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'Package already installed')
"""
self.status(STATUS_INSTALL)
- log.info(">>> Prepare Update")
- self._get_package_update(name, version, flavor)
- log.info(">>> end Prepare Update")
self._do_package_update(name, version, flavor, simulate)
@@ -625,7 +622,6 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
name = '-%s' % name
#self.client.repos.findTrove(self.conary.default_label)
self.status(STATUS_REMOVE)
- self._get_package_update(name, version, flavor)
callback = self.client.getUpdateCallback()
if callback.error:
commit 73c5dc7634bdac721ac36fafd49a143643f3f831
Author: Jesse Zhang <zh.jesse at gmail.com>
Date: Thu Feb 10 15:03:39 2011 +0800
conary: make update-system faster
Avoid duplicate call to _get_update().
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 3727ecb..c7545d9 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -264,17 +264,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return updJob, suggMap
- def _do_update(self, applyList, simulate=False):
- updJob = None
- jobPath = self.xmlcache.checkCachedUpdateJob(applyList)
- if jobPath:
- updJob = self.client.newUpdateJob()
- try:
- updJob.thaw(jobPath)
- except IOError, err:
- updJob = None
- else:
- updJob,suggMap = self._get_update(applyList, cache=False)
+ def _do_update(self, updJob, applyList, simulate=False):
self.allow_cancel(False)
try:
# TODO we should really handle the restart case here
@@ -297,7 +287,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [(name, (version, flavor), (None, None), False)]
else:
applyList = [(name, (None, None), (version, flavor), True)]
- return self._do_update(applyList, simulate)
+ updJob, suggMap = self._get_update(applyList)
+ return self._do_update(updJob, applyList, simulate)
def _resolve_list(self, filters):
log.info("======= _resolve_list =====")
@@ -556,9 +547,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
log.info(">>>>>>>>>> get update >>>>>>>>>>>>")
- self._get_update(applyList)
+ updJob, suggMap = self._get_update(applyList)
log.info(">>>>>>>>>> DO Update >>>>>>>>>>>>")
- jobs = self._do_update(applyList)
+ jobs = self._do_update(updJob, applyList)
log.info(">>>>>>>>>>END DO Update >>>>>>>>>>>>")
log.info(jobs)
self.client.setUpdateCallback(self.callback )
commit 8411417f2844c7283589b5994deddeeeb9f1f1ed
Author: Jesse Zhang <zh.jesse at gmail.com>
Date: Thu Feb 10 14:55:29 2011 +0800
conary: fix get-updates
_get_update should return a tuple of UpdateJob and suggest map.
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 18f6df4..3727ecb 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -254,7 +254,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
if cache:
self.xmlcache.cacheUpdateJob(applyList, updJob)
except NoNewTrovesError:
- return updJob, None
+ return updJob, {}
except DepResolutionFailure as error :
log.info(error.getErrorMessage())
deps = error.cannotResolve
@@ -262,7 +262,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info(dep_package)
self.error(ERROR_DEP_RESOLUTION_FAILED, "This package depends of: %s" % ", ".join(set(dep_package)))
- return updJob
+ return updJob, suggMap
def _do_update(self, applyList, simulate=False):
updJob = None
@@ -838,7 +838,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info("_get_update ....")
self.status(STATUS_RUNNING)
- updJob = self._get_update(applyList)
+ updJob, suggMap = self._get_update(applyList)
log.info("_get_update ....end.")
log.info("getting JobLists...........")
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index d36163a..99154fd 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -93,6 +93,7 @@ backend_get_roles (PkBackend *backend)
PK_ROLE_ENUM_GET_DETAILS,
PK_ROLE_ENUM_GET_FILES,
PK_ROLE_ENUM_GET_PACKAGES,
+ PK_ROLE_ENUM_GET_UPDATES,
PK_ROLE_ENUM_INSTALL_PACKAGES,
PK_ROLE_ENUM_REFRESH_CACHE,
PK_ROLE_ENUM_REMOVE_PACKAGES,
@@ -473,7 +474,7 @@ PK_BACKEND_OPTIONS (
backend_get_repo_list, /* get_repo_list */
NULL, /* get_requires */
NULL,// backend_get_update_detail, /* get_update_detail */
- NULL,// backend_get_updates, /* get_updates */
+ backend_get_updates, /* get_updates */
NULL, /* install_files */
backend_install_packages, /* install_packages */
NULL, /* install_signature */
commit 938f54cb228a29588bc232747bf8f1c7294943ad
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 10 10:10:27 2011 +0000
zif: fix compile with libzif upstream as there was a small API change in zif_store_remote_set_enabled()
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index faf96ac..431b8fc 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1395,7 +1395,13 @@ pk_backend_enable_media_repo (gboolean enabled)
}
/* set the state */
- ret = zif_store_remote_set_enabled (repo, enabled, &error);
+ zif_state_reset (state);
+ ret = zif_store_remote_set_enabled (repo,
+ enabled,
+#if ZIF_CHECK_VERSION(0,1,6)
+ state,
+#endif
+ &error);
if (!ret) {
g_debug ("failed to set enable: %s", error->message);
g_error_free (error);
@@ -4450,6 +4456,7 @@ static gboolean
pk_backend_repo_enable_thread (PkBackend *backend)
{
ZifStoreRemote *repo = NULL;
+ ZifState *state_local;
gboolean ret;
GError *error = NULL;
gchar *warning = NULL;
@@ -4459,9 +4466,13 @@ pk_backend_repo_enable_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
+ /* set steps */
+ zif_state_set_number_steps (priv->state, 2);
+
/* find the right repo */
+ state_local = zif_state_get_child (priv->state);
repo = zif_repos_get_store (priv->repos,
- repo_id, priv->state,
+ repo_id, state_local,
&error);
if (repo == NULL) {
pk_backend_error_code (backend,
@@ -4472,8 +4483,25 @@ pk_backend_repo_enable_thread (PkBackend *backend)
goto out;
}
+ /* this section done */
+ ret = zif_state_done (priv->state, &error);
+ if (!ret) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_CANCELLED,
+ "cancelled: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* set the state */
- ret = zif_store_remote_set_enabled (repo, enabled, &error);
+ state_local = zif_state_get_child (priv->state);
+ ret = zif_store_remote_set_enabled (repo,
+ enabled,
+#if ZIF_CHECK_VERSION(0,1,6)
+ state_local,
+#endif
+ &error);
if (!ret) {
pk_backend_error_code (backend,
PK_ERROR_ENUM_CANNOT_DISABLE_REPOSITORY,
@@ -4483,6 +4511,17 @@ pk_backend_repo_enable_thread (PkBackend *backend)
goto out;
}
+ /* this section done */
+ ret = zif_state_done (priv->state, &error);
+ if (!ret) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_CANCELLED,
+ "cancelled: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* warn if rawhide */
if (g_strstr_len (repo_id, -1, "rawhide") != NULL) {
warning = g_strdup_printf ("These packages are untested and still under development."
commit ebf4043216afacc206a845614d7e97be31082ef1
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Wed Feb 9 17:46:55 2011 +0100
entropy: do not switch UrlFetcher using a Client property (forward compatibility)
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index 85e97c3..61d6e82 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -701,6 +701,8 @@ class PackageKitEntropyClient(Client):
_pk_progress = None
_pk_message = None
+ def init_singleton(self):
+ Client.init_singleton(self, url_fetcher = PkUrlFetcher)
def output(self, text, header = "", footer = "", back = False,
importance = 0, level = "info", count = None, percent = False):
@@ -806,7 +808,6 @@ class PackageKitEntropyBackend(PackageKitBaseBackend, PackageKitEntropyMixin):
self.doLock()
signal.signal(signal.SIGQUIT, self.__sigquit)
PkUrlFetcher._pk_progress = self.sub_percentage
- self._entropy.urlFetcher = PkUrlFetcher
self._repo_name_cache = {}
PackageKitEntropyClient._pk_progress = self.percentage
PackageKitEntropyClient._pk_message = self._generic_message
commit fbbbcaad86c17dfe5b5b403ccd88efd16b0876fc
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Mon Feb 7 13:48:20 2011 +0100
entropy: add forward compatibility with newer Entropy (exposing Client.PackageFileUpdates())
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index 59b148e..85e97c3 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -833,8 +833,12 @@ class PackageKitEntropyBackend(PackageKitBaseBackend, PackageKitEntropyMixin):
self._log_message(__name__, "_generic_message:", decolorize(message))
def _config_files_message(self):
- scandata = self._entropy.FileUpdates.scan(dcache = True,
- quiet = True)
+ if hasattr(self._entropy, "PackageFileUpdates"):
+ scandata = self._entropy.PackageFileUpdates().scan(dcache = True,
+ quiet = True)
+ else:
+ scandata = self._entropy.FileUpdates.scan(dcache = True,
+ quiet = True)
if scandata is None:
return
if len(scandata) > 0:
commit 39d88e39b43aa7839d2c7f3eb0792c3696d00f7d
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 15:09:44 2011 +0100
slapt: use hash for catgroup
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index c0e7ba9..1295f76 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -37,7 +37,7 @@ struct category_map {
PkGroupEnum group;
};
-static struct category_map CATGROUP[] = { /* TODO: load into hashmap */
+static struct category_map CATGROUP[] = {
/* Slackware */
{ "a", PK_GROUP_ENUM_SYSTEM /* The base Slackware system. */ },
{ "ap", PK_GROUP_ENUM_OTHER /* Linux applications. */ },
@@ -95,6 +95,7 @@ static struct category_map CATGROUP[] = { /* TODO: load into hashmap */
/* Sentinel */
{ NULL, PK_GROUP_ENUM_UNKNOWN }
};
+static GHashTable *_cathash = NULL;
static PkBackend *_backend = NULL;
@@ -126,10 +127,18 @@ double dltotal, double dlnow, double ultotal, double ulnow)
static void
backend_initialize (PkBackend *backend)
{
+ struct category_map *catgroup;
+
_config = slapt_read_rc_config(_config_file);
if (_config == NULL)
_config = slapt_init_config();
+ _cathash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+ for (catgroup = CATGROUP; catgroup->category != NULL; catgroup++) {
+ g_hash_table_insert(_cathash,
+ (gpointer) catgroup->category, (gpointer) catgroup->group);
+ }
+
_backend = backend;
if (_backend != NULL)
_config->progress_cb = &backend_progress_callback;
@@ -145,6 +154,7 @@ static void
backend_destroy (PkBackend *backend)
{
slapt_free_rc_config(_config);
+ g_hash_table_destroy(_cathash);
}
/**
@@ -290,18 +300,13 @@ static const char *_get_pkg_category(slapt_pkg_info_t *pkg)
/* return the PackageKit group matching the Slackware category */
static PkGroupEnum _get_pkg_group(const char *category)
{
- PkGroupEnum group;
- struct category_map *catgroup;
+ gpointer value;
- group = PK_GROUP_ENUM_UNKNOWN;
- for (catgroup = CATGROUP; catgroup->category != NULL; catgroup++) {
- if (strcmp(catgroup->category, category) == 0) {
- group = catgroup->group;
- break;
- }
- }
+ value = g_hash_table_lookup(_cathash, category);
+ if (value == NULL)
+ value = PK_GROUP_ENUM_UNKNOWN;
- return group;
+ return (PkGroupEnum) value;
}
/* return the first line of the pkg->description, without the prefix */
commit 1c57b3408533db37f9db9e0ed46cfbc67b4e1286
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 15:08:25 2011 +0100
trivial: refactor category to group
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index 74ffc69..c0e7ba9 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -287,6 +287,23 @@ static const char *_get_pkg_category(slapt_pkg_info_t *pkg)
return (const char *) p + 1;
}
+/* return the PackageKit group matching the Slackware category */
+static PkGroupEnum _get_pkg_group(const char *category)
+{
+ PkGroupEnum group;
+ struct category_map *catgroup;
+
+ group = PK_GROUP_ENUM_UNKNOWN;
+ for (catgroup = CATGROUP; catgroup->category != NULL; catgroup++) {
+ if (strcmp(catgroup->category, category) == 0) {
+ group = catgroup->group;
+ break;
+ }
+ }
+
+ return group;
+}
+
/* return the first line of the pkg->description, without the prefix */
static const gchar *_get_pkg_summary(slapt_pkg_info_t *pkg)
{
@@ -421,7 +438,6 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
slapt_pkg_list_t *available;
slapt_pkg_info_t *pkg;
const char *category;
- struct category_map *catgroup;
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
@@ -444,13 +460,7 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
category = _get_pkg_category(pkg);
- group = PK_GROUP_ENUM_UNKNOWN;
- for (catgroup = CATGROUP; catgroup->category != NULL; catgroup++) {
- if (strcmp(catgroup->category, category) == 0) {
- group = catgroup->group;
- break;
- }
- }
+ group = _get_pkg_group(category);
package_id = _get_string_from_pkg(pkg);
description = g_strstrip((gchar*) _get_pkg_description(pkg));
@@ -934,7 +944,6 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
PkGroupEnum group;
PkGroupEnum search_group;
const char *category;
- struct category_map *catgroup;
PkInfoEnum state;
const char *summary;
@@ -958,13 +967,7 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
pkg = pkglist->pkgs[i];
category = _get_pkg_category(pkg);
- group = PK_GROUP_ENUM_UNKNOWN;
- for (catgroup = CATGROUP; catgroup->category != NULL; catgroup++) {
- if (strcmp(catgroup->category, category) == 0) {
- group = catgroup->group;
- break;
- }
- }
+ group = _get_pkg_group(category);
if (group == search_group) {
commit a0c998ba18dd47314d671be1f1992c904cb58d55
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 15:05:42 2011 +0100
slapt: update to new slapt
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index 8052062..74ffc69 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -484,6 +484,8 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
slapt_pkg_list_t *installed;
slapt_pkg_list_t *available;
+ slapt_pkg_list_t *to_install;
+ slapt_pkg_list_t *to_remove;
slapt_pkg_list_t *requires;
@@ -492,6 +494,8 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
installed = slapt_get_installed_pkgs();
available = slapt_get_available_pkgs();
+ to_install = slapt_init_pkg_list();
+ to_remove = slapt_init_pkg_list();
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
@@ -509,7 +513,7 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
continue;
}
- requires = slapt_is_required_by(_config, available, pkg);
+ requires = slapt_is_required_by(_config, available, installed, to_install, to_remove, pkg);
for (i = 0; i < requires->pkg_count; i++) {
pkg = requires->pkgs[i];
@@ -527,6 +531,8 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
slapt_free_pkg_list(available);
slapt_free_pkg_list(installed);
+ slapt_free_pkg_list(to_install);
+ slapt_free_pkg_list(to_remove);
pk_backend_finished (backend);
}
commit cfb62db61b2f8f0681372c98bb54de69b53338cd
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 15:04:41 2011 +0100
slapt: update to new api
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index f758f0b..8052062 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -866,9 +866,10 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
* backend_search_details:
*/
static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
guint i;
+ gchar *search;
const gchar *package_id;
slapt_pkg_list_t *pkglist;
@@ -881,6 +882,8 @@ backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *sea
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
+ search = g_strjoinv ("&", values);
+
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
pkglist = slapt_get_installed_pkgs();
state = PK_INFO_ENUM_INSTALLED;
@@ -904,17 +907,20 @@ backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *sea
slapt_free_pkg_list(pkglist);
+ g_free (search);
+
pk_backend_set_percentage (backend, 100);
pk_backend_finished (backend);
}
/**
- * backend_search_group:
+ * backend_search_groups:
*/
static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
guint i;
+ gchar *search;
const gchar *package_id;
slapt_pkg_list_t *pkglist;
@@ -930,6 +936,8 @@ backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *searc
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
+ search = g_strjoinv ("&", values);
+
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
pkglist = slapt_get_installed_pkgs();
state = PK_INFO_ENUM_INSTALLED;
@@ -965,17 +973,20 @@ backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *searc
slapt_free_pkg_list(pkglist);
+ g_free (search);
+
pk_backend_set_percentage (backend, 100);
pk_backend_finished (backend);
}
/**
- * backend_search_name:
+ * backend_search_names:
*/
static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
unsigned int i;
+ gchar *search;
const gchar *package_id;
slapt_pkg_list_t *pkglist;
@@ -988,6 +999,8 @@ backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
+ search = g_strjoinv ("&", values);
+
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
pkglist = slapt_get_installed_pkgs();
state = PK_INFO_ENUM_INSTALLED;
@@ -1018,6 +1031,8 @@ backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search
out:
slapt_free_pkg_list(pkglist);
+ g_free (search);
+
pk_backend_set_percentage (backend, 100);
pk_backend_finished (backend);
}
@@ -1335,9 +1350,9 @@ PK_BACKEND_OPTIONS (
backend_resolve, /* resolve */
NULL, /* rollback */
backend_search_details, /* search_details */
- NULL, /* search_file */
- backend_search_group, /* search_group */
- backend_search_name, /* search_name */
+ NULL, /* search_files */
+ backend_search_groups, /* search_groups */
+ backend_search_names, /* search_names */
backend_update_packages, /* update_packages */
NULL, /* update_system */
NULL, /* what_provides */
commit 6ab611f87632218b78bb70303701b1a5649f77ff
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 15:03:07 2011 +0100
slapt: update to glib2 types
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index 2c9a130..f758f0b 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -223,22 +223,25 @@ backend_cancel (PkBackend *backend)
{
}
-static slapt_pkg_info_t* _get_pkg_from_id(PkPackageId *pi,
+static slapt_pkg_info_t* _get_pkg_from_id(gchar *pi,
slapt_pkg_list_t *avail_pkgs,
slapt_pkg_list_t *installed_pkgs)
{
+ gchar **pis;
slapt_pkg_info_t *pkg;
gchar **fields;
const gchar *version;
- fields = g_strsplit(pi->version, "-", 2);
- version = g_strdup_printf("%s-%s-%s", fields[0], pi->arch, fields[1]);
- pkg = slapt_get_exact_pkg(avail_pkgs, pi->name, version);
+ pis = pk_package_id_split(pi);
+ fields = g_strsplit(pis[PK_PACKAGE_ID_VERSION], "-", 2);
+ version = g_strdup_printf("%s-%s-%s", fields[0], pis[PK_PACKAGE_ID_ARCH], fields[1]);
+ pkg = slapt_get_exact_pkg(avail_pkgs, pis[PK_PACKAGE_ID_NAME], version);
if (pkg == NULL && installed_pkgs != NULL) {
- pkg = slapt_get_exact_pkg(installed_pkgs, pi->name, version);
+ pkg = slapt_get_exact_pkg(installed_pkgs, pis[PK_PACKAGE_ID_NAME], version);
}
g_free((gpointer) version);
g_strfreev(fields);
+ g_strfreev(pis);
return pkg;
}
@@ -247,20 +250,12 @@ static slapt_pkg_info_t* _get_pkg_from_string(const gchar *package_id,
slapt_pkg_list_t *avail_pkgs,
slapt_pkg_list_t *installed_pkgs)
{
- PkPackageId *pi;
- slapt_pkg_info_t *pkg;
-
- pi = pk_package_id_new_from_string (package_id);
- if (pi == NULL)
- return NULL;
- pkg = _get_pkg_from_id(pi, avail_pkgs, installed_pkgs);
- pk_package_id_free (pi);
- return pkg;
+ return _get_pkg_from_id((gchar *) package_id, avail_pkgs, installed_pkgs);
}
-static PkPackageId* _get_id_from_pkg(slapt_pkg_info_t *pkg)
+static gchar* _get_id_from_pkg(slapt_pkg_info_t *pkg)
{
- PkPackageId *pi;
+ gchar *pi;
gchar **fields;
const gchar *version;
const char *data;
@@ -268,7 +263,7 @@ static PkPackageId* _get_id_from_pkg(slapt_pkg_info_t *pkg)
fields = g_strsplit(pkg->version, "-", 3);
version = g_strdup_printf("%s-%s", fields[0], fields[2]);
data = pkg->installed ? "installed" : "available"; /* TODO: source */
- pi = pk_package_id_new_from_list(pkg->name, version, fields[1], data);
+ pi = pk_package_id_build(pkg->name, version, fields[1], data);
g_free((gpointer) version);
g_strfreev(fields);
@@ -277,15 +272,7 @@ static PkPackageId* _get_id_from_pkg(slapt_pkg_info_t *pkg)
static const gchar* _get_string_from_pkg(slapt_pkg_info_t *pkg)
{
- PkPackageId *pi;
- const gchar *package_id;
-
- pi = _get_id_from_pkg(pkg);
- if (pi == NULL)
- return NULL;
- package_id = pk_package_id_to_string(pi);
- pk_package_id_free(pi);
- return package_id;
+ return (const gchar *) _get_id_from_pkg(pkg);
}
/* return the last item of the pkg->location, after the slash */
@@ -349,7 +336,7 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
guint i;
guint len;
const gchar *package_id;
- PkPackageId *pi;
+ gchar *pi;
slapt_pkg_info_t *pkg;
int ret;
@@ -375,15 +362,13 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, available, installed);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
@@ -426,7 +411,7 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
guint i;
guint len;
const gchar *package_id;
- PkPackageId *pi;
+ gchar *pi;
const gchar *license = "";
const gchar *homepage = "";
const gchar *description;
@@ -446,15 +431,13 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, available, installed);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
@@ -469,12 +452,14 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
}
+ package_id = _get_string_from_pkg(pkg);
description = g_strstrip((gchar*) _get_pkg_description(pkg));
pk_backend_details (backend, package_id,
license, group, description, homepage, pkg->size_c * 1024);
g_free((gpointer) description);
+ g_free((gpointer) package_id);
}
slapt_free_pkg_list(available);
@@ -493,7 +478,7 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
guint i;
guint len;
const gchar *package_id;
- PkPackageId *pi;
+ gchar *pi;
slapt_pkg_info_t *pkg;
@@ -512,15 +497,13 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, available, installed);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
@@ -558,7 +541,7 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
guint len;
const gchar *package_id;
const gchar *old_package_id;
- PkPackageId *pi;
+ gchar *pi;
slapt_pkg_list_t *installed;
slapt_pkg_list_t *available;
@@ -578,15 +561,13 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, available, installed);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
@@ -690,8 +671,7 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
{
guint i;
guint len;
- const gchar *package_id;
- PkPackageId *pi;
+ gchar *pi;
int ret;
slapt_pkg_list_t *installed;
@@ -711,15 +691,13 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, available, installed);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
@@ -828,8 +806,7 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
{
guint i;
guint len;
- const gchar *package_id;
- PkPackageId *pi;
+ gchar *pi;
int ret;
slapt_pkg_list_t *installed;
@@ -849,15 +826,13 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = package_ids[i];
- pi = pk_package_id_new_from_string (package_id);
+ pi = 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;
}
pkg = _get_pkg_from_id(pi, installed, NULL);
- pk_package_id_free (pi);
if (pkg == NULL) {
pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
continue;
commit f6543f9e6d510919e5710b7fb24b01643e2b8cdc
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Sat Feb 5 14:50:44 2011 +0100
check for polkit_authority_get_sync symbol
diff --git a/configure.ac b/configure.ac
index ad86e3b..4744bf5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -574,6 +574,14 @@ if test x$with_security_framework = xpolkit; then
polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
else
AC_DEFINE(USE_SECURITY_POLKIT_NEW, 1, [if we should use the new PolicyKit API])
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $POLKIT_CFLAGS"
+ LIBS="$LIBS $POLKIT_LIBS"
+ # check for symbol, if using a pre-release polkit 0.97
+ AC_CHECK_FUNCS(polkit_authority_get_sync)
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
fi
AC_DEFINE(USE_SECURITY_POLKIT, 1, [if we should use PolicyKit])
elif test x$with_security_framework = xdummy; then
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 5e5abe9..6fa1848 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1396,7 +1396,7 @@ pk_engine_init (PkEngine *engine)
gchar *root;
gchar *proxy_http;
gchar *proxy_ftp;
-#ifdef USE_SECURITY_POLKIT_NEW
+#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
GError *error = NULL;
#endif
@@ -1489,7 +1489,7 @@ pk_engine_init (PkEngine *engine)
#ifdef USE_SECURITY_POLKIT
/* protect the session SetProxy with a PolicyKit action */
-#ifdef USE_SECURITY_POLKIT_NEW
+#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
engine->priv->authority = polkit_authority_get_sync (NULL, &error);
if (engine->priv->authority == NULL) {
g_error ("failed to get pokit authority: %s", error->message);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a77df9a..b0f790e 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -5754,7 +5754,7 @@ pk_transaction_class_init (PkTransactionClass *klass)
static void
pk_transaction_init (PkTransaction *transaction)
{
-#ifdef USE_SECURITY_POLKIT_NEW
+#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
GError *error = NULL;
#endif
transaction->priv = PK_TRANSACTION_GET_PRIVATE (transaction);
@@ -5807,7 +5807,7 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->dbus = pk_dbus_new ();
transaction->priv->results = pk_results_new ();
#ifdef USE_SECURITY_POLKIT
-#ifdef USE_SECURITY_POLKIT_NEW
+#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
transaction->priv->authority = polkit_authority_get_sync (NULL, &error);
if (transaction->priv->authority == NULL) {
g_error ("failed to get pokit authority: %s", error->message);
commit ec528e95f74dfb473b864680aed0ab6f1a65ea5d
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Wed Feb 2 19:33:43 2011 +0100
add missing python(gio) requirement
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 5b41009..ddf0820 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -63,6 +63,7 @@ cross-architecture API.
Summary: PackageKit YUM backend
Group: System Environment/Libraries
Requires: yum >= 3.2.19
+Requires: pygobject2 # python(gio)
Requires: %{name} = %{version}-%{release}
Provides: PackageKit-backend
commit ae71842f5c5d9a38575eb3319aff17c30c8f740f
Merge: 3a68e23... ebf0e3b...
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Wed Feb 2 11:23:49 2011 +0100
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit ebf0e3bb180d95889f49ab604bd9c6be18ec0832
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 1 11:24:25 2011 +0000
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index 82a0a88..bbc7006 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
1. Write NEWS entries for PackageKit in the same format as usual.
-git shortlog PACKAGEKIT_0_6_11.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog PACKAGEKIT_0_6_12.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.6.12
+Version 0.6.13
~~~~~~~~~~~~~~
Released: 2011-xx-xx
@@ -32,8 +32,8 @@ tx pull --all
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.6.12"
-git tag -s -f -m "Release 0.6.12" PACKAGEKIT_0_6_12
+git commit -a -m "Release version 0.6.13"
+git tag -s -f -m "Release 0.6.13" PACKAGEKIT_0_6_13
<gpg password>
git push --tags
git push
@@ -59,7 +59,7 @@ tx push --source
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-Subject: PackageKit 0.6.12 released!
+Subject: PackageKit 0.6.13 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/configure.ac b/configure.ac
index b5df3ce..ad86e3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.63)
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [6])
-m4_define([pk_micro_version], [12])
+m4_define([pk_micro_version], [13])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
commit 3a68e2302ec2554db13f7a06bf211dd831ba4f6d
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Thu Jan 27 17:47:00 2011 +0100
trivial: add missing slackware-version
diff --git a/lib/packagekit-glib2/pk-common.c b/lib/packagekit-glib2/pk-common.c
index a186889..5a27c33 100644
--- a/lib/packagekit-glib2/pk-common.c
+++ b/lib/packagekit-glib2/pk-common.c
@@ -332,6 +332,19 @@ pk_get_distro_id (void)
goto out;
}
+ /* check for Slackware */
+ ret = g_file_get_contents ("/etc/slackware-version", &contents, NULL, NULL);
+ if (ret) {
+ /* Slackware 13.0 */
+ split = g_strsplit (contents, " ", 0);
+ if (split == NULL)
+ goto out;
+
+ /* complete! */
+ distro_id = g_strdup_printf ("slackware;%s;%s", split[1], arch);
+ goto out;
+ }
+
#ifdef __FreeBSD__
ret = TRUE;
#endif
More information about the PackageKit-commit
mailing list