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

Distribute using Flatpak #4938

Closed
Eonfge opened this issue Nov 6, 2019 · 31 comments
Closed

Distribute using Flatpak #4938

Eonfge opened this issue Nov 6, 2019 · 31 comments

Comments

@Eonfge
Copy link

Eonfge commented Nov 6, 2019

Intro

Flatpak is a framework for distributing desktop applications on Linux. It has been created by developers who have a long history of working on the Linux desktop, and is run as an independent open source project.

It allows you to package all required libraries into one file, which can also share dependencies using a versioned runtime. It offers sandboxing, atomic updates, and more state of the art technology. It also seamlessly integrates with any number of software centers and repositories, so that users stay up-to-date at all time. All of these things are essential for an application like Tribler, which has security responsibilities to its users.

Introduction: Reasons to use Flatpak

Why not Snap?

I noticed that you already support Snap (#4240), and it's true that Snap shares many technical ideas behind Flatpak. But there is one fundamental reason why I would propose switching from packaging system:

You are building a decentralized communication platform... tied to a centralized, close sourced, store front.

Snap is made by Canonical, and one of the most fundamental design decisions in their ecosystem, is that there is only one store: Canonical's. This is nice for them as they can provide all kinds of benefits on Ubuntu, but it also carries a heavy risk: A government request to remove an app, would instantly cut out any method of distribution. This is becoming a more serious risk, as software companies like Apple, Google and Microsoft are now routinely removing applications for political motives. If Canonical must choose between Tribler or their Chinese marketshare... then Tribler is out.

As such, tools like OnionShare and Tor Browser Downloader have opted to use flatpak instead. It guarantees that in the event of a power struggle, they can easily host their own repository without conflicting financial and moral interests.

I've previously aided in packaging applications for Flatpak, so I might be able to help if I got time. Until the, I wish to propose this change to you for future Linux distributions.

@qstokkink qstokkink added this to the Backlog milestone Nov 7, 2019
@xoriole
Copy link
Contributor

xoriole commented Nov 7, 2019

In an attempt to build a platform and dependency independent package for Tribler, we opted for snap earlier but we find Flatpak equally interesting with its own set of benefits. For us, the priority at the moment is to make a stable 7.4.0 release then we can look into a Flatpak build but we would gladly welcome any contributions toward creating a nice Flatpak package anytime for Tribler 👍

@mehlon
Copy link

mehlon commented Mar 17, 2020

There's also Nix and Guix which are functional package managers, configuration managers and build systems focusing on reproducible builds, you can install them on top of any existing distribution.
Guix has previously been used solely as a build system for reproducibly building Bitcoin bitcoin/bitcoin#15277
There's already a Nix package in the 'unstable' channel which you can install with nix-env -iA nixpkgs.tribler

@gary-host-laptop
Copy link

Commenting to continue to support the idea, since Trible reached version 7.4.0 some time ago. Also, although I think Nix and Guix are good, too, flatpak is much more ubiquitous as of now.

@damnms
Copy link

damnms commented Nov 16, 2020

running fedora, i have no tribler because only a .deb is provided - thats bad :(

@gary-host-laptop
Copy link

It would be nice to have a reply from the maintainers.

@mariusa
Copy link

mariusa commented Feb 27, 2021

+1 for AppImage, to be able to run this on Fedora too

@bam80
Copy link

bam80 commented Feb 27, 2021

For us, the priority at the moment is to make a stable 7.4.0 release then we can look into a Flatpak build

@xoriole Has anything changed since then?

@overflw
Copy link
Contributor

overflw commented Apr 4, 2021

I created a flatpak and could try to submit it to flathub. What do you think about it? Do you have any objections?

@Eonfge
Copy link
Author

Eonfge commented Apr 5, 2021

Hey @overflw

I'm no official maintainer at Flathub, but I can help you prepare for it.

Submission process

  • First, you'll have to fork the flathub/flathub repository and you must make a new branched called org.tribler.Tribler from the new-pr tag. This all sounds a bit weird but Flathub uses Github Actions to trigger builds so some workarounds are required. See the other submission requests here: https://github.com/flathub/flathub/pulls
  • Second, you must explain to the maintainers why you don't compile the package from source. It might be unreasonably complex, but you'll have to mention so in advance because. Some other open source applications, like GIMP or ET Legacy, don't compile from source because of some upstream troubles, but they had to explain so.

File details

  • line 49, you don't need the post-install actions. There are special key-words in the spec: rename-desktop-file and rename-icon. This means that the renames on line 23 are also not necessary. I would recommend using the build-in methods instead so that it's easier to update once Triblr adopts the AppStream Standard.

Example

My latest manifest, so you can see some of these things in action:
https://github.com/flathub/com.etlegacy.ETLegacy/blob/master/com.etlegacy.ETLegacy.yaml

In it, I don't compile from source, I bundle 32bit libraries because of backwards compatibility, and I rename the icon.

@overflw
Copy link
Contributor

overflw commented Apr 5, 2021

Hey @Eonfge (: Thanks for reaching out!

I tried to use the rename-desktop-file key-word but couldn't make it work for my case unfortunately. But at least rename-appdata-file is now used. I'll follow the submission procedure described by you and also here by the flathub floks.
Thanks again for the examples and the hints!

Let's see what they say.

@overflw
Copy link
Contributor

overflw commented Apr 6, 2021

Would somebody from tribler be interested to co-maintain their app on Flathub?

@synctext
Copy link
Member

synctext commented Apr 6, 2021

Yes, great contribution!
At the moment we're still focussed on expanding our user base, privacy, and features.

@overflw
Copy link
Contributor

overflw commented Apr 6, 2021

Cool! I think distributing via flathub should be helpful to expand your user base. So I would propose you @synctext as co-maintainer for the flathub repo? (Including me)

@gary-host-laptop
Copy link

@overflw I agree, a lot of people would start using it if it is on Flathub plus more peoplr would use it if it is easier for them to install.

@overflw
Copy link
Contributor

overflw commented Apr 7, 2021

Using the flatpak, I don't have access to video-streaming, is this normally included in the .deb?

@synctext
Copy link
Member

synctext commented Apr 7, 2021

@xoriole can help as the official Tribler lab member with @overflw for co-maintaining this flathub repo. Big worry from our side is the active campaign to get malware and crypto mining into various software packages. Great to have more options for users to install Tribler. 👍

@overflw
Copy link
Contributor

overflw commented Apr 7, 2021

Thanks for contacting @xoriole - great to have them on board. (Hi there!)

Concerning your worries, it's always good to be vigilant - the flatpak build process is quite transparent and really doesn't do much apart from transferring your .deb into the flatpak file structure.

There is still some work to do with the flatpak, the current state can be followed at the flathub pull request.

@overflw
Copy link
Contributor

overflw commented Apr 7, 2021

I'm having trouble to make triblers streaming capabilities work, apart from that the flatpak does its job. Do you have a pointer what I could be missing? Even on a clean ubuntu20.10 with vlc present, installing tribler via the deb won't give me the streaming options in the gui.
If there is no fix, I would call it a day and propose the flatpak in its current state.

@qstokkink
Copy link
Contributor

@overflw There is no fix, the feature was removed in #5549

@overflw
Copy link
Contributor

overflw commented Apr 8, 2021

flathub/flathub#2236 (comment)
Is there any movement to adopt AppStream metadata for Tribler?

@qstokkink
Copy link
Contributor

If I understand the linked comment correctly, support for AppStream is a single xml file. @overflw is that correct?

In that case, we could simply follow the snap folder structure (Tribler/build/debian/snap/) and put this file in Tribler/build/debian/flatpak/ or Tribler/build/debian/flathub/. @xoriole any objections/suggestions?

@xoriole
Copy link
Contributor

xoriole commented Apr 8, 2021

@overflw Thank you for your contribution. Greatly appreciated 👍
@qstokkink No objections. I agree Tribler/build/debian/flatpak is the right place. Basically the PR content and any related files can go to that directory.

@overflw
Copy link
Contributor

overflw commented Apr 8, 2021

If I understand the linked comment correctly, support for AppStream is a single xml file. @overflw is that correct?

That's how I understand it too. Would be usefull to have the metainfo.xml also in the deb - providing a better integration for software centers like gnome-software ect.

@bam80
Copy link

bam80 commented Apr 8, 2021

the flatpak build process is quite transparent and really doesn't do much apart from transferring your .deb into the flatpak file structure

Is it right way to go? Can't we build it from scratch in flatpak-builder instead?

@Eonfge
Copy link
Author

Eonfge commented Apr 8, 2021

the flatpak build process is quite transparent and really doesn't do much apart from transferring your .deb into the flatpak file structure

Is it right way to go? Can't we build it from scratch in flatpak-builder instead?

It's preferred to build from source, but it's not a hard requirement. I maintain packages who are build from source, and a few who are not.

As for the metainfo.xml, the icons and everything else called org.tribler.Tribler: They are all part of the App Stream standard that is generally respected by all Linux distributions. GNOME Software and KDE Discover both use it for their metadata, application details and age restrictions. If Tribler were to adopt he appstream standard, which means that the existing .desktop, then that would benefit all Linux distributions.

@qstokkink
Copy link
Contributor

@overflw do you want to shoulder the responsibility of turning this into a pull request on our repo?

@overflw
Copy link
Contributor

overflw commented Apr 9, 2021

@overflw do you want to shoulder the responsibility of turning this into a pull request on our repo?

I can look into it, but not before the end of next week unfortunately.

@hraisins
Copy link

hraisins commented Apr 29, 2021

overflw/flathub#1

edit: quick instructions for anyone who wants to give this a go

git clone https://github.com/hraisins/flathub.git tribler-flatpak
cd tribler-flatpak
git checkout org.tribler.Tribler

# Download required sdk, takes a while
flatpak install flathub runtime/org.kde.Sdk/x86_64/5.15
flatpak install flathub org.freedesktop.Sdk.Extension.rust-stable/x86_64/20.08

# Build the flatpak (takes a little over an hour on my 2019-ish laptop)
flatpak-builder --force-clean --repo=repo build org.tribler.Tribler.yaml

flatpak build-bundle repo tribler.flatpak org.tribler.Tribler
flatpak install tribler.flatpak

@overflw
Copy link
Contributor

overflw commented May 10, 2021

At least the deb based version is on flathub now :)
https://flathub.org/apps/details/org.tribler.Tribler

@Dmole
Copy link
Contributor

Dmole commented Jun 12, 2021

On Fedora, Tribler from FlatHub will run, but won't show torrents in the open dialog and will ignore the watch folder. Magnet links work though.

@qstokkink qstokkink removed this from the Backlog milestone Aug 23, 2024
@qstokkink
Copy link
Contributor

Considering Tribler is published to flathub, I guess this issue is now resolved.

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

No branches or pull requests