From patchwork Sun Mar 31 06:43:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zheng Junjie X-Patchwork-Id: 62383 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2FD6F27BBEA; Sun, 31 Mar 2024 07:44:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2751427BBE9 for ; Sun, 31 Mar 2024 07:44:20 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqovD-0005Z1-GD; Sun, 31 Mar 2024 02:44:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rqovA-0005YY-Pr for guix-patches@gnu.org; Sun, 31 Mar 2024 02:44:00 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqovA-0001ap-Hi for guix-patches@gnu.org; Sun, 31 Mar 2024 02:44:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rqovC-0003Rh-I3 for guix-patches@gnu.org; Sun, 31 Mar 2024 02:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70099] [PATCH] gnu: flatpak: Pass system icons and fonts. Resent-From: Zheng Junjie Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Mar 2024 06:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70099 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70099@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171186743013171 (code B ref -1); Sun, 31 Mar 2024 06:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 31 Mar 2024 06:43:50 +0000 Received: from localhost ([127.0.0.1]:46494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqouz-0003QM-EL for submit@debbugs.gnu.org; Sun, 31 Mar 2024 02:43:50 -0400 Received: from lists.gnu.org ([2001:470:142::17]:51652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqouu-0003Pu-Ma for submit@debbugs.gnu.org; Sun, 31 Mar 2024 02:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rqoum-0005W9-Or for guix-patches@gnu.org; Sun, 31 Mar 2024 02:43:36 -0400 Received: from smtp84.cstnet.cn ([159.226.251.84] helo=cstnet.cn) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1rqoui-0001OV-6o for guix-patches@gnu.org; Sun, 31 Mar 2024 02:43:36 -0400 Received: from m.taildaf0f.ts.net (unknown [183.247.5.22]) by APP-05 (Coremail) with SMTP id zQCowAC3RBIBBglmV6NeAA--.27966S2; Sun, 31 Mar 2024 14:43:14 +0800 (CST) From: Zheng Junjie Date: Sun, 31 Mar 2024 14:43:07 +0800 Message-ID: <54bd7d232c3a231704463801bb605b106e0757ad.1711867387.git.zhengjunjie@iscas.ac.cn> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-CM-TRANSID: zQCowAC3RBIBBglmV6NeAA--.27966S2 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUYT7k0a2IF6F4UM7kC6x804xWl14x267AK xVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUJVWUGw A2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26r1j 6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j6r4UM28EF7xvwVC2z280aVAFwI0_Gr 0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4j6r4UJwAS0I0E0xvYzxvE52x082IY62kv 0487M2AExVAIFx02aVAFz4v204v7Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4kE6I8I3I0E14AKx2xKxVC2ax8xMxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ Jr0_Jr4lx4CE17CEb7AF67AKxVWUJVWUXwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJV W8JbIYCTnIWIevJa73UjIFyTuYvjxU2_HUDUUUU X-Originating-IP: [183.247.5.22] X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/ Received-SPF: pass client-ip=159.226.251.84; envelope-from=zhengjunjie@iscas.ac.cn; helo=cstnet.cn X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, MIME_CHARSET_FARAWAY=2.45, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/flatpak-fix-fonts-icons.patch: New patch. * gnu/packages/package-management.scm(flatpak): Use it. * gnu/local.mk(dist_patch_DATA): Register it. Change-Id: I0359d0d9bf10120a8b784c910c50d0e4a9b7a616 --- gnu/local.mk | 1 + gnu/packages/package-management.scm | 4 +- .../patches/flatpak-fix-fonts-icons.patch | 89 +++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/flatpak-fix-fonts-icons.patch base-commit: f5558ee0cc1a11a8b61d3f4d43f05dd79d53ac77 diff --git a/gnu/local.mk b/gnu/local.mk index f2b480bded..2c1d794ec9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1209,6 +1209,7 @@ dist_patch_DATA = \ %D%/packages/patches/firebird-riscv64-support-pt2.patch \ %D%/packages/patches/flann-cmake-3.11.patch \ %D%/packages/patches/flatpak-fix-path.patch \ + %D%/packages/patches/flatpak-fix-fonts-icons.patch \ %D%/packages/patches/flatpak-unset-gdk-pixbuf-for-sandbox.patch \ %D%/packages/patches/fluxbox-1.3.7-no-dynamic-cursor.patch \ %D%/packages/patches/fluxbox-1.3.7-gcc.patch \ diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm index a0ede07d54..5e47f6aa1e 100644 --- a/gnu/packages/package-management.scm +++ b/gnu/packages/package-management.scm @@ -24,6 +24,7 @@ ;;; Copyright © 2023 jgart ;;; Copyright © 2023 Mădălin Ionel Patrașcu ;;; Copyright © 2024 Arun Isaac +;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -2019,7 +2020,8 @@ (define-public flatpak (sha256 (base32 "16b7f7n2mms6zgm0lj3fn86ny11xjn8cd3mrk1slwhvwnv8dnd4a")) (patches - (search-patches "flatpak-fix-path.patch" + (search-patches "flatpak-fix-fonts-icons.patch" + "flatpak-fix-path.patch" "flatpak-unset-gdk-pixbuf-for-sandbox.patch")))) ;; Wrap 'flatpak' so that GIO_EXTRA_MODULES is set, thereby allowing GIO to diff --git a/gnu/packages/patches/flatpak-fix-fonts-icons.patch b/gnu/packages/patches/flatpak-fix-fonts-icons.patch new file mode 100644 index 0000000000..5b9d855b2e --- /dev/null +++ b/gnu/packages/patches/flatpak-fix-fonts-icons.patch @@ -0,0 +1,89 @@ +modify from https://github.com/NixOS/nixpkgs/pull/262462 + +diff --git a/common/flatpak-run.c b/common/flatpak-run.c +index 94ad013..5c9f55e 100644 +--- a/common/flatpak-run.c ++++ b/common/flatpak-run.c +@@ -871,6 +871,49 @@ out: + return res; + } + ++static void ++get_gnu_closure (GHashTable *closure, const gchar *source_path) ++{ ++ if (g_file_test (source_path, G_FILE_TEST_IS_SYMLINK)) ++ { ++ g_autofree gchar *path = g_malloc(PATH_MAX); ++ realpath(source_path, path); ++ if (g_str_has_prefix(path, "/gnu/store/")) ++ { ++ *strchr(path + strlen("/gnu/store/"), '/') = 0; ++ g_hash_table_add(closure, g_steal_pointer (&path)); ++ } ++ } ++ else if (g_file_test (source_path, G_FILE_TEST_IS_DIR)) ++ { ++ g_autoptr(GDir) dir = g_dir_open(source_path, 0, NULL); ++ const gchar *file_name; ++ while ((file_name = g_dir_read_name(dir))) ++ { ++ g_autofree gchar *path = g_build_filename (source_path, file_name, NULL); ++ get_gnu_closure (closure, path); ++ } ++ } ++} ++ ++static void ++add_gnu_store_symlink_targets (FlatpakBwrap *bwrap, const gchar *source_path) ++{ ++ GHashTable *closure = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); ++ ++ get_gnu_closure(closure, source_path); ++ ++ GHashTableIter iter; ++ gpointer path; ++ g_hash_table_iter_init(&iter, closure); ++ while (g_hash_table_iter_next(&iter, &path, NULL)) ++ { ++ flatpak_bwrap_add_args (bwrap, "--ro-bind", path, path, NULL); ++ } ++ ++ g_hash_table_destroy(closure); ++} ++ + static void + add_font_path_args (FlatpakBwrap *bwrap) + { +@@ -898,6 +946,18 @@ add_font_path_args (FlatpakBwrap *bwrap) + "\t/run/host/fonts\n", + SYSTEM_FONTS_DIR); + } ++ else if (g_file_test ("/run/current-system/profile/share/fonts", G_FILE_TEST_EXISTS)) ++ { ++ add_gnu_store_symlink_targets (bwrap, "/run/current-system/profile/share/fonts"); ++ flatpak_bwrap_add_args (bwrap, ++ "--ro-bind", ++ "/run/current-system/profile/share/fonts", ++ "/run/host/fonts", ++ NULL); ++ g_string_append_printf (xml_snippet, ++ "\t/run/host/fonts\n", ++ "/run/current-system/profile/share/fonts"); ++ } + + if (g_file_test ("/usr/local/share/fonts", G_FILE_TEST_EXISTS)) + { +@@ -998,6 +1058,13 @@ add_icon_path_args (FlatpakBwrap *bwrap) + "--ro-bind", "/usr/share/icons", "/run/host/share/icons", + NULL); + } ++ else if (g_file_test ("/run/current-system/profile/share/icons", G_FILE_TEST_IS_DIR)) ++ { ++ add_gnu_store_symlink_targets (bwrap, "/run/current-system/profile/share/icons"); ++ flatpak_bwrap_add_args (bwrap, ++ "--ro-bind", "/run/current-system/profile/share/icons", "/run/host/share/icons", ++ NULL); ++ } + + user_icons_path = g_build_filename (g_get_user_data_dir (), "icons", NULL); + user_icons = g_file_new_for_path (user_icons_path);