New upstream release

This commit is contained in:
Richard Hughes 2014-06-23 11:40:51 +01:00
parent d0d4e41ad8
commit f1e2d73b2e
5 changed files with 13 additions and 238 deletions

1
.gitignore vendored
View File

@ -37,3 +37,4 @@ PackageKit-0.6.7.tar.bz2
/PackageKit-0.9.1-20140307.tar.xz
/PackageKit-0.9.1.tar.xz
/PackageKit-0.9.2.tar.xz
/PackageKit-0.9.3.tar.xz

View File

@ -1,186 +0,0 @@
From 6c7960abf6f3d3ccb498c502d7f4d531563f3d7d Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Mon, 12 May 2014 21:40:35 +0200
Subject: [PATCH] hif: Reimplement multiple kernel package installation
We had existing code that allowed us to keep multiple kernel packages
installed, but this had broken at some point. This commit reimplements it using
current hawkey API, simplifying code and making it work again.
Signed-off-by: Richard Hughes <richard@hughsie.com>
---
backends/hawkey/pk-backend-hawkey.c | 130 +++++++++++++++---------------------
1 file changed, 53 insertions(+), 77 deletions(-)
diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
index 16d2d86..74ff632 100644
--- a/backends/hawkey/pk-backend-hawkey.c
+++ b/backends/hawkey/pk-backend-hawkey.c
@@ -652,6 +652,50 @@ out:
return ret;
}
+/**
+ * hif_utils_get_installonly_pkgs:
+ */
+static const gchar **
+hif_utils_get_installonly_pkgs (void)
+{
+ static const gchar *installonly_pkgs[] = { "kernel",
+ "installonlypkg(kernel)",
+ "installonlypkg(kernel-module)",
+ "installonlypkg(vm)",
+ NULL };
+ return installonly_pkgs;
+}
+
+/**
+ * hif_utils_get_installonly_limit:
+ */
+static int
+hif_utils_get_installonly_limit (void)
+{
+ return 3;
+}
+
+/**
+ * hif_package_is_installonly:
+ */
+static gboolean
+hif_package_is_installonly (HyPackage pkg)
+{
+ const gchar **installonly_pkgs;
+ const gchar *pkg_name;
+ guint i;
+
+ installonly_pkgs = hif_utils_get_installonly_pkgs ();
+ pkg_name = hy_package_get_name (pkg);
+
+ for (i = 0; installonly_pkgs[i] != NULL; i++) {
+ if (g_strcmp0 (pkg_name, installonly_pkgs[i]) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
typedef enum {
HIF_CREATE_SACK_FLAG_NONE,
HIF_CREATE_SACK_FLAG_USE_CACHE,
@@ -4247,65 +4291,6 @@ pk_backend_install_files (PkBackend *backend, PkBackendJob *job,
}
/**
- * hy_package_evr_sort_newest_cb:
- */
-static gint
-hy_package_evr_sort_newest_cb (gconstpointer a, gconstpointer b)
-{
- HyPackage *pa = (HyPackage *) a;
- HyPackage *pb = (HyPackage *) b;
- return -hy_package_evr_cmp (*pa, *pb);
-}
-
-/**
- * hif_goal_erase_only_n:
- */
-static void
-hif_goal_erase_only_n (HyGoal goal,
- HySack sack_installed,
- const gchar *package_name,
- guint only_n)
-{
- GPtrArray *array = NULL;
- HyPackageList pkglist = NULL;
- HyPackage pkg;
- HyQuery query = NULL;
- guint i;
-
- /* run query */
- query = hy_query_create (sack_installed);
- hy_query_filter (query, HY_PKG_NAME, HY_EQ, package_name);
- hy_query_filter (query, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME);
- pkglist = hy_query_run (query);
-
- /* any matches? */
- if ((guint) hy_packagelist_count (pkglist) < only_n) {
- g_debug ("only %i %s packages, not removing any",
- hy_packagelist_count (pkglist), package_name);
- goto out;
- }
-
- /* remove the oldest */
- array = g_ptr_array_new ();
- FOR_PACKAGELIST (pkg, pkglist, i)
- g_ptr_array_add (array, pkg);
- g_ptr_array_sort (array, hy_package_evr_sort_newest_cb);
- for (i = 0; i < array->len; i++) {
- pkg = g_ptr_array_index (array, i);
- if (i >= only_n - 1) {
- g_debug ("removing %s", hif_package_get_nevra (pkg));
- hy_goal_erase (goal, pkg);
- }
- }
-
-out:
- if (array != NULL)
- g_ptr_array_unref (array);
- hy_packagelist_free (pkglist);
- hy_query_free (query);
-}
-
-/**
* pk_backend_update_packages_thread:
*/
static void
@@ -4321,11 +4306,6 @@ pk_backend_update_packages_thread (PkBackendJob *job, GVariant *params, gpointer
gboolean ret;
gchar **package_ids;
guint i;
- guint j;
- const gchar *only_n_pkgnames[] = { "kernel",
- "kernel-source",
- "kernel-devel",
- NULL };
g_variant_get (params, "(t^a&s)",
&job_data->transaction_flags,
@@ -4357,6 +4337,10 @@ pk_backend_update_packages_thread (PkBackendJob *job, GVariant *params, gpointer
goto out;
}
+ /* set up the sack for packages that should only ever be installed, never updated */
+ hy_sack_set_installonly (sack, hif_utils_get_installonly_pkgs ());
+ hy_sack_set_installonly_limit (sack, hif_utils_get_installonly_limit ());
+
/* done */
ret = hif_state_done (job_data->state, &error);
if (!ret) {
@@ -4415,19 +4399,11 @@ pk_backend_update_packages_thread (PkBackendJob *job, GVariant *params, gpointer
}
hif_package_set_user_action (pkg, TRUE);
- /* allow some packages to have multiple versions installed,
- * but remove any older than the only_n limit */
- for (j = 0; only_n_pkgnames[j] != NULL; j++) {
- if (g_strcmp0 (hy_package_get_name (pkg),
- only_n_pkgnames[j]) == 0) {
- hy_goal_install (job_data->goal, pkg);
- hif_goal_erase_only_n (job_data->goal, sack,
- only_n_pkgnames[j],
- 5);
- } else {
- hy_goal_upgrade_to (job_data->goal, pkg);
- }
- }
+ /* allow some packages to have multiple versions installed */
+ if (hif_package_is_installonly (pkg))
+ hy_goal_install (job_data->goal, pkg);
+ else
+ hy_goal_upgrade_to (job_data->goal, pkg);
}
/* run transaction */
--
1.9.0

View File

@ -1,41 +0,0 @@
From 5887a114b86e87d6446d4a363dcd73f7f1ee1241 Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Sun, 8 Jun 2014 12:33:24 +0200
Subject: [PATCH] hawkey: Correctly set the cleanup status
We were wrongly setting the cleanup status not on the removed package,
but on the one that got installed as a replacement.
https://bugs.freedesktop.org/show_bug.cgi?id=79791
---
backends/hawkey/pk-backend-hawkey.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
index 74ff632..bb71098 100644
--- a/backends/hawkey/pk-backend-hawkey.c
+++ b/backends/hawkey/pk-backend-hawkey.c
@@ -3223,7 +3223,7 @@ pk_backend_transaction_commit (PkBackendJob *job, HifState *state, GError **erro
/* add anything that gets obsoleted to a helper array which is used to
* map removed packages auto-added by rpm to actual HyPackage's */
- commit->remove_helper = g_ptr_array_new ();
+ commit->remove_helper = g_ptr_array_new_with_free_func ((GDestroyNotify) hy_package_free);
for (i = 0; i < commit->install->len; i++) {
pkg = g_ptr_array_index (commit->install, i);
is_update = hif_package_get_status (pkg) == PK_STATUS_ENUM_UPDATE;
@@ -3231,8 +3231,9 @@ pk_backend_transaction_commit (PkBackendJob *job, HifState *state, GError **erro
continue;
pkglist = hy_goal_list_obsoleted_by_package (job_data->goal, pkg);
FOR_PACKAGELIST(pkg_tmp, pkglist, j) {
- g_ptr_array_add (commit->remove_helper, pkg);
- hif_package_set_status (pkg, PK_STATUS_ENUM_CLEANUP);
+ g_ptr_array_add (commit->remove_helper,
+ hy_package_link (pkg_tmp));
+ hif_package_set_status (pkg_tmp, PK_STATUS_ENUM_CLEANUP);
}
hy_packagelist_free (pkglist);
}
--
2.0.0

View File

@ -8,18 +8,14 @@
Summary: Package management service
Name: PackageKit
Version: 0.9.2
Release: 7%{?dist}
Version: 0.9.3
Release: 1%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.freedesktop.org/software/PackageKit/
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
# Fedora-specific: set Vendor.conf up for Fedora.
Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch
# Upstream fix for parallel kernel package installation
Patch1: 0001-hif-Reimplement-multiple-kernel-package-installation.patch
# Another upstream fix for offline updates
Patch2: 0002-hawkey-Correctly-set-the-cleanup-status.patch
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: shared-mime-info
@ -182,15 +178,13 @@ using PackageKit.
%setup -q
#%setup -q -n %{name}-%{version}-%{gitdate}
%patch0 -p1 -b .fedora
%patch1 -p1
%patch2 -p1
%build
%configure \
--disable-static \
--enable-python3 \
%if 0%{?rhel} == 0
--enable-hawkey \
--enable-hif \
--enable-introspection \
--enable-bash-completion \
%else
@ -298,7 +292,7 @@ popd > /dev/null
%{_unitdir}/packagekit.service
%{_libexecdir}/pk-*offline-update
%if 0%{?rhel} == 0
%{_libdir}/packagekit-backend/libpk_backend_hawkey.so
%{_libdir}/packagekit-backend/libpk_backend_hif.so
%endif
%files glib
@ -351,6 +345,13 @@ popd > /dev/null
%changelog
* Mon Jun 23 2014 Richard Hughes <rhughes@redhat.com> - 0.9.3-1
- New upstream release
- Add PK_ROLE_ENUM_GET_OLD_TRANSACTIONS to get-roles response
- Fix crash when a plugin is using the backend in it's initialization stage
- Make the polkit policy not be desktop-centric
- Port to libhif and rename the backend to "Hif"
* Tue Jun 10 2014 Kalev Lember <kalevlember@gmail.com> - 0.9.2-7
- Backport an offline updates fix

View File

@ -1 +1 @@
17ffc13ad8ad28a135b3093402b9254c PackageKit-0.9.2.tar.xz
f617cde2d17fc6877aebc1796626710a PackageKit-0.9.3.tar.xz