ubuntu-flutter-community / musicpod

Music, radio, television and podcast player for Ubuntu, Windows, MacOs and Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Release a Flatpak version

12people opened this issue Β· comments

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.)

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

Great, working on a PR now :)

Submitted a pull request here: #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.

(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. :) )

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

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?

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?

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).

@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

@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.

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" ?

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

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

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.

@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?

Probably alright to have it named that way

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

@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

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

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

update, hm not happening in the snap or local build πŸ€”

grafik

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)

@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?

@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

@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

@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

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 😒) 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.

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?

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

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

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 πŸ˜† Anyways.. here is the TEST PR

ubuntu-flutter-community/flathub#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)

here it is flathub/flathub#5048

now using the manifest from @cat-master21

@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

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

@TheShadowOfHassen

Here you go, ask your questions :)

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.

@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.)

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.

@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.

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.

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.

@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?

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.

Ok, it will build and run.

I think the next step would be resolving this link: flathub/flathub#5048 (comment)

@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.

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

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: flathub/flathub#5048 (comment)

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?

@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 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.

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

@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

I'd be willing to help update and maintain it, it's just that my knowledge of flatpak manifest is just very basic :p

(Though maintaining it shouldn't be too hard because it's just updating the snap source and testing if it works)

@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

I'm willing to help test and get the grunt work done. Especially since the smarter people have done the work to set it up.

Update:

I think the snap method is currently not the best way. Partly because it's currently not working and partly because when we do get it to work, there is no easy way of obtaining a snap URL, so it's going to be difficult to update.

So I'm going to try to do something similar @12people's way. Unfortunately, there's a problem (that incidentally, we would have discovered using the snap method.) Musicpod/flutter is very choosy with the versions of mpv it uses, and we need mpv 0.37.0 instead of mpv 0.35.1 in order for it to work. Unfortunately, 0.37.0 has different dependencies than the earlier versions of mpv. I can try to figure out how to do it, but i'm a newbie when it comes to packaging/ dependencies, and complex flatpak complication stuff is a little bit over my head. @12people or @cat-master21, It's obvious with your cool manifests that you know how this stuff works, if either of you are still interested in this, a little help would make this a lot faster (anyone who knows this could help too.)

I just need a .json flatpak ref to get the specific version of mpv and then unless something really crazy happens, everything should work.

So @TheShadowOfHassen The Snap URL automaticly, see Spotify Flatpak being updated this way and there is a waya to do so, not that you would care. I will see what DBus interface is needed per flathub/flathub#5048 (comment) either way it is our choice just wanted to let you know.

Update to the update. I was bored, and I messed with the snap way, and apparently it doesn't need the strange exact same .mpv that the other version seemed to work. The snap-flatpak worked flawlessly, with a few changes.

Also, I figured out a way to pull the URL from stable which is why I think it worked.

I'm not 100% sure why it worked, but it did. It didn't need even the session bus.

@cat-master21, I'm not against using the snap seeing that now I figured out how it worked. (Could've just been a me problem) . The Mpv thing is kind of weird, but I think that's something to do with how cannonical does snaps and so if @Feichtmeier just wants to do this we can.

I wasn't trying to be mean not choosing your version, just the other way was making more sense at the moment.

@cat-master21 Do you want me to upload the changed, yet very similar, to your own flatpak manifest so you can verify it works?

@cat-master21, I'm not against using the snap seeing that now I figured out how it worked. (Could've just been a me problem) . The Mpv thing is kind of weird, but I think that's something to do with how cannonical does snaps and so if @Feichtmeier just wants to do this we can.

I wasn't trying to be mean not choosing your version, just the other way was making more sense at the moment.

I personally don't mind any of the solutions when the result is a properly working musicpod :) its up to you all how to do it

Then my current thought is snap (because it's working currently.) We need this manifest: https://github.com/TheShadowOfHassen/flathub-muspod/blob/master/org.feichtmeier.Musicpod.json

Just replace the one in the flatpak pr with that one, and I'll do one last round of testing. After that it should be good, hopefully.

Then my current thought is snap (because it's working currently.) We need this manifest: https://github.com/TheShadowOfHassen/flathub-muspod/blob/master/org.feichtmeier.Musicpod.json

Just replace the one in the flatpak pr with that one, and I'll do one last round of testing. After that it should be good, hopefully.

done :)

The flatpak is up, it's still unverified but this issue I think can be closed:

https://flathub.org/apps/org.feichtmeier.Musicpod

Thanks @TheShadowOfHassen , @cat-master21 and @12people for your work!

I will see that I fix the verification in the next days! :) spread the word and let people test it