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

build: add Flatpak manifest file #2724

Draft
wants to merge 15 commits into
base: development
Choose a base branch
from

Conversation

ikolomiko
Copy link

I've created an initial Flatpak manifest file and a script to create a local Flatpak bundle. The permissions are pretty much bare-bones at this point. Since the manifest doesn't give read/write permissions for the $HOME directory, the application fails to start after the initial setup done by the wizard. There are 3 ways to overcome this issue:

  1. Using a wrapper for setting the datadir to some predefined and sandboxed directory, just like how Bitcoin-Core handles this issue. This solution is pretty seamless and secure. However, it restricts the user from choosing another directory, and feels like a dirty hack.
  2. Letting the application access the $HOME directory. This approach requires the least effort. However, it violates the sandboxing Flatpak provides, and might cause conflicts if there's also a native version of Gridcoin installed besides the Flatpak version.
  3. Using the XDG Base Directory Specification for the default location of datadir, instead of using the ~/.GridcoinResearch directory. Following the XDG specifications is considered the best practice on Linux in general, both for Flatpak applications and for other package managers. However, this would require some modification in the codebase.

@jamescowens
Copy link
Member

jamescowens commented Dec 11, 2023

Actually, IIRC correctly, we already have code in the app handling the special Flatpack data directory scenario for BOINC in boinc.cpp, but not for the main data directory.

We have an existing issue that is the inverse of choice 2, which is here.... #2650. The issue is that if both the native and flatpack BOINC are installed, the Gridcoin app defaults to the native version of BOINC.

Since we need to straighten out flatpack handling anyway, I strongly advocate choice 3.

We should have some discussion here about what that would look like.

Copy link
Member

@div72 div72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for following the XDG specification but Flatpak's default XDG_*_HOME variables are set to application specific ~/.var/app/us.gridcoin.Gridcoin-Research/... which means a native installation and a Flatpak installation would have differing data directories. Flatpak advocates this but I'm not exactly sold on that. I think having a unified datadir is better UX overall.

P.S. @ikolomiko Are there any guidelines on publishing to the FlatHub? Like for example if we allow accessing $HOME would that disqualify the app from getting published?

contrib/build-flatpak.sh Outdated Show resolved Hide resolved
contrib/build-flatpak.sh Outdated Show resolved Hide resolved
contrib/build-flatpak.sh Show resolved Hide resolved
contrib/flatpak-manifest.json Outdated Show resolved Hide resolved
@ikolomiko
Copy link
Author

@div72 A general guideline can be found here. About the filesystem access for unified config data, there's a special section in the Flathub requirements guide which strictly discourages that. While I'm not sure if it disqualifies the app from getting published on Flathub, it certainly is not the expected behavior of a Flatpak app.

@jamescowens
Copy link
Member

I think we need to live with the XDG spec. Do we need to modify the existing FlatPack handling code?

@jamescowens
Copy link
Member

The linter is barking again.... :)

@ikolomiko
Copy link
Author

Apparently the web editor of GitHub inserts CRLF line endings to commit messages, causing the linter to go crazy, lol. Gotta rewrite the commit messages locally.

ikolomiko and others added 5 commits February 7, 2024 20:11
Surround the repo_root variable with double quotes

Co-authored-by: div72 <60045611+div72@users.noreply.github.com>
Co-authored-by: div72 <60045611+div72@users.noreply.github.com>
Run autogen.sh

Co-authored-by: div72 <60045611+div72@users.noreply.github.com>
- Add the flathub.org remote if it doesn't exist
- Download required SDK and runtimes if not downloaded
- Display the path of the created bundle with the command to install it
@jamescowens
Copy link
Member

That is crazy that the Github editor is following the Windows line ending standard...

@ikolomiko
Copy link
Author

Made a bunch of additions to the manifest for some permissions. AFAICT, the only missing piece is setting the default value of datadir to one of the XDG base directories. Possible candidates are XDG_DATA_HOME, XDG_CONFIG_HOME and XDG_STATE_HOME. Any ideas on which to pick?

@ikolomiko ikolomiko requested a review from div72 February 11, 2024 13:54
@jamescowens jamescowens modified the milestones: Miss Piggy, Natasha Feb 29, 2024
@CyberTailor
Copy link
Contributor

Using a wrapper for setting the datadir to some predefined and sandboxed directory, just like how Bitcoin-Core handles this issue. This solution is pretty seamless and secure. However, it restricts the user from choosing another directory, and feels like a dirty hack.

Actually no. Flatpak permissions can be fine-tuned in the system settings if you use KDE and in third-party Flatseal application otherwise.

@CyberTailor
Copy link
Contributor

I'd also like to note that a .metainfo.xml file is required in order to be listed in app stores.

@CyberTailor
Copy link
Contributor

I'm all for following the XDG specification but Flatpak's default XDG_*_HOME variables are set to application specific ~/.var/app/us.gridcoin.Gridcoin-Research/... which means a native installation and a Flatpak installation would have differing data directories. Flatpak advocates this but I'm not exactly sold on that. I think having a unified datadir is better UX overall.

Users installing both their distro's package and the Flatpak are going to be confused anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package Gridcoin-Research as Flatpak
4 participants