[PackageKit-commit] packagekit: Branch 'master' - 10 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Apr 11 18:25:37 PDT 2008
backends/yum/helpers/Makefile.am | 1 +
backends/yum/helpers/get-packages.py | 8 ++------
backends/yum/helpers/yumBackend.py | 32 +++++++++++---------------------
backends/yum/pk-backend-yum.c | 16 +++++++++++++++-
client/pk-console.c | 1 +
libpackagekit/pk-client.c | 7 -------
src/pk-interface-transaction.xml | 1 +
src/pk-restart-gio.c | 3 ---
src/pk-transaction.c | 3 ++-
9 files changed, 33 insertions(+), 39 deletions(-)
New commits:
commit 5818d5aada8f751365e03daabef20da46950cba0
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Apr 12 01:19:13 2008 +0100
another GetPackages fix
diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index 7f78291..68e51f4 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -14,6 +14,7 @@ dist_helper_DATA = \
get-updates.py \
get-description.py \
get-repo-list.py \
+ get-packages.py \
repo-enable.py \
repo-set-data.py \
get-update-detail.py \
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 4eb9c11..ad26be5 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -522,6 +522,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
@param key: key to seach for
'''
self.status(STATUS_QUERY)
+ self.allow_cancel(True)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 1 # Only look in cache.
try:
commit be911229d93c56465125c4a25ba6fb25e93d660a
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Apr 12 00:41:39 2008 +0100
some more fixes for GetPackages
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 03e6760..4eb9c11 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -521,6 +521,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
@param filters: package types to search (all,installed,available)
@param key: key to seach for
'''
+ self.status(STATUS_QUERY)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 1 # Only look in cache.
try:
diff --git a/client/pk-console.c b/client/pk-console.c
index fd8dfe0..6ba4017 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -145,6 +145,7 @@ pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
role == PK_ROLE_ENUM_SEARCH_GROUP ||
role == PK_ROLE_ENUM_SEARCH_FILE ||
role == PK_ROLE_ENUM_SEARCH_DETAILS ||
+ role == PK_ROLE_ENUM_GET_PACKAGES ||
role == PK_ROLE_ENUM_GET_DEPENDS ||
role == PK_ROLE_ENUM_GET_REQUIRES ||
role == PK_ROLE_ENUM_GET_UPDATES) {
diff --git a/src/pk-interface-transaction.xml b/src/pk-interface-transaction.xml
index 550dc18..5ec1cba 100644
--- a/src/pk-interface-transaction.xml
+++ b/src/pk-interface-transaction.xml
@@ -30,6 +30,7 @@
<arg type="s" name="package" direction="out"/>
</method>
<method name="GetPackages">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg type="s" name="filter" direction="in"/>
</method>
<method name="GetProgress">
commit 8b9e2ec3e8ca51fec4045e7ee24dd3e4ff7f142e
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Apr 12 00:38:08 2008 +0100
trivial: check for get_packages properly
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 4515556..3e6f1bd 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -320,6 +320,7 @@ pk_transaction_set_dbus_name (PkTransaction *transaction, const gchar *dbus_name
{
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
+ g_return_val_if_fail (dbus_name != NULL, FALSE);
if (transaction->priv->dbus_name != NULL) {
pk_warning ("you can't assign more than once!");
@@ -1284,7 +1285,7 @@ pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DB
pk_debug ("GetPackages method called: %s", filter);
/* not implemented yet */
- if (transaction->priv->backend->desc->search_name == NULL) {
+ if (transaction->priv->backend->desc->get_packages == NULL) {
pk_debug ("Not implemented yet: GetPackages");
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"Operation not yet supported by backend");
commit 32d91736d1b741c686d487be790680abd763b280
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Apr 12 00:05:01 2008 +0100
yum: fix GetPackages, and connect it up to the daemon
diff --git a/backends/yum/helpers/get-packages.py b/backends/yum/helpers/get-packages.py
index c04457f..b35d94f 100755
--- a/backends/yum/helpers/get-packages.py
+++ b/backends/yum/helpers/get-packages.py
@@ -12,13 +12,9 @@
import sys
-options = sys.argv[1]
-if len(sys.argv) > 2:
- show_desc = sys.argv[2]
-else:
- show_desc = 'no'
from yumBackend import PackageKitYumBackend
+filters = sys.argv[1]
backend = PackageKitYumBackend(sys.argv[1:],lock=False)
-backend.get_packages(options,show_desc)
+backend.get_packages(filters)
sys.exit(0)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 9f90d06..03e6760 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -514,7 +514,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self._refresh_yum_cache()
self.error(ERROR_NO_CACHE,"Package cache was invalid and has been rebuilt.")
- def get_packages(self,filters,showdesc='no'):
+ def get_packages(self,filters):
'''
Search for yum packages
@param searchlist: The yum package fields to search in
@@ -523,9 +523,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 1 # Only look in cache.
- showDesc = (showdesc == 'yes' or showdesc == 'only' )
- showPkg = (showdesc != 'only')
- print showDesc,showPkg
try:
fltlist = filters.split(';')
available = []
@@ -533,24 +530,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if FILTER_NOT_INSTALLED not in fltlist:
for pkg in self.yumbase.rpmdb:
if self._do_extra_filtering(pkg,fltlist):
- if showPkg:
- self._show_package(pkg, INFO_INSTALLED)
- if showDesc:
- self._show_description(pkg)
-
+ self._show_package(pkg, INFO_INSTALLED)
- # Now show available packages.
+ # Now show available packages.
if FILTER_INSTALLED not in fltlist:
for pkg in self.yumbase.pkgSack.returnNewestByNameArch():
if self._do_extra_filtering(pkg,fltlist):
- if showPkg:
- self._show_package(pkg, INFO_AVAILABLE)
- if showDesc:
- self._show_description(pkg)
+ self._show_package(pkg, INFO_AVAILABLE)
except yum.Errors.RepoError,e:
self._refresh_yum_cache()
self.error(ERROR_NO_CACHE,"Package cache was invalid and has been rebuilt.")
-
def search_file(self,filters,key):
'''
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 511485f..15923d2 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -187,6 +187,20 @@ backend_get_updates (PkBackend *backend, PkFilterEnum filters)
}
/**
+ * backend_get_packages:
+ */
+static void
+backend_get_packages (PkBackend *backend, PkFilterEnum filters)
+{
+ gchar *filters_text;
+ g_return_if_fail (backend != NULL);
+ g_return_if_fail (spawn != NULL);
+ filters_text = pk_filter_enums_to_text (filters);
+ pk_backend_spawn_helper (spawn, "get-packages.py", filters_text, NULL);
+ g_free (filters_text);
+}
+
+/**
* backend_get_update_detail:
*/
static void
@@ -444,7 +458,7 @@ PK_BACKEND_OPTIONS (
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
backend_get_files, /* get_files */
- NULL, /* get_packages */
+ backend_get_packages, /* get_packages */
backend_get_repo_list, /* get_repo_list */
backend_get_requires, /* get_requires */
backend_get_update_detail, /* get_update_detail */
commit de04b74d42f21f5584ae69eafa50060e7417e429
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Apr 11 23:56:14 2008 +0100
yum: use the filter in get-depends, else we tell the user we are going to download files that already exist
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 6b24524..9f90d06 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -773,6 +773,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.percentage(None)
self.status(STATUS_INFO)
+ fltlist = filters.split(';')
name = package.split(';')[0]
pkg,inst = self._findPackage(package)
results = {}
@@ -785,10 +786,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkgver = self._get_package_ver(pkg)
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repoid)
- if self._is_inst(pkg):
+ if self._is_inst(pkg) and FILTER_NOT_INSTALLED not in fltlist:
self.package(id, INFO_INSTALLED, pkg.summary)
else:
- if self._installable(pkg):
+ if self._installable(pkg) and FILTER_NOT_INSTALLED not in fltlist:
self.package(id, INFO_AVAILABLE, pkg.summary)
def update_system(self):
commit acf8a6b24900ae135f92a6e92a01fabfc3c9d97a
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Apr 11 23:20:54 2008 +0100
watch for all changes on the config file, to properly detect rpm upgrades
diff --git a/src/pk-restart-gio.c b/src/pk-restart-gio.c
index 404d670..d66e724 100644
--- a/src/pk-restart-gio.c
+++ b/src/pk-restart-gio.c
@@ -90,9 +90,6 @@ static void
pk_restart_monitor_changed (GFileMonitor *monitor, GFile *file, GFile *other_file,
GFileMonitorEvent event_type, PkRestart *restart)
{
- if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
- return;
- }
pk_debug ("emit: restart-schedule");
g_signal_emit (restart, signals [PK_RESTART_SCHEDULE], 0);
}
commit 5372f52c4d0b44718d4b54a993d8bfe80aa1bcd2
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Apr 11 23:10:18 2008 +0100
yum: fix a bug in the yum backend where we could not find available files when doing search-file
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 31bd44d..6b24524 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -577,7 +577,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.repos.populateSack(mdtype='filelists')
matches = self.yumbase.pkgSack.searchFiles(key)
for pkg in matches:
- if found.has_key(str(pkg)):
+ if not found.has_key(str(pkg)):
if self._do_extra_filtering(pkg, fltlist):
self._show_package(pkg, INFO_AVAILABLE)
found[str(pkg)] = 1
commit af591eed033cf47afa10a29c3dacb2ddab5a1a82
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Apr 11 21:36:52 2008 +0100
a filter of zero is allowed, don't abort if we have no filter
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 656c43a..7e1a366 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -982,7 +982,6 @@ pk_client_get_updates (PkClient *client, PkFilterEnum filters, GError **error)
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
@@ -1338,7 +1337,6 @@ pk_client_get_depends (PkClient *client, PkFilterEnum filters, const gchar *pack
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
g_return_val_if_fail (package_id != NULL, FALSE);
/* check the PackageID here to avoid a round trip if invalid */
@@ -1403,7 +1401,6 @@ pk_client_get_packages (PkClient *client, PkFilterEnum filters, GError **error)
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
@@ -1457,7 +1454,6 @@ pk_client_get_requires (PkClient *client, PkFilterEnum filters, const gchar *pac
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
g_return_val_if_fail (package_id != NULL, FALSE);
/* check the PackageID here to avoid a round trip if invalid */
@@ -1528,7 +1524,6 @@ pk_client_what_provides (PkClient *client, PkFilterEnum filters, PkProvidesEnum
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
g_return_val_if_fail (provides != PK_PROVIDES_ENUM_UNKNOWN, FALSE);
g_return_val_if_fail (search != NULL, FALSE);
@@ -1698,7 +1693,6 @@ pk_client_resolve (PkClient *client, PkFilterEnum filters, const gchar *package,
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
g_return_val_if_fail (package != NULL, FALSE);
/* get and set a new ID */
@@ -2503,7 +2497,6 @@ pk_client_get_repo_list (PkClient *client, PkFilterEnum filters, GError **error)
gchar *filter_text;
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filters != 0, FALSE);
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
commit 71045b3e7cb71bb53d6822e9f9cb9d6a17170c60
Author: Robin Norwood <rnorwood at redhat.com>
Date: Fri Apr 11 13:36:18 2008 -0400
Remove debugging output.
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index b0d434c..31bd44d 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -845,9 +845,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-resolve functionality
'''
- print >> sys.stderr, "start init"
self._check_init(lazy_cache=True)
- print >> sys.stderr, "end init"
self.allow_cancel(True);
self.percentage(None)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
commit 7f058f33a03c08682eda3e36e00604b69a6ae3e3
Author: Robin Norwood <rnorwood at redhat.com>
Date: Fri Apr 11 13:27:29 2008 -0400
update_system should set AllowCancel to True at first - it will be set to False later, once the transaction starts.
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index cbe07a2..b0d434c 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -796,7 +796,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-update-system functionality
'''
self._check_init(lazy_cache=True)
- self.allow_cancel(False)
+ self.allow_cancel(True)
self.percentage(0)
self.status(STATUS_RUNNING)
More information about the PackageKit-commit
mailing list