BasioMeusPuga / Lector

Qt based ebook reader
GNU General Public License v3.0
1.51k stars 207 forks source link

Provide a Flatpak #5

Open ghost opened 6 years ago

ghost commented 6 years ago

It would be nice if there would be a Flatpak available, there are already many programs that were submitted to Flathub (https://github.com/flathub/flathub/pulls), so I'd suggest to submit it to Flathub.

BasioMeusPuga commented 6 years ago

I'll keep this in mind. Could you summarize flathub to me? Is it a build service or a repo or something similar?

ghost commented 6 years ago

It's primary a repo for Flatpaks, but if you add a package you need to provide a Flatpak Builder manifest, so that it can be deterministically built (http://docs.flatpak.org/en/latest/manifests.html). The bot then makes the Flatpak. At best you try to make a Flatpak locally and then submit the manifest. There are already quite many apps available: https://flathub.org/apps/ The advantage of Flatpaks is that they can run on any Linux distro that provides a flatpak package, they also provide isolation if made correctly.

BasioMeusPuga commented 6 years ago

This is very likely due to the setup.py reporting version information the way it does. I've since removed version checks from it.

Having said that, I'm a little out of my depth as far as Flatpaks go. I've been reading up and I think I understand the basics - enough to get this to start compiling, anyway. Thing is, it's taking really long and it's also compiling a lot of Qt modules I've no requirement of. Also, the manifest does not currently include references to poppler-qt5, and python-poppler-qt5. Those are needed for pdf support.

adityashah1212 commented 6 years ago

I don't think there is any need to compile qt as it should be present as a part of KDE SDK and Platform. The other dependancies are just python so there is not need to compile them anyway, you could just download them from a fixed url and untar them. If you need any help let me know, I may be able to help.

BasioMeusPuga commented 6 years ago

Maybe that came out incorrectly. Yes, Qt is part of the KDE runtime. The compilation was for the PyQt bindings. That would be the .sip files in the PyQt5 tar mentioned above. I wonder if there's a flag to be set somewhere about which bindings to leave out.

This is important since I'm told Flathub requires software to be "stable" before being uploaded there. We are quite some way from that.

adityashah1212 commented 6 years ago

No it doesn't exactly have to be stable, the way to say it is that it has to be reproducible. Something like a release or a commit should be fine. You can't use something like master though.

BasioMeusPuga commented 6 years ago

I'm afraid I'm not having much luck with this. If someone wants to help write a working manifest, well, beer is on me.

BasioMeusPuga commented 6 years ago

I've made some progress with this. Using https://pastebin.com/5PGZnMVm < this manifest, I get a running application. With the following caveats:

ghost commented 6 years ago

python-poppler-qt5 does not compile. It errors out with sip: Unable to find file "QtCore/QtCoremod.sip". This means no pdf support.

Not sure, on how to solve that. But a great way of trying to find a solution is too search the Flathub repos. For example: https://github.com/search?utf8=%E2%9C%93&q=org%3Aflathub+poppler&type=Code From that you can see on how other people added dependencies, so a great way of adding dependencies is just to copy these, as a template. For example: https://github.com/flathub/org.gnome.Evince/blob/8ca06821591b4cfdf52a5c9192067bed69f21c0c/org.gnome.Evince.json#L58 Which might help you in solving that. It sadly doesn't seem nobody has used python-poppler-qt5 dependency.

The application does not have filesystem access. There is a --filesystem=host in the manifest.

But this means that it would have full access to the FS, wouldn't it? See: http://docs.flatpak.org/en/latest/sandbox-permissions.html#filesystem-access From that: --filesystem=host - access all files on the host

The application swells to ~212 MB in size. This may be because I've had to include Python 3.6 since the 3.5 ostensibly included in the KDE SDK(?) runtime is at 3.5

You can run specific commands at startup when you start a Flatpak, so to run sh for the SDK itself use: flatpak run flatpak run --command=sh org.kde.Platform/x86_64/5.10. This allows you to see what is is included in a Flatpak, and it seems you're right it doesn't seem to include a Python 3.6 interpreter.

adityashah1212 commented 6 years ago

The application does not have filesystem access. There is a --filesystem=host in the manifest. I don't know why it needs access to the entire fielsystem, but you should be able make it read-only if it absolutely necessary. Though I would say it is better way to avoid that.

Also do you absolutely need python 3.6, won't python 3.5 work. If so then you will have to compile python 3.6 as a part of the application. Also to add to what @Hyleus said about browsing the files, you should be able to look at how the /app directory would look like by browsing the directory that you give a parameter to flatpak-builder. The simple guide line to reduce the size would be to delete any doc related files, any headers and binaries provided as addons not needed by your app.

ghost commented 6 years ago

I don't know why it needs access to the entire fielsystem, but you should be able make it read-only if it absolutely necessary. Though I would say it is better way to avoid that.

For example what if I have a drive mounted over NFS or Samba? Or for example I access an other drive which isn't my main drive, so imo allowing access to the whole FS would maybe the right choice here in this case.