mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Merge pull request #138 from TheEvilSkeleton/libflatpak
Bundle libflatpak
This commit is contained in:
2
.github/workflows/flatpak-builder.yml
vendored
2
.github/workflows/flatpak-builder.yml
vendored
@@ -18,4 +18,4 @@ jobs:
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
|
||||
with:
|
||||
bundle: io.github.flattool.Warehouse.flatpak
|
||||
manifest-path: io.github.flattool.Warehouse.json
|
||||
manifest-path: build-aux/io.github.flattool.Warehouse.json
|
||||
|
||||
24
build-aux/fuse-2.9.2-closefrom.patch
Normal file
24
build-aux/fuse-2.9.2-closefrom.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: 2017 Christian Hergert <chergert@redhat.com>
|
||||
Reference: https://gitlab.gnome.org/GNOME/gnome-builder/-/blob/main/build-aux/flatpak/fuse-2.9.2-closefrom.patch?ref_type=heads
|
||||
|
||||
--- fuse-2.9.2/util/ulockmgr_server.c.closefromfix 2019-01-04 05:33:33.000000000 -0800
|
||||
+++ fuse-2.9.2/util/ulockmgr_server.c 2022-07-12 12:29:56.445402244 -0700
|
||||
@@ -124,7 +124,7 @@
|
||||
return res;
|
||||
}
|
||||
|
||||
-static int closefrom(int minfd)
|
||||
+static int _closefrom(int minfd)
|
||||
{
|
||||
DIR *dir = opendir("/proc/self/fd");
|
||||
if (dir) {
|
||||
@@ -384,7 +384,7 @@
|
||||
dup2(nullfd, 1);
|
||||
}
|
||||
close(3);
|
||||
- closefrom(5);
|
||||
+ _closefrom(5);
|
||||
while (1) {
|
||||
char c;
|
||||
int sock;
|
||||
25
build-aux/fuse-2.9.2-namespace-conflict-fix.patch
Normal file
25
build-aux/fuse-2.9.2-namespace-conflict-fix.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: 2017 Christian Hergert <chergert@redhat.com>
|
||||
Reference: https://gitlab.gnome.org/GNOME/gnome-builder/-/blob/main/build-aux/flatpak/fuse-2.9.2-namespace-conflict-fix.patch?ref_type=heads
|
||||
|
||||
diff -up fuse-2.9.2/include/fuse_kernel.h.conflictfix fuse-2.9.2/include/fuse_kernel.h
|
||||
--- fuse-2.9.2/include/fuse_kernel.h.conflictfix 2013-06-26 09:31:57.862198038 -0400
|
||||
+++ fuse-2.9.2/include/fuse_kernel.h 2013-06-26 09:32:19.679198365 -0400
|
||||
@@ -88,12 +88,16 @@
|
||||
#ifndef _LINUX_FUSE_H
|
||||
#define _LINUX_FUSE_H
|
||||
|
||||
-#include <sys/types.h>
|
||||
+#ifdef __linux__
|
||||
+#include <linux/types.h>
|
||||
+#else
|
||||
+#include <stdint.h>
|
||||
#define __u64 uint64_t
|
||||
#define __s64 int64_t
|
||||
#define __u32 uint32_t
|
||||
#define __s32 int32_t
|
||||
#define __u16 uint16_t
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Version negotiation:
|
||||
29
build-aux/fuse-disable-sys-mount-under-flatpak.patch
Normal file
29
build-aux/fuse-disable-sys-mount-under-flatpak.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: 2018 Christian Hergert <chergert@redhat.com>
|
||||
Reference: https://gitlab.gnome.org/GNOME/gnome-builder/-/blob/main/build-aux/flatpak/fuse-disable-sys-mount-under-flatpak.patch?ref_type=heads
|
||||
|
||||
From 1ec935f4abecd08957affc7b21bae6bf5be78931 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hergert <chergert@redhat.com>
|
||||
Date: Thu, 12 Apr 2018 01:47:57 -0700
|
||||
Subject: [PATCH] libfuse: disable sys mount under flatpak
|
||||
|
||||
---
|
||||
lib/mount.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/lib/mount.c b/lib/mount.c
|
||||
index 7a18c11..1667db2 100644
|
||||
--- a/lib/mount.c
|
||||
+++ b/lib/mount.c
|
||||
@@ -392,6 +392,9 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
|
||||
int fd;
|
||||
int res;
|
||||
|
||||
+ /* disable in flatpak */
|
||||
+ return -2;
|
||||
+
|
||||
if (!mnt) {
|
||||
fprintf(stderr, "fuse: missing mountpoint parameter\n");
|
||||
return -1;
|
||||
--
|
||||
2.17.0.rc2
|
||||
13
build-aux/fusermount-wrapper.sh
Normal file
13
build-aux/fusermount-wrapper.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2020 Christian Hergert <christian@hergert.me>
|
||||
# Reference: https://gitlab.gnome.org/GNOME/gnome-builder/-/blob/main/build-aux/flatpak/fusermount-wrapper.sh?ref_type=heads
|
||||
|
||||
if [ -z "$_FUSE_COMMFD" ]; then
|
||||
FD_ARGS=
|
||||
else
|
||||
FD_ARGS="--env=_FUSE_COMMFD=${_FUSE_COMMFD} --forward-fd=${_FUSE_COMMFD}"
|
||||
fi
|
||||
|
||||
exec flatpak-spawn --host --forward-fd=1 --forward-fd=2 --forward-fd=3 $FD_ARGS fusermount "$@"
|
||||
164
build-aux/io.github.flattool.Warehouse.json
Normal file
164
build-aux/io.github.flattool.Warehouse.json
Normal file
@@ -0,0 +1,164 @@
|
||||
{
|
||||
"id" : "io.github.flattool.Warehouse",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "47",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "warehouse",
|
||||
"finish-args" : [
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--device=dri",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.freedesktop.Flatpak",
|
||||
"--filesystem=/var/lib/flatpak/:ro",
|
||||
"--filesystem=~/.local/share/flatpak/:ro",
|
||||
"--filesystem=~/.var/app/",
|
||||
"--filesystem=host-etc"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"MOUNT_FUSE_PATH" : "../tmp/"
|
||||
}
|
||||
},
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "blueprint-compiler",
|
||||
"buildsystem" : "meson",
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/jwestman/blueprint-compiler",
|
||||
"tag" : "v0.14.0"
|
||||
}
|
||||
],
|
||||
"cleanup" : [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "libfuse",
|
||||
"config-opts" : [
|
||||
"UDEV_RULES_PATH=/app/etc/udev/rules.d",
|
||||
"INIT_D_PATH=/app/etc/init.d"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/bin/ulockmgr_server"
|
||||
],
|
||||
"post-install" : [
|
||||
"install -m a+rx fusermount-wrapper.sh /app/bin/fusermount"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "archive",
|
||||
"url" : "https://github.com/libfuse/libfuse/releases/download/fuse-2.9.9/fuse-2.9.9.tar.gz",
|
||||
"sha256" : "d0e69d5d608cc22ff4843791ad097f554dd32540ddc9bed7638cc6fea7c1b4b5"
|
||||
},
|
||||
{
|
||||
"type" : "patch",
|
||||
"path" : "fuse-2.9.2-namespace-conflict-fix.patch"
|
||||
},
|
||||
{
|
||||
"type" : "patch",
|
||||
"path" : "fuse-disable-sys-mount-under-flatpak.patch"
|
||||
},
|
||||
{
|
||||
"type" : "patch",
|
||||
"path" : "fuse-2.9.2-closefrom.patch"
|
||||
},
|
||||
{
|
||||
"type" : "file",
|
||||
"path" : "fusermount-wrapper.sh"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ostree",
|
||||
"buildsystem": "autotools",
|
||||
"config-opts": [
|
||||
"--disable-rofiles-fuse"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ostreedev/ostree.git",
|
||||
"branch": "main"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pyparsing",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"pip3 install --prefix=/app --no-deps ./pyparsing-*.whl"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "file",
|
||||
"url": "https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl",
|
||||
"sha256": "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "flatpak",
|
||||
"buildsystem" : "meson",
|
||||
"config-opts" : [
|
||||
"-Ddocbook_docs=disabled",
|
||||
"-Dseccomp=disabled",
|
||||
"-Dsandboxed_triggers=false",
|
||||
"-Dsystem_helper=disabled",
|
||||
"-Dsystem_install_dir=/var/lib/flatpak",
|
||||
"--sysconfdir=/var/run/host/etc",
|
||||
"-Dman=disabled",
|
||||
"-Dhttp_backend=curl",
|
||||
"-Dsystemd=disabled",
|
||||
"-Dtests=false"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/bin/flatpak-bisect",
|
||||
"/bin/flatpak-coredumpctl",
|
||||
"/etc/profile.d",
|
||||
"/lib/systemd",
|
||||
"/share/dbus-1/interfaces/org.freedesktop.*",
|
||||
"/share/dbus-1/services/org.freedesktop.*",
|
||||
"/share/flatpak/triggers",
|
||||
"/share/gdm",
|
||||
"/share/zsh"
|
||||
],
|
||||
"post-install" : [
|
||||
"cp /usr/bin/update-mime-database /app/bin",
|
||||
"cp /usr/bin/update-desktop-database /app/bin"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/flatpak/flatpak.git",
|
||||
"tag" : "1.15.6"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "warehouse",
|
||||
"builddir" : true,
|
||||
"buildsystem" : "meson",
|
||||
"config-opts": [ "-Dprofile=development" ],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "dir",
|
||||
"path" : ".."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"id": "io.github.flattool.Warehouse",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "47",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "warehouse",
|
||||
"finish-args": [
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--device=dri",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.freedesktop.Flatpak",
|
||||
"--filesystem=/var/lib/flatpak/:ro",
|
||||
"--filesystem=~/.local/share/flatpak/:ro",
|
||||
"--filesystem=~/.var/app/",
|
||||
"--filesystem=host-etc"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name": "blueprint-compiler",
|
||||
"buildsystem": "meson",
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
|
||||
"tag": "v0.14.0"
|
||||
}
|
||||
],
|
||||
"cleanup": ["*"]
|
||||
},
|
||||
{
|
||||
"name": "warehouse",
|
||||
"builddir": true,
|
||||
"buildsystem": "meson",
|
||||
"config-opts": ["-Dprofile=default"],
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,8 +24,9 @@ import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
gi.require_version("Flatpak", "1.0")
|
||||
|
||||
from gi.repository import Gtk, Gio, Adw, GLib
|
||||
from gi.repository import Gtk, Gio, Adw, GLib, Flatpak
|
||||
from .window import WarehouseWindow
|
||||
from .const import Config
|
||||
from .error_toast import ErrorToast
|
||||
@@ -34,7 +35,9 @@ from .error_toast import ErrorToast
|
||||
class WarehouseApplication(Adw.Application):
|
||||
"""The main application singleton class."""
|
||||
|
||||
troubleshooting = "OS: {os}\nWarehouse version: {wv}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nProfile: {profile}\nLanguage: {lang}"
|
||||
troubleshooting = (
|
||||
"OS: {os}\nWarehouse version: {wv}\nlibflatpak: {libflatpak}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nProfile: {profile}\nLanguage: {lang}"
|
||||
)
|
||||
version = Config.VERSION
|
||||
|
||||
def __init__(self):
|
||||
@@ -65,6 +68,7 @@ class WarehouseApplication(Adw.Application):
|
||||
|
||||
self.is_dialog_open = False
|
||||
|
||||
libflatpak_version = str(Flatpak.MAJOR_VERSION) + "." + str(Flatpak.MINOR_VERSION) + "." + str(Flatpak.MICRO_VERSION)
|
||||
gtk_version = str(Gtk.MAJOR_VERSION) + "." + str(Gtk.MINOR_VERSION) + "." + str(Gtk.MICRO_VERSION)
|
||||
adw_version = str(Adw.MAJOR_VERSION) + "." + str(Adw.MINOR_VERSION) + "." + str(Adw.MICRO_VERSION)
|
||||
os_string = GLib.get_os_info("NAME") + " " + GLib.get_os_info("VERSION")
|
||||
@@ -73,6 +77,7 @@ class WarehouseApplication(Adw.Application):
|
||||
self.troubleshooting = self.troubleshooting.format(
|
||||
os=os_string,
|
||||
wv=self.version,
|
||||
libflatpak=libflatpak_version,
|
||||
gtk=gtk_version,
|
||||
adw=adw_version,
|
||||
profile=Config.PROFILE,
|
||||
|
||||
Reference in New Issue
Block a user