forked from rpms/PackageKit
73 lines
3.0 KiB
Diff
73 lines
3.0 KiB
Diff
diff -rNup PackageKit-1.2.8.orig/backends/dnf/pk-backend-dnf.c PackageKit-1.2.8/backends/dnf/pk-backend-dnf.c
|
|
--- PackageKit-1.2.8.orig/backends/dnf/pk-backend-dnf.c 2023-11-08 22:35:41.000000000 +0200
|
|
+++ PackageKit-1.2.8/backends/dnf/pk-backend-dnf.c 2026-01-23 15:03:15.210833341 +0200
|
|
@@ -794,6 +794,46 @@ dnf_utils_force_distupgrade_on_upgrade (
|
|
return FALSE;
|
|
}
|
|
|
|
+/**
|
|
+ * dnf_utils_expand_arches_with_microarch:
|
|
+ * @native_arches: Array of native architectures from DNF context
|
|
+ *
|
|
+ * Expands the architecture list to include x86_64 microarchitecture level variants.
|
|
+ * When native arch is x86_64, we also include x86_64_v2, x86_64_v3, x86_64_v4
|
|
+ * since they are all compatible with the base x86_64 architecture.
|
|
+ *
|
|
+ * Returns: A newly allocated NULL-terminated array of architecture strings (caller must free with g_strfreev)
|
|
+ */
|
|
+static gchar **
|
|
+dnf_utils_expand_arches_with_microarch (const gchar **native_arches)
|
|
+{
|
|
+ GPtrArray *expanded_arches;
|
|
+ gboolean has_x86_64 = FALSE;
|
|
+ guint i;
|
|
+
|
|
+ /* Create array to hold expanded architecture list */
|
|
+ expanded_arches = g_ptr_array_new_with_free_func (g_free);
|
|
+
|
|
+ /* Copy all native architectures and check for x86_64 */
|
|
+ for (i = 0; native_arches[i] != NULL; i++) {
|
|
+ g_ptr_array_add (expanded_arches, g_strdup (native_arches[i]));
|
|
+ if (g_strcmp0 (native_arches[i], "x86_64") == 0)
|
|
+ has_x86_64 = TRUE;
|
|
+ }
|
|
+
|
|
+ /* If x86_64 is present, add microarchitecture level variants */
|
|
+ if (has_x86_64) {
|
|
+ g_ptr_array_add (expanded_arches, g_strdup ("x86_64_v2"));
|
|
+ g_ptr_array_add (expanded_arches, g_strdup ("x86_64_v3"));
|
|
+ g_ptr_array_add (expanded_arches, g_strdup ("x86_64_v4"));
|
|
+ }
|
|
+
|
|
+ /* NULL-terminate the array */
|
|
+ g_ptr_array_add (expanded_arches, NULL);
|
|
+
|
|
+ return (gchar **) g_ptr_array_free (expanded_arches, FALSE);
|
|
+}
|
|
+
|
|
static GPtrArray *
|
|
dnf_utils_run_query_with_filters (PkBackendJob *job, DnfSack *sack,
|
|
HyQuery query, PkBitfield filters)
|
|
@@ -801,14 +841,17 @@ dnf_utils_run_query_with_filters (PkBack
|
|
GPtrArray *results;
|
|
PkBackendDnfJobData *job_data = pk_backend_job_get_user_data (job);
|
|
const gchar *application_glob = "/usr/share/applications/*.desktop";
|
|
+ g_auto(GStrv) expanded_arches = NULL;
|
|
|
|
/* arch */
|
|
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_ARCH)) {
|
|
- hy_query_filter_in (query, HY_PKG_ARCH, HY_EQ,
|
|
- dnf_context_get_native_arches (job_data->context));
|
|
+ const gchar **native_arches = dnf_context_get_native_arches (job_data->context);
|
|
+ expanded_arches = dnf_utils_expand_arches_with_microarch (native_arches);
|
|
+ hy_query_filter_in (query, HY_PKG_ARCH, HY_EQ, (const gchar **) expanded_arches);
|
|
} else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_ARCH)) {
|
|
- hy_query_filter_in (query, HY_PKG_ARCH, HY_NEQ,
|
|
- dnf_context_get_native_arches (job_data->context));
|
|
+ const gchar **native_arches = dnf_context_get_native_arches (job_data->context);
|
|
+ expanded_arches = dnf_utils_expand_arches_with_microarch (native_arches);
|
|
+ hy_query_filter_in (query, HY_PKG_ARCH, HY_NEQ, (const gchar **) expanded_arches);
|
|
}
|
|
|
|
/* installed */
|