f507356
From fa6dd59c5eaabc8c7e540f2aa2ded6f785de0a13 Mon Sep 17 00:00:00 2001
f507356
From: Adam Williamson <awilliam@redhat.com>
f507356
Date: Wed, 20 Feb 2019 11:12:04 -0800
f507356
Subject: [PATCH] Set 'NEWEST' flag when resolving packages with PackageKit
f507356
f507356
When resolving package names via PackageKit, realmd does not set
f507356
the PK_FILTER_ENUM_NEWEST flag that asks PK to only give the
f507356
*newest available* package for each package name. So if there
f507356
are three different versions of the package available in three
f507356
repositories, realmd winds up producing an array containing the
f507356
package IDs for all three of those packages and calling
f507356
InstallPackages on all of them. I don't know if PK's behaviour
f507356
in this case is defined or predictable, but in practice in at
f507356
least one case it reliably results in one of the older package
f507356
versions being installed.
f507356
f507356
This does not seem desirable, we should always want to install
f507356
the newest available version. So let's set the NEWEST flag to
f507356
ensure this.
f507356
f507356
A possible consequence here is that, if a newer version of the
f507356
package is not installable but an older version is, we will now
f507356
fail where previously we did not. But even in that case I don't
f507356
know if we would *reliably* succeed before, and silently
f507356
installing an older version still doesn't necessarily seem like
f507356
the right thing to do.
f507356
f507356
Signed-off-by: Adam Williamson <awilliam@redhat.com>
f507356
---
f507356
 service/realm-packages.c | 1 +
f507356
 1 file changed, 1 insertion(+)
f507356
f507356
diff --git a/service/realm-packages.c b/service/realm-packages.c
f507356
index 5976439..0309c57 100644
f507356
--- a/service/realm-packages.c
f507356
+++ b/service/realm-packages.c
f507356
@@ -343,6 +343,7 @@ packages_resolve_async (GDBusConnection *connection,
f507356
                         gpointer user_data)
f507356
 {
f507356
 	guint64 flags = 1 << 18 /* PK_FILTER_ENUM_ARCH */;
f507356
+	flags |= 1 << 16 /* PK_FILTER_ENUM_NEWEST */;
f507356
 	package_transaction_create ("Resolve", g_variant_new ("(t^as)", flags, package_names),
f507356
 	                            connection, cancellable, callback, user_data);
f507356
 }
f507356
-- 
f507356
2.20.1
f507356