From 4c8409ed6a337c04787b925c2b830ad14d8410ec Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 27 Mar 2019 09:46:06 +0100 Subject: [PATCH] appstream: Create symlinks for the icons/$origin subdirectory For compatibility with libappstream we create a $origin ("flatpak") subdirectory with symlinks to the size directories thus matching the standard merged appstream layout if we assume the appstream has origin=flatpak, which flatpak-builder creates. See https://github.com/ximion/appstream/pull/224 for details. Fixes https://github.com/flatpak/flatpak/pull/2779 Closes: #2789 Approved by: alexlarsson --- common/flatpak-utils.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 2cd9fdc3..c564ca7b 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -3865,6 +3865,7 @@ flatpak_repo_generate_appstream (OstreeRepo *repo, g_autoptr(GBytes) xml_gz_data = NULL; g_autoptr(OstreeMutableTree) mtree = ostree_mutable_tree_new (); g_autoptr(OstreeMutableTree) icons_mtree = NULL; + g_autoptr(OstreeMutableTree) icons_flatpak_mtree = NULL; g_autoptr(OstreeMutableTree) size1_mtree = NULL; g_autoptr(OstreeMutableTree) size2_mtree = NULL; const char *compat_arch; @@ -3884,6 +3885,19 @@ flatpak_repo_generate_appstream (OstreeRepo *repo, if (!flatpak_mtree_create_dir (repo, icons_mtree, "128x128", &size2_mtree, error)) return FALSE; + /* For compatibility with libappstream we create a $origin ("flatpak") subdirectory with symlinks + * to the size directories thus matching the standard merged appstream layout if we assume the + * appstream has origin=flatpak, which flatpak-builder creates. + * + * See https://github.com/ximion/appstream/pull/224 for details. + */ + if (!flatpak_mtree_create_dir (repo, icons_mtree, "flatpak", &icons_flatpak_mtree, error)) + return FALSE; + if (!flatpak_mtree_create_symlink (repo, icons_flatpak_mtree, "64x64", "../64x64", error)) + return FALSE; + if (!flatpak_mtree_create_symlink (repo, icons_flatpak_mtree, "128x128", "../128x128", error)) + return FALSE; + appstream_root = flatpak_appstream_xml_new (); for (i = 0; i < n_keys; i++)