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

feat(packaging): flatpak #359

Merged

Conversation

GeopJr
Copy link
Contributor

@GeopJr GeopJr commented Apr 24, 2023

fix: #283

⚠️ I haven't tested everything in Kaiteki (and the weekly workflow)

  • I filled in the metainfo file but I might be missing or used incorrect info
  • The metainfo file needs to be updated on every release (when Kaiteki gets stable releases)
  • I couldn't get it to work on non-x11/xwayland, might need more investigation (the permissions are commented out)
  • Hive's default location is under ~/Documents/ which is not possible in the flatpak so I added a workaround so it uses .local (which tbh should be the default for non-flatpak too, but for another PR)

⚠️ This is only for local usage - not for Flathub!

To build it locally use: flatpak-builder ./build ./packaging/linux/moe.craftplacer.kaiteki.yaml --force-clean --install --user --install-deps-from=flathub (! it needs you to have built Kaiteki already)

Flathub requires "stable" sources, perhaps adding the icons, .desktop, metainfo to linux.zip for easier maintainability?

@Craftplacer Craftplacer added platform:linux This issue targets Linux-only area:packaging Issues related to packaging for platforms labels Apr 24, 2023
@Craftplacer
Copy link
Member

Kaiteki's Linux embedding code was generated when Flutter didn't support Wayland yet. From a bit of research, it seems like that Flutter now has support for it. Check out the diff from flutter/flutter#66519 on how to remove the X11-restriction.

Co-authored-by: Robert Ancell <robert.ancell@canonical.com>
@GeopJr
Copy link
Contributor Author

GeopJr commented Apr 24, 2023

Fixed, thanks!

Screencast.from.2023-04-24.23-55-04.webm

@GeopJr
Copy link
Contributor Author

GeopJr commented Apr 28, 2023

I went ahead and updated all linux native files. I think this is pretty much ready, all that's left is:

  • Test that everything works as expected (especially anything involving files, devices (like webcams) and audio)
  • Confirm that everything in the metainfo file is correct
  • Confirm that the actions work as expected (the flatpak action automatically uploads the artifact, I am not sure if the wildcard works on the weekly one)
  • Choose the way to distribute the meta files (icons, .desktop etc): Either keep it as is - however (for the flatpak) they will have to be locked to their hash (and need to also be bumped on changes) or add them to the linux artifact/release. In that case, we'll have to consider where to place them in the artifact (root, assets, /share/<path>/ etc) and remove it from the appimage job.
The Flathub flatpak config will look something like this:
app-id: moe.craftplacer.kaiteki
runtime: org.freedesktop.Platform
runtime-version: "22.08"
sdk: org.freedesktop.Sdk
command: moe.craftplacer.kaiteki
separate-locales: false
rename-icon: kaiteki
rename-desktop-file: kaiteki.desktop
rename-appdata-file: kaiteki.metainfo.xml
finish-args:
  - --device=dri
  - --share=ipc
  - --share=network
  - --socket=pulseaudio
  - --socket=fallback-x11
  - --socket=wayland
modules:
  - name: kaiteki
    buildsystem: simple
    build-commands:
      - mv kaiteki $FLATPAK_DEST/kaiteki/
      - chmod +x $FLATPAK_DEST/kaiteki/kaiteki
      - mkdir $FLATPAK_DEST/bin
      - ln -s $FLATPAK_DEST/kaiteki/kaiteki $FLATPAK_DEST/bin/$FLATPAK_ID
      - desktop-file-edit --set-icon=$FLATPAK_ID kaiteki.desktop
      - desktop-file-edit --set-key=Exec --set-value="$FLATPAK_ID %U" kaiteki.desktop
      - install -Dm644 kaiteki.desktop $FLATPAK_DEST/share/applications/kaiteki.desktop
      - install -Dm644 kaiteki.metainfo.xml $FLATPAK_DEST/share/metainfo/kaiteki.metainfo.xml
      - install -Dm644 kaiteki-color.svg $FLATPAK_DEST/share/icons/hicolor/scalable/apps/kaiteki.svg
      - install -Dm644 kaiteki-symbolic.svg $FLATPAK_DEST/share/icons/hicolor/symbolic/apps/kaiteki-symbolic.svg
    sources:
      - type: archive
        url: https://github.com/Kaiteki-Fedi/Kaiteki/releases/download/weekly-2023-15/linux.zip
        sha256: a8fd8cd9fa1a9fb1bb946bbc2c402c87965cc1d67a96d2a8a3b45b5621ffeda1
        x-checker-data:
          type: json
          # These need to adapt to /releases/latest when stable releases are ready
          url: https://api.github.com/repos/Kaiteki-Fedi/Kaiteki/releases
          version-query: first | .tag_name
          url-query: first | .assets[] | select(.name=="linux.zip") | .browser_download_url
          is-main-source: true
      - type: file
        url: https://raw.githubusercontent.com/Kaiteki-Fedi/Kaiteki/5c8d0a868d3223b0cae8a280f381f739c2e12275/packaging/linux/kaiteki-color.svg
        sha256: d7f42e77af6a727b05be806165db315b23c7fa84fb9c766fa14dd46c06658b9e
      - type: file
        url: https://raw.githubusercontent.com/Kaiteki-Fedi/Kaiteki/5c8d0a868d3223b0cae8a280f381f739c2e12275/packaging/linux/kaiteki-symbolic.svg
        sha256: e2c42608881d846cea66e24fb5a91c675eaf3029b6e74aebb72b9042ad49daa5
      - type: file
        url: https://raw.githubusercontent.com/Kaiteki-Fedi/Kaiteki/5c8d0a868d3223b0cae8a280f381f739c2e12275/packaging/linux/kaiteki.metainfo.xml
        sha256: 619db1437d6cc6d48017148002a7de6b3578d4eba6bdfa5e020c4096d7185dfd
      - type: file
        url: https://raw.githubusercontent.com/Kaiteki-Fedi/Kaiteki/5c8d0a868d3223b0cae8a280f381f739c2e12275/packaging/linux/kaiteki.desktop
        sha256: 959325bcb59acd11f8ae7c629949e2c2a14b20d987bd4a5eef3eb4a93e552ff4

Depending on what we go with, some stuff will change. x-checker-data is used by the flathub bot to automatically check if there are new releases (or asset updates) and open PRs bumping them

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2023

Codecov Report

Merging #359 (90bd6d9) into master (41b2538) will increase coverage by 9.20%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #359      +/-   ##
=========================================
+ Coverage        0   9.20%   +9.20%     
=========================================
  Files           0     376     +376     
  Lines           0   12938   +12938     
=========================================
+ Hits            0    1191    +1191     
- Misses          0   11747   +11747     

see 376 files with indirect coverage changes

@Craftplacer Craftplacer marked this pull request as ready for review November 1, 2023 18:14
@Craftplacer Craftplacer self-requested a review as a code owner November 1, 2023 18:15
@Craftplacer Craftplacer merged commit 1bf304d into Kaiteki-Fedi:master Nov 1, 2023
10 checks passed
@GeopJr
Copy link
Contributor Author

GeopJr commented Nov 1, 2023

Sorry for the inactivity! 🙇

@GeopJr GeopJr deleted the feat/packaging/flatpak branch November 1, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:packaging Issues related to packaging for platforms platform:linux This issue targets Linux-only
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Create a Flatpak
3 participants