hongquan / CoBang

A QR code scanner desktop app for Linux
GNU General Public License v3.0
253 stars 26 forks source link

Package it as a Flatpak #6

Closed nils2614 closed 4 years ago

nils2614 commented 4 years ago

I really like this project and that it's a native GTK app without a dependency on X. Sadly I'm not on Ubuntu and I understand that I'd be too big of a hassle to package it for all the relevant distros out there. So could you package it as a Flatpak besides a native Ubuntu package please? That way all the people on the many distros that support Flatpak out of the box could easily find it in their software centers. That would also make it work on Silverblue :D

hongquan commented 4 years ago

@nilsoffermann I have never used Flatpak-distributed app before. But I will try to learn and package it at the weekend.

nils2614 commented 4 years ago

Yes that'd be awesome! :D There's some good documentation over here

jeteokeeffe commented 4 years ago

I was going to flatpak this up but I couldn't get this working without a flatpak on Fedora 32.

So, maybe I'll save you some time with parts of flatpak manifest already built. believe the python pip dependency is complete, maybe you want to restrict on pip versions (the dependency generator doesn't support poetry).

cat com.github.hongquan.CoBang.json
{
    "app-id": "com.github.hongquan.cobang",
    "runtime": "org.gnome.Platform",
    "runtime-version": "3.36",
    "sdk": "org.gnome.Sdk",
    "command": "cobang",
    "finish-args": [
        "--socket=wayland"
    ],
    "modules": [
        {
            "name": "cobang",
            "sources": [
                "cobang-deps.json",
                {
                    "type": "github",
                    "url": "https://github.com/hongquan/CoBang.git",
                    "commit": "c491f6b4b6cec1fd3080bfc6fe9913bc63284ee9"
                }
            ]
        }
    ]
}

1) Command will build the python dependencies 2) Command will build the flatpak

https://github.com/flatpak/flatpak-builder-tools/tree/master/pip

python flatpak-pip-generator \
    pycairo \
    regex \
    pygobject \
    toml \
    typed-ast \
    wcwidth \
    black \
    logbook \
    pygobject-stubs \
    pytest \
    single-version \
    zbar-py \
    --output cobang-deps

flatpak-builder --force-clean --user --install --install-deps-from=flathub flatpak-build com.github.hongquan.CoBang.json
hongquan commented 4 years ago

Thanks, I'm trying to Flatpak, too. But it turns out that it has some disadvantage:

lightonflux commented 4 years ago

The Python version is limited by the Sdk provided by Flatpak.

Which SDK and version are you referring to?

hongquan commented 4 years ago

@lightonflux I use the latest one. Here are what in my machine:

❯ flatpak list
Name                                                   Application ID                                  Version            Branch            Installation
Foliate                                                com.github.johnfactotum.Foliate                 2.2.0              stable            system
default                                                org.freedesktop.Platform.GL.default                                19.08             system
Intel                                                  org.freedesktop.Platform.VAAPI.Intel                               19.08             system
openh264                                               org.freedesktop.Platform.openh264                                  2.0               system
Fractal                                                org.gnome.Fractal                               4.2.2              stable            system
GNOME Application Platform version 3.36                org.gnome.Platform                                                 3.36              system
GNOME Software Development Kit version 3.36            org.gnome.Sdk                                                      3.36              system
Yaru Gtk Theme                                         org.gtk.Gtk3theme.Yaru                                             3.22              system

Now it is possible to build as Flatpak from the source folder. Please checkout master branch of today, then run:

flatpak-builder _build --force-clean vn.hoabinh.quan.CoBang.yaml

to build.

To test, run:

flatpak-builder --run _build vn.hoabinh.quan.CoBang.yaml cobang

I haven't published to FlatHub yet.

hongquan commented 4 years ago

The Flatpak build script is not working if I am running it in an separate, empty folder (when testing before app submission). That is why it is not published to FlatHub yet.

hongquan commented 4 years ago

Submitting app to FlatHub: https://github.com/flathub/flathub/pull/1565

hongquan commented 4 years ago

After so many effort, CoBang is already published to FlatHub: https://github.com/flathub/vn.hoabinh.quan.CoBang

Release v0.4.0 is being built and should be available soon.