Skip to content
Permalink
Browse files

hif: Automatically install AppStream metadata

  • Loading branch information...
hughsie committed Dec 17, 2014
1 parent 595fe09 commit 62bc031cab55e1830a99f79ea12b7e59a9f54c3a
Showing with 24 additions and 1 deletion.
  1. +22 −0 backends/hif/pk-backend-hif.c
  2. +1 −1 configure.ac
  3. +1 −0 contrib/PackageKit.spec.in
@@ -28,6 +28,7 @@
#include <glib/gstdio.h>
#include <string.h>
#include <libhif-private.h>
#include <appstream-glib.h>

#include <pk-backend.h>
#include <pk-cleanup.h>
@@ -1326,6 +1327,9 @@ pk_backend_refresh_source (PkBackendJob *job,
gboolean src_okay;
HifState *state_local;
GError *error_local = NULL;
const gchar *as_basenames[] = { "appstream", "appstream-icons", NULL };
const gchar *tmp;
guint i;

/* set state */
ret = hif_state_set_steps (state, error,
@@ -1377,6 +1381,24 @@ pk_backend_refresh_source (PkBackendJob *job,
}
}

/* copy the appstream files somewhere that the GUI will pick them up */
for (i = 0; as_basenames[i] != NULL; i++) {
tmp = hif_source_get_filename_md (src, as_basenames[i]);
if (tmp != NULL) {
#if AS_CHECK_VERSION(0,3,4)
if (!as_utils_install_filename (AS_UTILS_LOCATION_CACHE,
tmp,
hif_source_get_id (src),
NULL,
error)) {
return FALSE;
}
#else
g_warning ("need to install AppStream metadata %s", tmp);
#endif
}
}

/* done */
return hif_state_done (state, error);
}
@@ -450,7 +450,7 @@ AC_SUBST(DBUS_SYS_DIR)
AC_SUBST(DBUS_SERVICES_DIR)

if test x$enable_hif = xyes; then
PKG_CHECK_MODULES(HIF, libhif >= 0.1.7)
PKG_CHECK_MODULES(HIF, appstream-glib libhif >= 0.1.7)
fi

have_python_backend="no"
@@ -51,6 +51,7 @@ BuildRequires: bash-completion
%if !0%{?rhel}
BuildRequires: hawkey-devel >= 0.4.6
BuildRequires: rpm-devel >= 4.11.0
BuildRequires: libappstream-glib-devel
BuildRequires: librepo-devel >= 1.1.5
BuildRequires: libsolv-devel
BuildRequires: libhif-devel

0 comments on commit 62bc031

Please sign in to comment.
You can’t perform that action at this time.