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

Add Flatpak build system and support #12006

Merged
merged 58 commits into from
May 28, 2024

Conversation

someone13574
Copy link
Contributor

@someone13574 someone13574 commented May 18, 2024

ping #6687

This is the third iteration of this PR (v2 here) and uses a different approach to the first two (the process wrapper lib was a maintainability nightmare). While the first two attempted to spawn the necessary processes using flatpak-spawn and host-spawn from the app inside the sandbox, this version first spawns the cli binary which then restart's itself outside of the sandbox using flatpak-spawn. The restarted cli process than can call the bundled app binary normally, with no need for flatpak-spawn because it is already outside of the sandbox. This is done instead of keeping the cli in the sandbox because ipc becomes very difficult and broken when trying to do it across the sandbox.

Gnome software (example using nightly channel and release notes generated using the script):

TODO in this PR:

  • Bundle libs.
  • Cleanup release note converter.

Future work:

  • Auto-update dialog
  • Flatpak auto-update (complete 'Auto-update dialog' first)
  • Experimental bundle releases for feedback (?).

(?) = Maybe / Request for feedback

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 18, 2024
@versecafe
Copy link
Contributor

Figure out how to deal with release-information. (flathub doesn't like long release notes; zed's release notes are pretty long).

You could try doing some simple automated summary of the release notes through something like OpenAI's API it shouldn't hallucinate with text summarization, but there is a small risk and it could drop some of the more important changes or focus on minor ones sometimes, but I don't know how else you'd automate it without eiter just trimming after x chars or having separate release summaries for flatpack.

@bbb651
Copy link
Contributor

bbb651 commented May 18, 2024

Maybe sorting based on the likes of the linked github issues it closes, then show the top 5 and link to the full release notes at the end? It’s unreasonable to shrink 30+ bullet points into 3 sentences without it being a word soup or completely skipping all of the details, ai isn’t magic.
I checked what other large apps like browsers, vscode, lapce, discord, etc. (I know some of them aren’t official) - turns out all of them just have no release notes, so doing this seems to more than enough, it’s very unreasonable to ask large apps to provide 3 sentence release notes.

@someone13574
Copy link
Contributor Author

someone13574 commented May 18, 2024

Maybe sorting based on the likes of the linked github issues it closes, then show the top 5 and link to the full release notes at the end?

For larger releases, avoid endless bullet point lists and rather go with a few paragraphs or a shorter summarized list instead

Seems like that is allowed.

link to the full release notes at the end?

We already have the <url> tag which does that.

script/flatpak Outdated Show resolved Hide resolved
Fixes issues with background mode and ipc.
Clippy has all features enabled, including the flatpak flag
@mikayla-maki
Copy link
Contributor

@someone13574 We'd be interested in looking at a thinner version of the V2 changes at a future date. Feel free to try it out and let us know how it goes in #6687. But right now, we need to adjust our focus to core functionality.

@PgBiel
Copy link

PgBiel commented May 24, 2024

Thank you @mikayla-maki, your change will certainly be helpful. Overall, I believe this PR is important so we can start with an initial implementation, and improve this in the future, hopefully in some way through which we can run Zed in the sandbox while satisfying the requirements we discussed above. I'd like to thank @someone13574 for starting this work and moving this forward.

Let's continue the discussion in the relevant issue.

@mikayla-maki
Copy link
Contributor

Sounds good. Do you want the action to create preview bundles on prereleases if this is merged? It is already ready to go.

My first thought is 'no', as we're about to focus on linux bundling on our own. But I don't have the full context here, so I'll defer to whatever @ConradIrwin thinks :)

@ryanabx

This comment was marked as off-topic.

@mikayla-maki
Copy link
Contributor

We appreciate the feedback @ryanabx, but let’s put that in the flatpak issue: #6687

To build & install the Flatpak package locally follow the steps below:

1. Install Flatpak for your distribution as outlined [here](https://flathub.org/setup).
2. Run the `script/flatpak/deps` script to install the required dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

Before that run script/generate-licenses

@yodatak
Copy link
Contributor

yodatak commented May 27, 2024

Sorry to bother with it but when i try to edit a single file with gui in gnome zed devel is not listed , i cannot find witch portal we need for that xdg-desktop-portal

image

@someone13574
Copy link
Contributor Author

@yodatak

Sorry to bother with it but when i try to edit a single file with gui in gnome zed devel is not listed , i cannot find witch portal we need for that xdg-desktop-portal

I think that’s because the mimetype list in the desktop file is very small atm. I was trying to keep the changes small since that’s a bit of a side tangent to this PR, but I’d be happy to add some more in a different PR.

@ConradIrwin ConradIrwin merged commit f7115be into zed-industries:main May 28, 2024
8 checks passed
@ConradIrwin
Copy link
Member

I've merged this for now. Thanks for pushing this over the line @someone13574

In terms of next steps:

  • Over the next few weeks we're pushing towards a first preview release of Linux. This will not be flatpak based, but will use the curl https://zed.dev/install.sh | bash installer instead.
  • It is not currently a priority for us to keep pushing on the flatpak work. That said, if we can get listed on flat hub without any more code changes, I'd be happy to help out with that effort as needed.
  • We are not going to make changes to interact with bespoke sandboxes for the foreseeable future – our first priority has to be a non-sandboxed linux install that works well. If you would like to run zed in a sandbox, you are welcome to do so, but we're unlikely to prioritize issues if stuff doesn't work because of that.

@someone13574 someone13574 deleted the flatpak-2 branch May 28, 2024 17:12
@RustoMCSpit
Copy link

has this been mentioned? flathub/flathub#5253 this is the draft in flathub for zed

@someone13574
Copy link
Contributor Author

has this been mentioned? flathub/flathub#5253 this is the draft in flathub for zed

Yes, its been mentioned but will likely never go anywhere due to how we are doing flatpak on Zed's end (escaping the sandbox and rebundling the normal linux binary).

@RustoMCSpit
Copy link

Yes, its been mentioned but will likely never go anywhere due to how we are doing flatpak on Zed's end (escaping the sandbox and rebundling the normal linux binary).

oh i see, well i mean would that break its ability to be toggled with something like flatseal?

@ryanabx
Copy link

ryanabx commented Jul 2, 2024

Yes, its been mentioned but will likely never go anywhere due to how we are doing flatpak on Zed's end (escaping the sandbox and rebundling the normal linux binary).

oh i see, well i mean would that break its ability to be toggled with something like flatseal?

Yes. If I understand correctly the permission that makes it all work is talk-name=org.freedesktop.Flatpak which is needed for flatpak-spawn --host

@RustoMCSpit
Copy link

okay great, so why does the sandbox need to be escaped?

@ryanabx
Copy link

ryanabx commented Jul 2, 2024

okay great, so why does the sandbox need to be escaped?

Because unless you're using containers for development, you'll want access to development resources (i.e. language support packages, language servers, etc.) outside the sandbox, and will want to run commands outside the sandbox

@jtolio
Copy link

jtolio commented Jul 16, 2024

Because unless you're using containers for development, you'll want access to development resources (i.e. language support packages, language servers, etc.) outside the sandbox, and will want to run commands outside the sandbox

I got the impression that these were things zed automatically downloaded and installed. I certainly would much prefer all of these things running inside the sandbox rather than outside?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.