diff options
| author | I-Fan, Chen <tick@openmoko.com> | 2008-09-29 22:57:45 +0800 |
|---|---|---|
| committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2008-10-29 13:49:53 +0100 |
| commit | 21fb30fa23351a576ebf1246d9c2bd8bb1a95d26 (patch) | |
| tree | 2c7fd3188dbc9486b9304467746baebf6bcae8cc /packages | |
| parent | d60a3f961835c5a5896fdbda7be460c97f1aa89b (diff) | |
packagekit: modify summary field to support alias Tags.
Diffstat (limited to 'packages')
6 files changed, 71 insertions, 16524 deletions
diff --git a/packages/packagekit/files/01_d1e096c3267c1c9492041382b954e9327bc8bbec.patch b/packages/packagekit/files/01_d1e096c3267c1c9492041382b954e9327bc8bbec.patch deleted file mode 100644 index f050a50002..0000000000 --- a/packages/packagekit/files/01_d1e096c3267c1c9492041382b954e9327bc8bbec.patch +++ /dev/null @@ -1,2938 +0,0 @@ -diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c -index 3270e42..45e7a44 100644 ---- a/backends/alpm/pk-backend-alpm.c -+++ b/backends/alpm/pk-backend-alpm.c -@@ -895,7 +895,7 @@ backend_get_repo_list (PkBackend *backend, PkFilterEnum filters) - static gboolean - backend_install_files_thread (PkBackend *backend) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - gchar **full_paths = pk_backend_get_strv (backend, "full_paths"); - -@@ -1050,7 +1050,7 @@ backend_install_packages (PkBackend *backend, gchar **package_ids) - static gboolean - backend_refresh_cache_thread (PkBackend *backend) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - if (alpm_trans_init (PM_TRANS_TYPE_SYNC, PM_TRANS_FLAG_NOSCRIPTLET, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) { - pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno)); -diff --git a/backends/apt/pk-apt-build-db.cpp b/backends/apt/pk-apt-build-db.cpp -index d47c348..885275d 100644 ---- a/backends/apt/pk-apt-build-db.cpp -+++ b/backends/apt/pk-apt-build-db.cpp -@@ -40,7 +40,7 @@ void apt_build_db(PkBackend * backend, sqlite3 *db) - sqlite3_stmt *package = NULL; - - pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates(backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - sdir = g_build_filename(_config->Find("Dir").c_str(),_config->Find("Dir::State").c_str(),_config->Find("Dir::State::lists").c_str(), NULL); - dir = g_dir_open(sdir,0,&error); -diff --git a/backends/apt/pk-sqlite-pkg-cache.cpp b/backends/apt/pk-sqlite-pkg-cache.cpp -index 770fcdf..1bf9a50 100644 ---- a/backends/apt/pk-sqlite-pkg-cache.cpp -+++ b/backends/apt/pk-sqlite-pkg-cache.cpp -@@ -81,7 +81,7 @@ sqlite_search_packages_thread (PkBackend *backend) - const gchar *search; - - pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates(backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - type = pk_backend_get_uint (backend, "type"); - search = pk_backend_get_string (backend, "search"); - -@@ -176,7 +176,7 @@ sqlite_get_details_thread (PkBackend *backend) - } - - pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates(backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - pk_debug("finding %s", pi->name); - -diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c -index b7b8167..9263781 100644 ---- a/backends/box/pk-backend-box.c -+++ b/backends/box/pk-backend-box.c -@@ -138,7 +138,7 @@ backend_find_packages_thread (PkBackend *backend) - filter_box = filter_box | PKG_SEARCH_DETAILS; - } - -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - db = db_open(); - -diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c -index 49d4e5a..2df445e 100644 ---- a/backends/dummy/pk-backend-dummy.c -+++ b/backends/dummy/pk-backend-dummy.c -@@ -254,7 +254,7 @@ static void - backend_get_updates (PkBackend *backend, PkFilterEnum filters) - { - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - /* check network state */ - if (!pk_backend_is_online (backend)) { - pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot check when offline"); -@@ -268,6 +268,8 @@ static gboolean - backend_install_timeout (gpointer data) - { - PkBackend *backend = (PkBackend *) data; -+ guint sub_percent; -+ - if (_progress_percentage == 100) { - pk_backend_finished (backend); - return FALSE; -@@ -283,9 +285,18 @@ backend_install_timeout (gpointer data) - pk_backend_package (backend, PK_INFO_ENUM_INSTALLING, - "gtkhtml2-devel;2.19.1-0.fc8;i386;fedora", - "Devel files for gtkhtml"); -+ /* this duplicate package should be ignored */ -+ pk_backend_package (backend, PK_INFO_ENUM_INSTALLING, -+ "gtkhtml2-devel;2.19.1-0.fc8;i386;fedora", NULL); - pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL); - } -- _progress_percentage += 10; -+ if (_progress_percentage > 30 && _progress_percentage < 50) { -+ sub_percent = ((gfloat) (_progress_percentage - 30.0f) / 20.0f) * 100.0f; -+ pk_backend_set_sub_percentage (backend, sub_percent); -+ } else { -+ pk_backend_set_sub_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); -+ } -+ _progress_percentage += 1; - pk_backend_set_percentage (backend, _progress_percentage); - return TRUE; - } -@@ -348,7 +359,7 @@ backend_install_packages (PkBackend *backend, gchar **package_ids) - pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING, - "gtkhtml2;2.19.1-4.fc8;i386;fedora", - "An HTML widget for GTK+ 2.0"); -- _signal_timeout = g_timeout_add (1000, backend_install_timeout, backend); -+ _signal_timeout = g_timeout_add (100, backend_install_timeout, backend); - } - - /** -@@ -526,7 +537,7 @@ backend_search_name_timeout (gpointer data) - static void - backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *search) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - pk_backend_set_allow_cancel (backend, TRUE); - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); - _signal_timeout = g_timeout_add (2000, backend_search_name_timeout, backend); -diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c -index ecc97be..7649bab 100644 ---- a/backends/opkg/pk-backend-opkg.c -+++ b/backends/opkg/pk-backend-opkg.c -@@ -155,6 +155,38 @@ pk_opkg_progress_cb (opkg_t *opkg, const opkg_progress_data_t *pdata, void *data - return; - - pk_backend_set_percentage (backend, pdata->percentage); -+ if (pdata->package) -+ { -+ gchar *uid; -+ opkg_package_t *pkg = pdata->package; -+ gint status = PK_INFO_ENUM_UNKNOWN; -+ -+ uid = g_strdup_printf ("%s;%s;%s;", -+ pkg->name, pkg->version, pkg->architecture); -+ -+ if (pdata->action == OPKG_DOWNLOAD) -+ status = PK_INFO_ENUM_DOWNLOADING; -+ else if (pdata->action == OPKG_INSTALL) -+ status = PK_INFO_ENUM_INSTALLING; -+ else if (pdata->action == OPKG_REMOVE) -+ status = PK_INFO_ENUM_REMOVING; -+ -+ pk_backend_package (backend, status, uid, pkg->description); -+ g_free (uid); -+ } -+ -+ switch (pdata->action) -+ { -+ case OPKG_DOWNLOAD: -+ pk_backend_set_status (backend, PK_STATUS_ENUM_DOWNLOAD); -+ break; -+ case OPKG_INSTALL: -+ pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL); -+ break; -+ case OPKG_REMOVE: -+ pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE); -+ break; -+ } - } - - static gboolean -@@ -163,8 +195,12 @@ backend_refresh_cache_thread (PkBackend *backend) - int ret; - - ret = opkg_update_package_lists (opkg, pk_opkg_progress_cb, backend); -+ - if (ret) { -- opkg_unknown_error (backend, ret, "Refreshing cache"); -+ if (ret == OPKG_DOWNLOAD_FAILED) -+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_AVAILABLE, NULL); -+ else -+ opkg_unknown_error (backend, ret, "Refreshing cache"); - } - pk_backend_finished (backend); - -@@ -178,7 +214,7 @@ static void - backend_refresh_cache (PkBackend *backend, gboolean force) - { - pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - - pk_backend_thread_create (backend, backend_refresh_cache_thread); -@@ -279,7 +315,7 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear - - - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - params = g_new0 (SearchParams, 1); - params->filters = filters; -@@ -301,7 +337,7 @@ backend_search_description (PkBackend *backend, PkFilterEnum filters, const gcha - - - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - params = g_new0 (SearchParams, 1); - params->filters = filters; -@@ -320,7 +356,7 @@ backend_search_group (PkBackend *backend, PkFilterEnum filters, const gchar *sea - - - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - params = g_new0 (SearchParams, 1); - params->filters = filters; -@@ -337,30 +373,52 @@ static gboolean - backend_install_packages_thread (PkBackend *backend) - { - PkPackageId *pi; -- gint err; -- const gchar *package_id; -+ gint err, i; -+ gchar **package_ids; - -- package_id = pk_backend_get_string (backend, "pkid"); -- pk_backend_package (backend, PK_INFO_ENUM_INSTALLING, package_id, NULL); -+ package_ids = pk_backend_get_strv (backend, "pkids"); - -- pi = pk_package_id_new_from_string (package_id); -+ err = 0; -+ -+ for (i = 0; package_ids[i]; i++) -+ { -+ pk_backend_package (backend, PK_INFO_ENUM_INSTALLING, package_ids[0], NULL); - -- err = opkg_install_package (opkg, pi->name, pk_opkg_progress_cb, backend); -- if (err != 0) -- opkg_unknown_error (backend, err, "Install"); -+ pi = pk_package_id_new_from_string (package_ids[0]); -+ -+ err = opkg_install_package (opkg, pi->name, pk_opkg_progress_cb, backend); -+ switch (err) -+ { -+ case OPKG_NO_ERROR: -+ break; -+ case OPKG_DEPENDANCIES_FAILED: -+ pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, NULL); -+ break; -+ case OPKG_PACKAGE_ALREADY_INSTALLED: -+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED, NULL); -+ break; -+ case OPKG_PACKAGE_NOT_AVAILABLE: -+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, NULL); -+ break; -+ default: -+ opkg_unknown_error (backend, err, "Install"); -+ } -+ pk_package_id_free (pi); -+ if (err != 0) -+ break; -+ } - -- pk_package_id_free (pi); - pk_backend_finished (backend); - return (err == 0); - } - - static void --backend_install_packages (PkBackend *backend, gchar **package_id) -+backend_install_packages (PkBackend *backend, gchar **package_ids) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL); - -- pk_backend_set_string (backend, "pkid", package_id[0]); -+ pk_backend_set_strv (backend, "pkids", package_ids); - - pk_backend_thread_create (backend, backend_install_packages_thread); - } -@@ -369,7 +427,7 @@ static gboolean - backend_remove_packages_thread (PkBackend *backend) - { - PkPackageId *pi; -- gint err; -+ gint err, i; - gchar **package_ids; - gboolean allow_deps; - gboolean autoremove; -@@ -382,19 +440,34 @@ backend_remove_packages_thread (PkBackend *backend) - autoremove = GPOINTER_TO_INT (data[2]); - g_free (data); - -- pi = pk_package_id_new_from_string (package_ids[0]); -- pk_backend_package (backend, PK_INFO_ENUM_REMOVING, package_ids[0], NULL); -- - opkg_set_option (opkg, "autoremove", &autoremove); - opkg_set_option (opkg, "force_removal_of_dependent_packages", &allow_deps); - -- err = opkg_remove_package (opkg, pi->name, pk_opkg_progress_cb, backend); -+ err = 0; - -- /* TODO: improve error reporting */ -- if (err != 0) -- opkg_unknown_error (backend, err, "Remove"); -+ for (i = 0; package_ids[i]; i++) -+ { -+ pi = pk_package_id_new_from_string (package_ids[0]); -+ pk_backend_package (backend, PK_INFO_ENUM_REMOVING, package_ids[0], NULL); -+ -+ err = opkg_remove_package (opkg, pi->name, pk_opkg_progress_cb, backend); -+ -+ switch (err) -+ { -+ case OPKG_NO_ERROR: -+ break; -+ case OPKG_PACKAGE_NOT_INSTALLED: -+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, NULL); -+ break; -+ default: -+ opkg_unknown_error (backend, err, "Remove"); -+ } -+ pk_package_id_free (pi); -+ -+ if (err != 0) -+ break; -+ } - -- pk_package_id_free (pi); - pk_backend_finished (backend); - return (err == 0); - } -@@ -405,7 +478,7 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow - gpointer *params; - - pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - /* params is a small array we can pack our thread parameters into */ - params = g_new0 (gpointer, 2); -@@ -450,7 +523,7 @@ static void - backend_update_system (PkBackend *backend) - { - pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - pk_backend_thread_create (backend, backend_update_system_thread); - } -@@ -478,8 +551,14 @@ backend_update_package_thread (PkBackend *backend) - } - - err = opkg_upgrade_package (opkg, pi->name, pk_opkg_progress_cb, backend); -- -- if (err != 0) { -+ switch (err) -+ { -+ case OPKG_NO_ERROR: -+ break; -+ case OPKG_PACKAGE_NOT_INSTALLED: -+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, NULL); -+ break; -+ default: - opkg_unknown_error (backend, err, "Update package"); - } - -@@ -494,7 +573,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids) - gint i; - - pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - for (i = 0; package_ids[i]; i++) { - pk_backend_set_string (backend, "pkgid", package_ids[i]); -@@ -536,7 +615,7 @@ static void - backend_get_updates (PkBackend *backend, PkFilterEnum filters) - { - pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - pk_backend_thread_create (backend, backend_get_updates_thread); - } -@@ -572,19 +651,26 @@ backend_get_details_thread (PkBackend *backend) - if (pi == NULL) - { - pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id"); -- pk_package_id_free (pi); -+ pk_backend_finished (backend); - return FALSE; - } - - - pkg = opkg_find_package (opkg, pi->name, pi->version, pi->arch, pi->data); -+ pk_package_id_free (pi); -+ -+ if (!pkg) -+ { -+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, NULL); -+ pk_backend_finished (backend); -+ return FALSE; -+ } - - newid = g_strdup_printf ("%s;%s;%s;%s", pkg->name, pkg->version, pkg->architecture, pkg->repository); - - pk_backend_details (backend, newid, NULL, 0, pkg->description, pkg->url, pkg->size); - - g_free (newid); -- pk_package_id_free (pi); - pk_backend_finished (backend); - return TRUE; - } -@@ -592,7 +678,7 @@ backend_get_details_thread (PkBackend *backend) - static void - backend_get_details (PkBackend *backend, const gchar *package_id) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - pk_backend_thread_create (backend, backend_get_details_thread); - } - -diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c -index 5dfea32..76686dc 100644 ---- a/backends/test/pk-backend-test-dbus.c -+++ b/backends/test/pk-backend-test-dbus.c -@@ -36,7 +36,7 @@ static void - backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *search) - { - pk_backend_set_allow_cancel (backend, TRUE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - pk_backend_dbus_search_name (dbus, filters, search); - } - -diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c -index 2958c05..584f44c 100644 ---- a/backends/test/pk-backend-test-spawn.c -+++ b/backends/test/pk-backend-test-spawn.c -@@ -35,7 +35,7 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear - { - gchar *filters_text; - pk_backend_set_allow_cancel (backend, TRUE); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - filters_text = pk_filter_enums_to_text (filters); - pk_backend_spawn_helper (spawn, "search-name.sh", filters_text, search, NULL); - g_free (filters_text); -diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c -index 17cdc6e..c046c1d 100644 ---- a/backends/test/pk-backend-test-succeed.c -+++ b/backends/test/pk-backend-test-succeed.c -@@ -236,7 +236,7 @@ backend_search_name_timeout (gpointer data) - static void - backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *search) - { -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - g_timeout_add (200000, backend_search_name_timeout, backend); - } - -diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py -index f76e27c..5b2da8f 100644 ---- a/backends/yum/helpers/yumBackend.py -+++ b/backends/yum/helpers/yumBackend.py -@@ -801,6 +801,8 @@ class PackageKitYumBackend(PackageKitBaseBackend): - old_throttle = self.yumbase.conf.throttle - self.yumbase.conf.throttle = "60%" # Set bandwidth throttle to 60% - # to avoid taking all the system's bandwidth. -+ old_skip_broken = self.yumbase.conf.skip_broken -+ self.yumbase.conf.skip_broken = 1 - - try: - txmbr = self.yumbase.update() # Add all updates to Transaction -@@ -812,6 +814,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - self.error(ERROR_NO_PACKAGES_TO_UPDATE,"Nothing to do") - - self.yumbase.conf.throttle = old_throttle -+ self.yumbase.conf.skip_broken = old_skip_broken - - def refresh_cache(self): - ''' -@@ -905,7 +908,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - if txmbrs: - self._runYumTransaction() - else: -- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"This package could not be installed as it is already installed") -+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"The package is already installed") - - def _checkForNewer(self,po): - pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name) -@@ -1003,7 +1006,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - return False - - if self._is_inst(po): -- self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "%s is already installed" % str(po)) -+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "The package %s is already installed" % str(po)) - return False - - if len(self.yumbase.conf.exclude) > 0: -diff --git a/backends/yum2/helpers/testyum2.py b/backends/yum2/helpers/testyum2.py -index cdec507..85b47f9 100755 ---- a/backends/yum2/helpers/testyum2.py -+++ b/backends/yum2/helpers/testyum2.py -@@ -80,7 +80,7 @@ try: - #iface.GetPackages(FILTER_INSTALLED,'no') - if cmd == 'get-repolist' or cmd == 'all': - print "Testing GetRepoList()" -- iface.GetRepoList() -+ iface.GetRepoList("") - if cmd == 'get-updatedetail' or cmd == 'all': - print "Testing GetUpdateDetail(PKG_ID)" - iface.GetUpdateDetail(PKG_ID) -diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py -index 9cfed94..29f5b03 100755 ---- a/backends/yum2/helpers/yumDBUSBackend.py -+++ b/backends/yum2/helpers/yumDBUSBackend.py -@@ -434,7 +434,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - try: - pkgGroupDict = self._buildGroupDict() - fltlist = filters.split(';') -- found = {} -+ installed_nevra = [] # yum returns packages as available even when installed - - if not FILTER_NOT_INSTALLED in fltlist: - # Check installed for group -@@ -450,21 +450,31 @@ class PackageKitYumBackend(PackageKitBaseBackend): - group = groupMap[cg] # use the pk group name, instead of yum 'category/group' - if group == key: - if self._do_extra_filtering(pkg, fltlist): -- self._show_package(pkg, INFO_INSTALLED) -+ package_list.append((pkg,INFO_INSTALLED)) -+ installed_nevra.append(self._get_nevra(pkg)) -+ - if not FILTER_INSTALLED in fltlist: - # Check available for group - for pkg in self.yumbase.pkgSack: - if self._cancel_check("Search cancelled."): - # _cancel_check() sets the error message, unlocks yum, and calls Finished() - return -- group = GROUP_OTHER -- if pkgGroupDict.has_key(pkg.name): -- cg = pkgGroupDict[pkg.name] -- if groupMap.has_key(cg): -- group = groupMap[cg] -- if group == key: -- if self._do_extra_filtering(pkg, fltlist): -- self._show_package(pkg, INFO_AVAILABLE) -+ -+ nevra = self._get_nevra(pkg) -+ if nevra not in installed_nevra: -+ group = GROUP_OTHER -+ if pkgGroupDict.has_key(pkg.name): -+ cg = pkgGroupDict[pkg.name] -+ if groupMap.has_key(cg): -+ group = groupMap[cg] -+ if group == key: -+ if self._do_extra_filtering(pkg, fltlist): -+ package_list.append((pkg,INFO_AVAILABLE)) -+ -+ except yum.Errors.GroupsError,e: -+ self._unlock_yum() -+ self.ErrorCode(ERROR_GROUP_NOT_FOUND, str(e)) -+ self.Finished(EXIT_FAILED) - except yum.Errors.RepoError,e: - self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.") - self._refresh_yum_cache() -@@ -473,6 +483,14 @@ class PackageKitYumBackend(PackageKitBaseBackend): - - return - -+ # basename filter if specified -+ if FILTER_BASENAME in fltlist: -+ for (pkg,status) in self._basename_filter(package_list): -+ self._show_package(pkg,status) -+ else: -+ for (pkg,status) in package_list: -+ self._show_package(pkg,status) -+ - self._unlock_yum() - self.Finished(EXIT_SUCCESS) - -@@ -724,6 +742,11 @@ class PackageKitYumBackend(PackageKitBaseBackend): - #we might have a rounding error - self.PercentageChanged(100) - -+ except yum.Errors.RepoError,e: -+ self._unlock_yum() -+ self.ErrorCode(ERROR_REPO_CONFIGURATION_ERROR,str(e)) -+ self.Finished(EXIT_FAILED) -+ self.Exit() - except yum.Errors.YumBaseError, e: - self._unlock_yum() - # This should be a better-defined error, but I'm not sure -@@ -837,6 +860,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - Needed to be implemented in a sub class - ''' - if inst_file.endswith('.src.rpm'): -+ self._unlock_yum() - self.ErrorCode(ERROR_CANNOT_INSTALL_SOURCE_PACKAGE,'Backend will not install a src rpm file') - self.Finished(EXIT_FAILED) - return -@@ -1385,30 +1409,30 @@ class PackageKitYumBackend(PackageKitBaseBackend): - res = self.yumbase.searchGenerator(searchlist, [key]) - fltlist = filters.split(';') - -- available = [] -- count = 1 -+ seen_nevra = [] # yum returns packages as available even when installed -+ pkg_list = [] # only do the second iteration on not installed pkgs -+ package_list = [] #we can't do emitting as found if we are post-processing -+ - for (pkg,values) in res: - if self._cancel_check("Search cancelled."): - return False - # are we installed? - if pkg.repo.id == 'installed': -- if FILTER_NOT_INSTALLED not in fltlist: -- if self._do_extra_filtering(pkg,fltlist): -- count+=1 -- if count > 100: -- break -- self._show_package(pkg, INFO_INSTALLED) -+ if self._do_extra_filtering(pkg,fltlist): -+ package_list.append((pkg,INFO_INSTALLED)) -+ seen_nevra.append(self._get_nevra(pkg)) - else: -- available.append(pkg) -+ pkg_list.append(pkg) - -- # Now show available packages. -- if FILTER_INSTALLED not in fltlist: -- for pkg in available: -- if self._cancel_check("Search cancelled."): -- return False -- if self._do_extra_filtering(pkg,fltlist): -- self._show_package(pkg, INFO_AVAILABLE) -+ for pkg in pkg_list: -+ if self._cancel_check("Search cancelled."): -+ return False - -+ nevra = self._get_nevra(pkg) -+ if nevra not in seen_nevra: -+ if self._do_extra_filtering(pkg,fltlist): -+ package_list.append((pkg,INFO_AVAILABLE)) -+ seen_nevra.append(self._get_nevra(pkg)) - except yum.Errors.RepoError,e: - self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.") - self._refresh_yum_cache() -@@ -1417,13 +1441,22 @@ class PackageKitYumBackend(PackageKitBaseBackend): - - return False - -+ # basename filter if specified -+ if FILTER_BASENAME in fltlist: -+ for (pkg,status) in self._basename_filter(package_list): -+ self._show_package(pkg,status) -+ else: -+ for (pkg,status) in package_list: -+ self._show_package(pkg,status) -+ - return True - - def _do_extra_filtering(self,pkg,filterList): - ''' do extra filtering (gui,devel etc) ''' - for filter in filterList: - if filter in (FILTER_INSTALLED, FILTER_NOT_INSTALLED): -- continue -+ if not self._do_installed_filtering(filter,pkg): -+ return False - elif filter in (FILTER_GUI, FILTER_NOT_GUI): - if not self._do_gui_filtering(filter, pkg): - return False -@@ -1433,11 +1466,17 @@ class PackageKitYumBackend(PackageKitBaseBackend): - elif filter in (FILTER_FREE, FILTER_NOT_FREE): - if not self._do_free_filtering(filter, pkg): - return False -- elif filter in (FILTER_BASENAME, FILTER_NOT_BASENAME): -- if not self._do_basename_filtering(filter, pkg): -- return False - return True - -+ def _do_installed_filtering(self,flt,pkg): -+ isInstalled = False -+ if flt == FILTER_INSTALLED: -+ wantInstalled = True -+ else: -+ wantInstalled = False -+ isInstalled = pkg.repo.id == 'installed' -+ return isInstalled == wantInstalled -+ - def _do_gui_filtering(self,flt,pkg): - isGUI = False - if flt == FILTER_GUI: -@@ -1477,32 +1516,7 @@ class PackageKitYumBackend(PackageKitBaseBackend): - - return isFree == wantFree - -- def _do_basename_filtering(self,flt,pkg): -- if flt == FILTER_BASENAME: -- wantBase = True -- else: -- wantBase = False -- -- isBase = self._check_basename(pkg) -- -- return isBase == wantBase - -- def _check_basename(self, pkg): -- ''' -- If a package does not have a source rpm (If that ever -- happens), or it does have a source RPM, and the package's name -- is the same as the source RPM's name, then we assume it is the -- 'base' package. -- ''' -- basename = pkg.name -- -- if pkg.sourcerpm: -- basename = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)[0] -- -- if basename == pkg.name: -- return True -- -- return False - - def _is_development_repo(self, repo): - if repo.endswith('-debuginfo'): -@@ -1576,28 +1590,41 @@ class PackageKitYumBackend(PackageKitBaseBackend): - ''' - find a package based on a package id (name;version;arch;repoid) - ''' -- # Split up the id -- (n,idver,a,d) = self.get_package_from_id(id) -- # get e,v,r from package id version -- e,v,r = self._getEVR(idver) -+ # is this an real id or just an name -+ if len(id.split(';')) > 1: -+ # Split up the id -+ (n,idver,a,d) = self.get_package_from_id(id) -+ # get e,v,r from package id version -+ e,v,r = self._getEVR(idver) -+ else: -+ n = id -+ e = v = r = a = None - # search the rpmdb for the nevra - pkgs = self.yumbase.rpmdb.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a) -- # if the package is found, then return it -+ # if the package is found, then return it (do not have to match the repo_id) - if len(pkgs) != 0: - return pkgs[0],True - # search the pkgSack for the nevra -- pkgs = self.yumbase.pkgSack.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a) -- # if the package is found, then return it -- if len(pkgs) != 0: -- return pkgs[0],False -- else: -+ try: -+ pkgs = self.yumbase.pkgSack.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a) -+ except yum.Errors.RepoError,e: -+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e)) -+ # nothing found -+ if len(pkgs) == 0: - return None,False -+ # one NEVRA in a single repo -+ if len(pkgs) == 1: -+ return pkgs[0],False -+ # we might have the same NEVRA in multiple repos, match by repo name -+ for pkg in pkgs: -+ if d == pkg.repoid: -+ return pkg,False -+ # repo id did not match -+ return None,False - - def _is_inst(self,pkg): - return self.yumbase.rpmdb.installed(po=pkg) - -- -- - def _installable(self, pkg, ematch=False): - - """check if the package is reasonably installable, true/false""" -@@ -1764,6 +1791,57 @@ class PackageKitYumBackend(PackageKitBaseBackend): - return INFO_ENHANCEMENT - else: - return INFO_UNKNOWN -+ def _is_main_package(self,repo): -+ if repo.endswith('-debuginfo'): -+ return False -+ if repo.endswith('-devel'): -+ return False -+ if repo.endswith('-libs'): -+ return False -+ return True -+ -+ def _basename_filter(self,package_list): -+ ''' -+ Filter the list so that the number of packages are reduced. -+ This is done by only displaying gtk2 rather than gtk2-devel, gtk2-debuginfo, etc. -+ This imlementation is done by comparing the SRPM name, and if not falling back -+ to the first entry. -+ We have to fall back else we don't emit packages where the SRPM does not produce a -+ RPM with the same name, for instance, mono produces mono-core, mono-data and mono-winforms. -+ @package_list: a (pkg,status) list of packages -+ A new list is returned that has been filtered -+ ''' -+ base_list = [] -+ output_list = [] -+ base_list_already_got = [] -+ -+ #find out the srpm name and add to a new array of compound data -+ for (pkg,status) in package_list: -+ if pkg.sourcerpm: -+ base = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)[0] -+ base_list.append ((pkg,status,base,pkg.version)); -+ else: -+ base_list.append ((pkg,status,'nosrpm',pkg.version)); -+ -+ #find all the packages that match thier basename name (done seporately so we get the "best" match) -+ for (pkg,status,base,version) in base_list: -+ if base == pkg.name and (base,version) not in base_list_already_got: -+ output_list.append((pkg,status)) -+ base_list_already_got.append ((base,version)) -+ -+ #for all the ones not yet got, can we match against a non devel match? -+ for (pkg,status,base,version) in base_list: -+ if (base,version) not in base_list_already_got: -+ if self._is_main_package(pkg.name): -+ output_list.append((pkg,status)) -+ base_list_already_got.append ((base,version)) -+ -+ #add the remainder of the packages, which should just be the single debuginfo's -+ for (pkg,status,base,version) in base_list: -+ if (base,version) not in base_list_already_got: -+ output_list.append((pkg,status)) -+ base_list_already_got.append ((base,version)) -+ return output_list - - def _get_obsoleted(self,name): - obsoletes = self.yumbase.up.getObsoletesTuples( newest=1 ) -diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp -index 746da82..15c4b4f 100644 ---- a/backends/zypp/pk-backend-zypp.cpp -+++ b/backends/zypp/pk-backend-zypp.cpp -@@ -1170,7 +1170,7 @@ backend_find_packages_thread (PkBackend *backend) - mode = pk_backend_get_uint (backend, "mode"); - - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); -- pk_backend_no_percentage_updates (backend); -+ pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); - - std::vector<zypp::sat::Solvable> *v = new std::vector<zypp::sat::Solvable>; - std::vector<zypp::sat::Solvable> *v2 = new std::vector<zypp::sat::Solvable>; -diff --git a/client/pk-console.c b/client/pk-console.c -index 8f69068..5a05a8e 100644 ---- a/client/pk-console.c -+++ b/client/pk-console.c -@@ -50,7 +50,7 @@ static gboolean awaiting_space = FALSE; - static gboolean trusted = TRUE; - static guint timer_id = 0; - static guint percentage_last = 0; --static gchar *filename = NULL; -+static gchar **files_cache = NULL; - static PkControl *control = NULL; - static PkClient *client = NULL; - static PkClient *client_task = NULL; -@@ -494,6 +494,12 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar * - return g_strdup (package); - } - -+ ret = pk_client_reset (client_task, error); -+ if (ret == FALSE) { -+ pk_warning ("failed to reset client task"); -+ return NULL; -+ } -+ - /* we need to resolve it */ - ret = pk_client_resolve (client_task, filter, package, error); - if (ret == FALSE) { -@@ -549,20 +555,93 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar * - } - - /** -- * pk_console_install_package: -+ * pk_console_install_stuff: - **/ - static gboolean --pk_console_install_package (PkClient *client, const gchar *package, GError **error) -+pk_console_install_stuff (PkClient *client, gchar **packages, GError **error) - { -- gboolean ret; -- gchar *package_id; |
