Skip to content

build: add Flatpak manifest file #2724

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

Draft
wants to merge 77 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.

@jamescowens jamescowens requested a review from div72 February 4, 2024 01:34
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?

@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 <[email protected]>
Run autogen.sh

Co-authored-by: div72 <[email protected]>
- 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
jamescowens and others added 29 commits April 1, 2025 00:22
If mandatory sidestakes that have non-zero allocation are set OR
local sidestakes with non-zero allocations are set and the
-enablesidestaking flag is turned on, then set
fEnableSideStaking in the miner to true to include sidestakes.

This replaces the old logic of fEnableSideStaking, which simply
followed -enablestidestaking.
Also add validation for this in Validator.
This is to support fraction based arithmetic. Currently this is used in sidestake
allocations as a replacement for the double type calculations to eliminate
consensus problems in mandatory sidestakes due to floating point arithmetic.
Remove error banding in mandatory sidestake validation.
This suppresses the percent sign for editing and prevents a
silent rejection due to inclusion of the percent sign in the saved
field.
…ages

Not all errors are where claimed aomount is greater than calculated. With MRC
and mandatory sidestakes, number and destination of outputs are also checked.
Also update copyright year to 2024 for applicable files.
Creating a new sidestake entry would result in a percentage of zero,
which would have to be edited to the correct value. The entered value
is properly handled with this commit.
This makes fraction addition more resistant to overflows.
This uses the "cross" gcds to do cancellation and increase
resistance of overflows for things like (1000 / 999) * (999 / 1000).
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
6 participants