writeas-gtk icon indicating copy to clipboard operation
writeas-gtk copied to clipboard

Create a Flatpak Package For GTK App

Open BrainBlasted opened this issue 6 years ago • 15 comments

This creates a development flatpak package for the desktop app. Includes a rework of the non-elementary version's app ID and a fix for an issue introduced in #28

BrainBlasted avatar Aug 01 '19 22:08 BrainBlasted

The current issues:

  • ~~There's no way to authenticate from the UI, which means you can't actually publish from the app~~
  • [x] The current way of saving drafts doesn't work with the flatpak sandbox. I'll look into that - either we make a sandbox hole or I figure this out.
  • [x] It requires xclip currently. I'll need to see if there's a way around this or if I need to ship xclip within the flatpak.

BrainBlasted avatar Aug 01 '19 22:08 BrainBlasted

Once we get the last two worked out can we merge this? It will be much easier for me to work on number 1 after that

BrainBlasted avatar Aug 01 '19 23:08 BrainBlasted

In addition: should I look into getting flatpak CI set up, or should I make that a separate task?

BrainBlasted avatar Aug 01 '19 23:08 BrainBlasted

  • There's no way to authenticate from the UI, which means you can't actually publish from the app

Hm, you should be able to publish -- the writeas-cli doesn't require authentication to publish. Maybe it's related to the flatpak sandbox? Because the CLI does need access to ~/.writeas

In addition: should I look into getting flatpak CI set up, or should I make that a separate task?

I'd say we address this as a separate task. Please feel free to create that in Phabricator

thebaer avatar Aug 02 '19 00:08 thebaer

Ah, apologies. The xclip issue is the only one that blocks publishing, then.

BrainBlasted avatar Aug 02 '19 00:08 BrainBlasted

Fixed the publishing issue, will look into the draft issue next.

BrainBlasted avatar Aug 02 '19 21:08 BrainBlasted

For now I added a sandbox hole to the flatpak. In the future I think we should migrate to using xdg dirs instead of a directory in ~/. Flatpak properly handles that use case by default.

BrainBlasted avatar Aug 02 '19 21:08 BrainBlasted

I'd say that this is ready now.

BrainBlasted avatar Aug 02 '19 22:08 BrainBlasted

Great, sounds good. How can I test this out?

thebaer avatar Aug 02 '19 22:08 thebaer

There are a few ways:

  • GNOME Builder (recommended). This should get you set up in a couple clicks.

  • Commands:

$ flatpak-builder --repo=repo app flatpak/com.abunchtell.WriteAsDesktop.json

Or I can send you a flatpak bundle. Which way would you prefer?

BrainBlasted avatar Aug 02 '19 22:08 BrainBlasted

Thanks! I'd like to personally know how everything works, so I'm happy to build everything

thebaer avatar Aug 05 '19 15:08 thebaer

I'm having a tough time getting this working, now it's an error when running the built flatpak with flatpak run com.abunchtell.WriteAsDesktop:

Failed to register: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown

This was after adding the local repo and installing for my user.

@thebaer needed dependencies with flatpak:

  • flatpak install org.gnome.Sdk//3.32
  • flatpak install org.gnome.Platform//3.32
  • flatpak install io.elementary.BaseApp//Juno
  • flatpak install org.freedesktop.Sdk.Extension.golang//18.08

@BrainBlasted I couldn't find an easy way to install required dependencies so just kept installing whatever the builder comlained was missing.

ghost avatar Nov 18 '19 19:11 ghost

@robjloranger do you have xdg-desktop-portal & xdg-desktop-portal-gtk installed?

BrainBlasted avatar Feb 18 '20 21:02 BrainBlasted

@BrainBlasted tried again today and found another error building:

[0/1] Installing files.
Installing src/wl-copy to /app/bin
Installing src/wl-paste to /app/bin
Installing /run/build/wl-clipboard/data/wl-copy.1 to /app/share/man/man1
Installing /run/build/wl-clipboard/data/wl-paste.1 to /app/share/man/man1
Installing /run/build/wl-clipboard/data/wl-clipboard.1 to /app/share/man/man1
Installing /run/build/wl-clipboard/completions/bash/wl-copy to /app/share/bash-completion/completions
Installing /run/build/wl-clipboard/completions/bash/wl-paste to /app/share/bash-completion/completions
Installing /run/build/wl-clipboard/completions/zsh/_wl-copy to /app/share/zsh/site-functions
Installing /run/build/wl-clipboard/completions/zsh/_wl-paste to /app/share/zsh/site-functions
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run
    return options.run_func(options)
  File "/usr/lib/python3.7/site-packages/mesonbuild/minstall.py", line 514, in run
    installer.do_install(datafilename)
  File "/usr/lib/python3.7/site-packages/mesonbuild/minstall.py", line 346, in do_install
    self.install_data(d)
  File "/usr/lib/python3.7/site-packages/mesonbuild/minstall.py", line 375, in install_data
    d.dirmaker.makedirs(outdir, exist_ok=True)
  File "/usr/lib/python3.7/site-packages/mesonbuild/minstall.py", line 55, in makedirs
    os.makedirs(path, exist_ok=exist_ok)
  File "/usr/lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/usr/share/fish'
FAILED: meson-install 
/usr/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
Error: module wl-clipboard: Child process exited with code 1

What version of python is required to build?

Also, are there any python modules required to build?

ghost avatar Mar 09 '20 15:03 ghost

This isn't a python issue by rather an idea where a dependency requires a new cli flag. Working on updating things.

BrainBlasted avatar Mar 09 '20 15:03 BrainBlasted