Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Flatpak Package For GTK App #29

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

BrainBlasted
Copy link
Collaborator

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

Previously the app used "writeas-gtk" as the app id. This was invalid
according to freedesktop specifications.

See https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-id-generic
for details on what an App ID should be.
Creates a flatpak manifest to build the app.
Does not yet build the writeas-cli.

Related to T663
These are the directories flatpak can create while building
an app. Since they should not be committed, they belong
in the gitignore.
Flatpak doesn't support running extra commands, so we need
to make the cli build it's own target. This is made optional
since the cli doesn't always need to be shipped with the app.

Related to T663
This was missed during the consolidation of repositiories.
Since the app has different executable names for the
different builds, the app_id cannot be used as the "exec"
line unconditionally.
@BrainBlasted BrainBlasted requested a review from thebaer August 1, 2019 22:36
This run_target no longer exists.
@BrainBlasted
Copy link
Collaborator Author

BrainBlasted commented Aug 1, 2019

The current issues:

  • There's no way to authenticate from the UI, which means you can't actually publish from the app
  • 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.
  • 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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

@thebaer
Copy link
Member

thebaer commented Aug 2, 2019

  • 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

@BrainBlasted
Copy link
Collaborator Author

BrainBlasted commented Aug 2, 2019 via email

Fixes publishing and copies the post link to the clipboard.
@BrainBlasted
Copy link
Collaborator Author

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

Allows for flatpak users to have persistent drafts,
and for the bundled cli to access them.
@BrainBlasted
Copy link
Collaborator Author

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.

Required for saving to work within flatpaks. Does not affect
non-flatpak usage.

Related to T663
@BrainBlasted
Copy link
Collaborator Author

I'd say that this is ready now.

@thebaer
Copy link
Member

thebaer commented Aug 2, 2019

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

@BrainBlasted
Copy link
Collaborator Author

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?

@thebaer
Copy link
Member

thebaer commented Aug 5, 2019

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

Needed to make sure we can create, read, and write to this
directory.
@ghost
Copy link

ghost commented Nov 18, 2019

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.

@BrainBlasted
Copy link
Collaborator Author

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

@thebaer thebaer requested review from a user and removed request for thebaer March 2, 2020 20:46
@ghost
Copy link

ghost commented Mar 9, 2020

@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?

@BrainBlasted
Copy link
Collaborator Author

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

Adds a test to validate appdata and fixes a mistake
that caused validation failure
@thebaer thebaer linked an issue Sep 1, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package as Flatpak for elementary OS 6
2 participants