ubuntu-flutter-community / musicpod

Music, radio, television and podcast player for Ubuntu, Windows, MacOs and maybe soon Android
GNU General Public License v3.0
438 stars 53 forks source link

Release a Flatpak version #10

Closed 12people closed 5 months ago

12people commented 1 year ago

It'd be great to have a Flatpak version of this app as well.

It's relatively simple, though not particularly well documented. Basically, it's just about downloading the app's compiled binaries, potentially also native libraries that the app depends on, and setting the right sandboxing permissions.

This Github repo contains an example project. And, of course, there are various existing Flutter projects on Flathub that can also serve as inspiration. (To see their Flatpak manifest, just click on "See details" under publisher and then, in the Github repo that links to, switch to the "Code" view.)

Feichtmeier commented 1 year ago

hi! I personally have no plans for this (since I am lazy Ubuntu user using snaps which are supported by default) but I have also nothing against it, so PRs are welcome :)

Edit: snap is now in the store https://snapcraft.io/musicpod

12people commented 1 year ago

Great, working on a PR now :)

12people commented 1 year ago

Submitted a pull request here: https://github.com/ubuntu-flutter-community/musicpod/pull/33

It's not a Flatpak, but it's everything required to build one really easily.

The next steps here would be for someone maintaining this repo to build the Flatpak as described in the PR (and also in the README that's part of the PR), upload the binary as a Github release, and then propose the app to Flathub.

Since I'm not the app's author and also don't have access to the Github releases here, I shouldn't be the one doing this. However, I'd be happy to help with the process in any way I can.

12people commented 1 year ago

(I should mention: I wasn't sure which libMPV modules Musicpod uses, so I tried to include the basic ones and audio-related ones. The Flatpak seems to work without a problem, but if anyone here reading this has better insight into the libMPV modules used, let me know. :) )

Feichtmeier commented 1 year ago

Hi @12people !

I have re-read your instructions about how to release and make a flatpak release and this is currently out of scope for me. The snap thing is so easy and I have auto-builds on snapcraft plus I can make a new release and push with two commands. However, since you already made such effort into this, would you eventually help to make the flatpak happen? I would "allow" you to be the uploader of the flatpak if you would like to and have the time for this

12people commented 1 year ago

Hi @Feichtmeier :)

What would that mean in practice? That I would upload the release binaries on a fork of this repo and that would serve as the "official" Flatpak source? And that I would apply for and manage the official Flathub repo, at least for now?

I've been talking to Roland Geider, who has a similar problem with wger, and we're thinking about automating x86_64 Flatpak releases via Github Actions. Would something like that work for you? I think then a Flatpak release would be generated via a single click on Github.

Unfortunately, I'm personally unfamiliar with Github Actions. Roland might implement it for his project, and then I could make a PR based on that; or I might spend some time getting familiar, but I'm not sure when I'd be able to find that time.

So perhaps in the meantime, I could make a Flathub release once in a while manually, and then when the Github Actions workflow is ready, you could take over?

Feichtmeier commented 1 year ago

So perhaps in the meantime, I could make a Flathub release once in a while manually, and then when the Github Actions workflow is ready, you could take over?

Sounds good! But no promise from my side, but I will try if it is not too much effort. Thanks for explaining the context

That I would upload the release binaries on a fork of this repo and that would serve as the "official" Flatpak source? And that I would apply for and manage the official Flathub repo, at least for now?

Does it need to be a second repo?

12people commented 1 year ago

So perhaps in the meantime, I could make a Flathub release once in a while manually, and then when the Github Actions workflow is ready, you could take over?

Sounds good! But no promise from my side, but I will try if it is not too much effort. Thanks for explaining the context

Ok, great! :)

That I would upload the release binaries on a fork of this repo and that would serve as the "official" Flatpak source? And that I would apply for and manage the official Flathub repo, at least for now?

Does it need to be a second repo?

Yes, that's just how Flathub works: every project is assigned a repo to host their Flatpak manifest, and the repo resides under the "flathub" organization (e.g. here).

Feichtmeier commented 1 year ago

@12people hey again 👋

Re-reading your descriptions again. Is there a way to use the commit commit in master as the version for flatpaks? That's how I do it for the snap because I do not need real versions for musicpod Would really like to get this into flathub but damn this is very complicated

12people commented 1 year ago

@Feichtmeier hey!

I have a working Github Actions script for a different project, so what I was describing above can definitely be automated — at least the building part that creates the release. (Haven't automated the Flathub repository side yet, but that should be doable too.)

The problem I see with building a new release for every commit is that you'll quickly have a ton of Github releases, all with separate binaries. (For Flathub, you need to host the binaries, they're not hosted on Flathub directly.)

What would you think about creating a new release whenever you tag a commit in the format "v[0-9]+.[0-9]+.[0-9]+" (e.g. v1.0.0)? That's what I do and it's just two simple git commands to tag a commit and then push the tag.

Feichtmeier commented 1 year ago

this sounds good with the tags. I can do this for flatpaks only so this does not interfer with the snaps

maybe something like "flatpak-0.1" ?

AtiusAmy commented 1 year ago

Seems like things are getting ready (?) I'm excited!

AtiusAmy commented 1 year ago

@Feichtmeier Oh by the way, I'd love to help out if there's anything you want help with :P I absolutely love musicpod!

saulfgonzalez commented 1 year ago

Just here to ask how the progress on this is coming along and express my support for a flatpak port of this app. Probably the best podcast client on linux right now.

12people commented 1 year ago

@saulfgonzalez @AtiusAmy

Unfortunately, I've been really swamped lately and haven't been able to work on this.

However, I feel like the "building a Flatpak" part is basically done, I would just need to test it before submitting a PR.

Would either of you (or anyone else here) be willing to test it? I'm unable to get ACT running on my machine right now, but if you can, then please:

  1. Install ACT
  2. Clone my Musicpod repo fork: git clone https://github.com/12people/musicpod.git
  3. CD into the directory: cd ./musicpod
  4. Run the flatpak github action there. I think the command might be act -j flatpak

If it runs without a problem, then I will submit a pull request for this.

Note: with this set-up, the tags would have the format flatpakX.Y.Z and versions would also be named that way. Is that alright?

AtiusAmy commented 1 year ago

Probably alright to have it named that way

Feichtmeier commented 1 year ago

@12people yes totally okay. Thank you very much!!

Feichtmeier commented 11 months ago

@12people I added two variables for you in line 14 and 16 in constants.dart

you need to add this in line 14 in constants.dart

const kFlatPakDesktopEntry = '.................';

then you need to sed into line 16 and set

const kDesktopEntry = kSnapDesktopEntry;

to

const kDesktopEntry = kFlatPakDesktopEntry;

just as a reminder

cat-master21 commented 10 months ago

Hello @Feichtmeier I have like built a Flatpak using my repo at https://github.com/cat-master21/flathub/tree/org.feichtmeier.Musicpod you can checck out which unlike @12people's solution, does not rely on #33 or any extra scripts while mine uses the Freedesktop Runtime. This does not rely on a binary for Musicpod on GitHub nor build it's own to save time. The only issue with my build is the bottom bar will be white on the first run and will be properly themed after that for some reason (😔). org.feichtmeier.Musicpod.flatpak.zip

Feichtmeier commented 10 months ago

Hello @Feichtmeier I have like built a Flatpak using my repo at https://github.com/cat-master21/flathub/tree/org.feichtmeier.Musicpod you can checck out which unlike @12people's solution, does not rely on #33 or any extra scripts while mine uses the Freedesktop Runtime. This does not rely on a binary for Musicpod on GitHub nor build it's own to save time. The only issue with my build is the bottom bar will be white on the first run and will be properly themed after that for some reason (😔). org.feichtmeier.Musicpod.flatpak.zip

Cool that you are putting time into this

This issue sounds like a general issue... I wonder why this should be specific to flapjack I check later with a fresh snap install or local build

Feichtmeier commented 10 months ago

update, hm not happening in the snap or local build :thinking:

grafik

AtiusAmy commented 10 months ago

Hello @Feichtmeier I have like built a Flatpak using my repo at https://github.com/cat-master21/flathub/tree/org.feichtmeier.Musicpod you can checck out which unlike @12people's solution, does not rely on #33 or any extra scripts while mine uses the Freedesktop Runtime. This does not rely on a binary for Musicpod on GitHub nor build it's own to save time. The only issue with my build is the bottom bar will be white on the first run and will be properly themed after that for some reason (😔). org.feichtmeier.Musicpod.flatpak.zip

Seems to work properly on first run AND dark mode work for me :P (Yes I built it from your repo)

Feichtmeier commented 10 months ago

@cat-master21 the license seems to be wrong in your flatpak repo it is GPL3 for musicpod did you manage to change the desktop file location?

AtiusAmy commented 10 months ago

@cat-master21 the license seems to be wrong in your flatpak repo it is GPL3 for musicpod did you manage to change the desktop file location?

Not to barge into conversations that does not include me but I am gonna do just that, Flatpak manifests are set as LGPL, idk why that is the case but it is what it is

Feichtmeier commented 10 months ago

@cat-master21 the license seems to be wrong in your flatpak repo it is GPL3 for musicpod did you manage to change the desktop file location?

Not to barge into conversations that does not include me but I am gonna do just that, Flatpak manifests are set as LGPL, idk why that is the case but it is what it is

Okay, I don't mind what's happening for flatbread but I really want it to be clear that the source code is GPL3. Don't know what mechanisms are available there for flat Pak

AtiusAmy commented 10 months ago

@cat-master21 the license seems to be wrong in your flatpak repo it is GPL3 for musicpod did you manage to change the desktop file location?

Not to barge into conversations that does not include me but I am gonna do just that, Flatpak manifests are set as LGPL, idk why that is the case but it is what it is

Okay, I don't mind what's happening for flatbread but I really want it to be clear that the source code is GPL3. Don't know what mechanisms are available there for flat Pak

Ohhh I misunderstood you sorry! You meant in the metainfo.xml :P

cat-master21 commented 10 months ago

Sorry for the late response, @Feichtmeier & @AtiusAmy so first off, I did some testing with the issue I was having and it looks like it was an issue with my wierd theming (I have had this issue in the past :cry:) and tried it on Arch and worked so it looks like that was not an issue fortunately. Now for Feichtmeier's question, the License was from #33 at https://github.com/ubuntu-flutter-community/musicpod/blob/main/flatpak/org.feichtmeier.Musicpod.appdata.xml where my metadata is based from so I have no idea why that was set to MPL-3.0 but is corrected now.

HEx-404 commented 7 months ago

Hey, just wanted to know how the progress on making a flatpak release is going on, seems like there has been no activity lately, is the flatpak release still going to happen or is it cancelled?

Feichtmeier commented 7 months ago

Hey, just wanted to know how the progress on making a flatpak release is going on, seems like there has been no activity lately, is the flatpak release still going to happen or is it cancelled?

I didnt cancel anything :) I am focusing on developing the app though and not to investigate into flatpak packaging. I am grateful for the contributions so far, but it looks like there are still steps needed. So the currently only package I as the creator of the app support from my side is the snap package, which works perfectly fine on Ubuntu. Let's see if the other flatpak contributors succeed, I never had anything against this and am open to other formats as long as I don't have to maintain those packages

AtiusAmy commented 7 months ago

I think that the scrip that @cat-master21 made works very well, I wonder how the progress has been in submitting it to Flathub?

Feichtmeier commented 7 months ago

I am currently on it following @12people instructions and using his builder

I have to say, without wanting to offend anyone, this flatpak workflow is really the weirdest stuff I could come up with. (i mean flathub, not 12people script) Snap/snapstore is just like docker/dockerhub and super straight forward, easy, reliable and most importantly can be automated as a continuous deployment!

Let's hope for the flatpak fans I succeed. I have really no idea why people favor platpaks, I makes 0 sense for me :laughing: Anyways.. here is the TEST PR

https://github.com/ubuntu-flutter-community/flathub/pull/1

for this release

https://github.com/ubuntu-flutter-community/musicpod/releases/tag/1.2.0

Uploaded the binaries made with the dart script (thank you)

(will close it in our org and ofc create a new PR in flat land if this is correct)

Feichtmeier commented 7 months ago

here it is https://github.com/flathub/flathub/pull/5048

now using the manifest from @cat-master21

Feichtmeier commented 7 months ago

@cat-master21 I got a review

The reviewer says I am not allowed to use "--socket=system-bus", Why did you add it? I mean for which feature

It needs dbus access and internet ofc

Feichtmeier commented 7 months ago

Hey guys Starting a new job soon IRL and I'll need to focus on my top open source priorities in my free time I won't be able to support flatpak as I'm not willing to release MusicPod in an untested and potentially broken state as I love this app too much. I didn't test any feature of the flatpak as I'm personally not interested in the package format, even though as multiple times stated, have nothing against flatpaks existence

As you can see from the timeline of this issue, it's certainly not easy.

The snap works, it's the default app format on Ubuntu, I've tested every feature thoroughly and feel very confident with the released artifact.

Long story short, MusicPod won't have an official flatpak, at least not one I support unless I see a contribution that is 100% bullet proof.

Closing this issue and also the pull request on flathub. If you want MusicPod on Linux, install snapd

https://snapcraft.io/docs/installing-snap-on-fedora

https://snapcraft.io/docs/installing-snap-on-arch-linux

Feichtmeier commented 7 months ago

@TheShadowOfHassen

Here you go, ask your questions :)

TheShadowOfHassen commented 7 months ago

So, um. You say in your flatpak readme the first step is : 1. Build the Linux release using Flutter.

How do you do that? I can't find the instructions how to do it.

12people commented 7 months ago

@TheShadowOfHassen I'm the one who wrote that README. Unfortunately, I'm extremely busy lately and haven't been able to find the time for this at all in the past few months. I also haven't built the project in the last few months.

That said, here's how to get started with Flutter on Linux: https://docs.flutter.dev/get-started/install/linux/desktop .

Go through that, maybe first build a new example project just to see how that's done, and then try to build the release version of MusicPod.


After you're acquainted with building a Flutter app and try to build MusicPod, you might run into some problems with missing dependencies, non-generated translations, or missing autogenerated files.

For the latter two, try running flutter pub get && dart run build_runner build --delete-conflicting-outputs && flutter gen-l10n

For missing dependencies, the error messages will usually point you to the right place. You will definitely need to install the Linux libraries for the media_kit library — see https://pub.dev/packages/media_kit#gnulinux . There might be other libraries from pubspec.yaml that have their own dependency. (If all else fails, I suppose you could go item by item in pubspec.yaml, find it on the pub.dev website, and see if it has some Linux libraries that it requires — though I think that's the least efficient method of finding dependencies. Hopefully the command line error messages will suffice.)

TheShadowOfHassen commented 7 months ago

Ok, thanks!

I'm going to do some investigation, but I think honestly, if we want to have this work on Linux systems without snap we should just make a standalone binary, then a flatpak would be as easy as running the binary.

12people commented 7 months ago

@TheShadowOfHassen That's what the initial intention with my pull request was. It's not quite as simple — you need to have the correct release info in the metadata and there are still extra permissions and dependencies you need to install via the Flatpak build script (such as the requisite media player libraries).

That said, with the work that's been done so far, it shouldn't be too hard to polish and release it, if you can find the time for that.

TheShadowOfHassen commented 7 months ago

Yes, however my thought was to set up an automated script, so every time musicpod has an update, a standalone package for linux would be created like the packages for windows and macOS.

TheShadowOfHassen commented 7 months ago

OK so I'm building the app and I've gotten back to this error: ninja: error: 'mimalloc/out/release/mimalloc.o', needed by 'intermediates_do_not_run/musicpod', missing and no known rule to make it

Does anyone know what this error means? /How to fix it. If not, I can ask on Stack Exchange, but It looks like it's something wrong with the build script not a dependency error.

12people commented 7 months ago

@TheShadowOfHassen Just checking: did you install the needed Flutter dependencies?

sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
sudo apt-get install \
      clang cmake git \
      ninja-build pkg-config \
      libgtk-3-dev liblzma-dev \
      libstdc++-12-dev

(This might not be it, it's just the first thing that came to my mind.)

Also, are you building on an x86_64 machine?

TheShadowOfHassen commented 7 months ago

I'm building on an X86_64, machine, but I have the snap flutter installed, that might have something to do about it...

I'll switch to normal flutter.

TheShadowOfHassen commented 6 months ago

Ok, it will build and run.

I think the next step would be resolving this link: https://github.com/flathub/flathub/pull/5048#discussion_r1523774892

@Feichtmeier , would you be willing to make one of the changes? Either would do. Once we get that resolve, I'll test every inch of the program.

TheShadowOfHassen commented 6 months ago

Hang on. I think there might be a better way than @Feichtmeier had set up. I need to investigate.

TheShadowOfHassen commented 6 months ago

OK. So Yeah, the best way to do this would be to parrot, the flathub repo I know which is this: https://github.com/flathub/com.shatteredpixel.shatteredpixeldungeon.

I think the next ting that needs to be done is to get that app thing resolved in this comment: https://github.com/flathub/flathub/pull/5048#discussion_r1523774892

Then It'd be easy enough, I think, to apply it to flathub, and then every major release, change the file in the flathub: (that's what I do with Shattered Pixel Dungeon.)

(I'm assuming that's what @12people 's plan was.

So. @12people, your flatpak dart scripts, works, what exactly was that supposed to do?

12people commented 6 months ago

@TheShadowOfHassen I don't understand what you mean by "better way". How is your way better or even different from what has been set up in Feichtmeier's pull request?

Your example simply pulls Java, xrandr, and a JAR file and installs those. Feichtmeier's way pulls in some required dependencies and the pre-compiled snap and installs those.

As for my plan, it was to set up the Flatpak and then automate its generation via a Github Actions script. That's what the original Dart scripts were for — one for generating the AppStream file and compressing it along with the app's binary into an archive, another for generating the requisite Flathub files.

I originally planned it to build independently without relying on the compiled Snap packages, but I guess relying on those isn't necessarily a bad idea.

TheShadowOfHassen commented 6 months ago

@TheShadowOfHassen I don't understand what you mean by "better way". How is your way better or even different from what has been set up in Feichtmeier's pull request?

Your example simply pulls Java, xrandr, and a JAR file and installs those. Feichtmeier's way pulls in some required dependencies and the pre-compiled snap and installs those.

As for my plan, it was to set up the Flatpak and then automate its generation via a Github Actions script. That's what the original Dart scripts were for — one for generating the AppStream file and compressing it along with the app's binary into an archive, another for generating the requisite Flathub files.

I originally planned it to build independently without relying on the compiled Snap packages, but I guess relying on those isn't necessarily a bad idea.

I was originally planning to, manually, run the flatpak, like I do with the other one. However, if the Snap method is already working, I am happy to just sit back and test that build.

TheShadowOfHassen commented 6 months ago

Ok it looks like the current addition to flathub is working, just one more change!

Feichtmeier commented 6 months ago

@TheShadowOfHassen if your are willing to help with the flatpak permanently you can ofc do it here. It's just that all contributors for flatpak couldn't commit permanently (which is not an accusation, and I am grateful for the interest nonetheless) and I couldn't see that they tested all features