flatpak / flatpak-builder

Tool to build flatpaks from source
GNU Lesser General Public License v2.1
142 stars 93 forks source link

Program inside an extension can't find glib compiled schema inside prefix #398

Open ranisalt opened 3 years ago

ranisalt commented 3 years ago

Linux distribution and version

Manjaro Linux 20210612-1

Flatpak-builder version

1.0.12

Flatpak version

1.11.1

Description of the problem

I'm trying to build yad as a module inside an extension for com.valvesoftware.Steam. The make install step for yad runs glib-compile-schemas but reads and stores the definitions in /app/utils/steamtinkerlaunch/share/glib-2.0/schemas/gschemas.compiled, because /app/utils/steamtinkerlaunch set as build-options.prefix.

When running flatpak run --command=yad com.valvesoftware.Steam I get the following error:

(yad:2): GLib-GIO-ERROR **: 17:05:02.090: Settings schema 'yad.settings' is not installed

Now I don't know a lot about glib/gschema in general, but apparently it is looking in XDG_DATA_DIRS which is set to XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/run/host/share in the sandbox, so /app/utils/steamtinkerlaunch/share should also be there. I found no way to append to XDG_DATA_DIRS in the documentation.

Steps to reproduce

This is the yaml configuration:

---
id: com.valvesoftware.Steam.Utility.steamtinkerlaunch
branch: stable
runtime: com.valvesoftware.Steam
runtime-version: stable
sdk: org.freedesktop.Sdk//20.08
build-extension: true

build-options:
  prefix: /app/utils/steamtinkerlaunch
  prepend-path: /app/utils/steamtinkerlaunch/bin

cleanup:
  - /include
  - /man
  - /share/aclocal
  - /share/doc
  - /share/man

modules:
  - name: stl
    no-autogen: true
    sources:
      - type: archive
        url: https://github.com/frostworx/steamtinkerlaunch/archive/v6.8.tar.gz
        sha256: 45179feaeb67dd2f0a44fb03e4e7bbaac0e7ec67cdb9dc9a36d592786e56360e

    modules:
      - name: yad
        sources:
          - type: archive
            url: https://github.com/v1cont/yad/releases/download/v10.1/yad-10.1.tar.xz
            sha256: 742a5bd55de4b249eee6780bddeccb05c7ff4b158fd9743808f7d280219fd3ab

        modules:
          - shared-modules/intltool/intltool-0.51.json

It is required to clone [flathub/shared-modules (https://github.com/flathub/shared-modules) in the same folder. I am building with flatpak-builder --user --force-clean build com.valvesoftware.Steam.Utility.steamtinkerlaunch.yml --install

gasinvein commented 3 years ago

I believe this could be fixed on the Steam flatpak app side and doesn't really have much to do with flatpak-builder.

TingPing commented 3 years ago

I found no way to append to XDG_DATA_DIRS in the documentation.

You can set any arbitrary environment variable in build-options: env. To be more dynamic you can run a script in the build module.

ranisalt commented 3 years ago

I believe this could be fixed on the Steam flatpak app side and doesn't really have much to do with flatpak-builder.

How is this related to the Steam flatpak? I don't see anything that could change there, and changing some value globally would not be good as not everybody will have the extension installed

You can set any arbitrary environment variable in build-options: env

I need to set the var in run time, not build time

gasinvein commented 3 years ago

How is this related to the Steam flatpak? I don't see anything that could change there

It's possible add each extension's share subdir to XDG_DATA_DIRS in the app wrapper. This can't be done on the extension side.

changing some value globally would not be good as not everybody will have the extension installed

I don't know for sure how safe is adding a non-existing directory to XDG_DATA_DIRS, probably it depends on program reading this variable.

TingPing commented 3 years ago

I don't know for sure how safe is adding a non-existing directory to XDG_DATA_DIRS, probably it depends on program reading this variable.

That would be an application bug. As per the spec:

When attempting to read a file, if for any reason a file in a certain directory is unaccessible, e.g. because the directory is non-existent, the file is non-existent or the user is not authorized to open the file, then the processing of the file in that directory should be skipped.