1
0
forked from rpms/PackageKit

AlmaLinux changes: Support x86_64 v2 variant.

This commit is contained in:
Yuriy Kohut 2026-01-23 15:42:40 +02:00
parent acdd66c361
commit 609343ee7d
2 changed files with 76 additions and 1 deletions

View File

@ -4,7 +4,7 @@
Summary: Package management service
Name: PackageKit
Version: 1.2.8
Release: %autorelease
Release: %autorelease.alma.1
License: GPL-2.0-or-later AND LGPL-2.1-or-later
URL: http://www.freedesktop.org/software/PackageKit/
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
@ -26,6 +26,9 @@ Patch2: appstream-mark-pk-as-compulsory.patch
# https://github.com/PackageKit/PackageKit/pull/774
Patch3: runtime-warnings.patch
# AlmaLinux x86_64 v2 patch
Patch4: packagekit-x86_64_v2.patch
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: xmlto
BuildRequires: gtk-doc

View File

@ -0,0 +1,72 @@
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 */