diff options
author | Matthias Klumpp <matthias@tenstral.net> | 2023-09-21 05:15:48 +0200 |
---|---|---|
committer | Matthias Klumpp <matthias@tenstral.net> | 2023-10-01 02:20:42 +0200 |
commit | 825afa2a7cd9e99afa8352bd87e276997f888ee4 (patch) | |
tree | 846cb0fdc36436f413987ba77e8ac5cd64699fea | |
parent | 90b2ac1346ef30503bc53603f6c523b7d76eca54 (diff) |
apt/dnf: Adjust for upcoming AppStream 1.0 API
AppStream 1.0 is not released yet, but this patch makes PackageKit
already build with the changed API as well as the older API versions.
Resolves: #670
-rw-r--r-- | backends/apt/apt-job.cpp | 13 | ||||
-rw-r--r-- | backends/dnf/meson.build | 2 | ||||
-rw-r--r-- | backends/dnf/pk-backend-dnf-common.c | 23 | ||||
-rw-r--r-- | backends/dnf/pk-backend-dnf-refresh.c | 1 | ||||
-rw-r--r-- | backends/dnf/pk-backend-dnf.c | 1 | ||||
-rw-r--r-- | contrib/PackageKit.spec.in | 2 | ||||
-rw-r--r-- | tests/ci/Dockerfile-fedora | 12 |
7 files changed, 33 insertions, 21 deletions
diff --git a/backends/apt/apt-job.cpp b/backends/apt/apt-job.cpp index d68c98faa..907059c83 100644 --- a/backends/apt/apt-job.cpp +++ b/backends/apt/apt-job.cpp @@ -1460,16 +1460,25 @@ void AptJob::providesMimeType(PkgList &output, gchar **values) /* search for mimetypes for all values */ for (guint i = 0; values[i] != NULL; i++) { +#if AS_CHECK_VERSION(1,0,0) + g_autoptr(AsComponentBox) result = NULL; +#else g_autoptr(GPtrArray) result = NULL; - +#endif if (m_cancel) break; +#if AS_CHECK_VERSION(1,0,0) + result = as_pool_get_components_by_provided_item (pool, AS_PROVIDED_KIND_MEDIATYPE, values[i]); + for (guint j = 0; j < as_component_box_len (result); j++) { + const gchar *pkgname; + AsComponent *cpt = as_component_box_index (result, j); +#else result = as_pool_get_components_by_provided_item (pool, AS_PROVIDED_KIND_MEDIATYPE, values[i]); for (guint j = 0; j < result->len; j++) { const gchar *pkgname; AsComponent *cpt = AS_COMPONENT (g_ptr_array_index (result, j)); - +#endif /* sanity check */ pkgname = as_component_get_pkgname (cpt); if (pkgname == NULL) { diff --git a/backends/dnf/meson.build b/backends/dnf/meson.build index bcc18939e..814b0d932 100644 --- a/backends/dnf/meson.build +++ b/backends/dnf/meson.build @@ -1,4 +1,4 @@ -appstream_dep = dependency('appstream-glib') +appstream_dep = dependency('appstream', version: '>=0.14.0') dnf_dep = dependency('libdnf', version: '>=0.43.1') rpm_dep = dependency('rpm') c_args = ['-DG_LOG_DOMAIN="PackageKit-DNF"'] diff --git a/backends/dnf/pk-backend-dnf-common.c b/backends/dnf/pk-backend-dnf-common.c index 6b6a5c29f..545335fc8 100644 --- a/backends/dnf/pk-backend-dnf-common.c +++ b/backends/dnf/pk-backend-dnf-common.c @@ -23,7 +23,7 @@ #include <gmodule.h> #include <glib.h> -#include <appstream-glib.h> +#include <appstream.h> #include <libdnf/libdnf.h> #include "pk-shared.h" @@ -92,18 +92,15 @@ dnf_utils_refresh_repo_appstream (DnfRepo *repo, GError **error) const gchar *as_basenames[] = { "appstream", "appstream-icons", NULL }; for (guint i = 0; as_basenames[i] != NULL; i++) { const gchar *tmp = dnf_repo_get_filename_md (repo, as_basenames[i]); - if (tmp != NULL) { -#if AS_CHECK_VERSION(0,3,4) - if (!as_utils_install_filename (AS_UTILS_LOCATION_CACHE, - tmp, - dnf_repo_get_id (repo), - NULL, - error)) { - return FALSE; - } -#else - g_warning ("need to install AppStream metadata %s", tmp); -#endif + if (tmp == NULL) + continue; + + if (!as_utils_install_metadata_file (AS_METADATA_LOCATION_CACHE, + tmp, + dnf_repo_get_id (repo), + NULL, + error)) { + return FALSE; } } return TRUE; diff --git a/backends/dnf/pk-backend-dnf-refresh.c b/backends/dnf/pk-backend-dnf-refresh.c index 6d87dc819..efbb12233 100644 --- a/backends/dnf/pk-backend-dnf-refresh.c +++ b/backends/dnf/pk-backend-dnf-refresh.c @@ -26,7 +26,6 @@ #include <glib/gstdio.h> #include <glib/gi18n.h> #include <string.h> -#include <appstream-glib.h> #include <unistd.h> #include <stdlib.h> diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c index 37649f934..544bd6acb 100644 --- a/backends/dnf/pk-backend-dnf.c +++ b/backends/dnf/pk-backend-dnf.c @@ -25,7 +25,6 @@ #include <glib.h> #include <glib/gstdio.h> #include <string.h> -#include <appstream-glib.h> #include <pk-backend.h> #include <packagekit-glib2/pk-common-private.h> diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in index bf0164b6e..06ba947f5 100644 --- a/contrib/PackageKit.spec.in +++ b/contrib/PackageKit.spec.in @@ -37,7 +37,7 @@ BuildRequires: bash-completion %if !0%{?rhel} BuildRequires: rpm-devel >= 4.11.0 -BuildRequires: libappstream-glib-devel +BuildRequires: appstream-devel BuildRequires: librepo-devel >= 1.1.5 BuildRequires: libsolv-devel BuildRequires: libdnf-devel >= 0.7.0 diff --git a/tests/ci/Dockerfile-fedora b/tests/ci/Dockerfile-fedora index 47034240c..d49ff08e0 100644 --- a/tests/ci/Dockerfile-fedora +++ b/tests/ci/Dockerfile-fedora @@ -1,7 +1,15 @@ -FROM fedora:31 +FROM fedora:38 RUN dnf -y update -RUN dnf -y install dnf-plugins-core libdnf-devel redhat-rpm-config meson gcc ninja-build dbus-daemon +RUN dnf -y install \ + dnf-plugins-core \ + libdnf-devel \ + redhat-rpm-config \ + meson \ + gcc \ + ninja-build \ + dbus-daemon \ + appstream-devel RUN dnf -y builddep PackageKit RUN mkdir /build |