feat: build flatpak from source - #608
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe Flatpak packaging flow now uses ChangesFlatpak packaging
Sequence Diagram(s)sequenceDiagram
participant BuildScript
participant FlatpakManifest
participant OfflineSources
BuildScript->>FlatpakManifest: Build moe.kopuz.kopuz
FlatpakManifest->>OfflineSources: Resolve Cargo, pnpm, CLI, native, and rusty_v8 sources
OfflineSources-->>FlatpakManifest: Provide verified archives and metadata
FlatpakManifest-->>BuildScript: Produce the Flatpak bundle
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
packaging/flatpak/generate-sources.sh (1)
12-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider cleaning up the temporary workdir and pinning tool versions.
WORKDIRis created withmktemp -dbut never removed, andpip install pipx,pipx install git+..., andpip install flatpak-cargo-generatorall install unpinned, latest versions of third-party tooling. This does not break functionality, but it leaves stray temp directories behind and makes source regeneration less reproducible across runs.♻️ Suggested WORKDIR cleanup
WORKDIR="$(mktemp -d -t kopuz-flatpak-XXXXXX)" +trap 'rm -rf "$WORKDIR"' EXIT cd "$WORKDIR"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packaging/flatpak/generate-sources.sh` around lines 12 - 27, Update the setup flow in generate-sources.sh to register cleanup for WORKDIR on exit, and pin explicit versions for pipx, flatpak-builder-tools, and flatpak-cargo-generator in their respective installation commands. Preserve the existing virtualenv activation and source-generation behavior while making repeated runs clean and reproducible.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packaging/flatpak/dioxus-cli.json`:
- Around line 1-16: Update both archive URLs in the Flatpak manifest to pin
Dioxus CLI version v0.7.9, matching the vendored crates and the release
workflow’s cargo install dioxus-cli@0.7.9 contract. Recalculate and replace each
corresponding sha256 checksum for the v0.7.9 x86_64 and aarch64 archives,
leaving architecture mappings unchanged.
In `@packaging/flatpak/generate-sources.sh`:
- Around line 57-92: Add a validation step in generate-sources.sh after
generating or copying the source manifests that compares the v8 crate version in
cargo-sources.json with the pinned rusty_v8 version recorded in librusty.json,
and fail with a clear error when they differ. Keep the existing pinned-source
workflow intact while ensuring future Cargo.lock updates cannot silently leave
the manifests out of sync.
- Around line 31-55: Update the release lookup in the source-generation script
so it fetches the pinned Dioxus CLI version 0.7.9, matching the version used by
the CI cargo install command and Cargo.lock, instead of resolving the GitHub
“latest” release. Preserve the existing architecture-specific asset selection,
URL extraction, digest handling, and JSON generation.
In `@packaging/flatpak/librusty.json`:
- Around line 1-16: Update the aarch64 file entry in the manifest, identified by
its aarch64 URL and only-arches value, to use SHA-256 checksum
beefe7b35abee77159f7cb55096666b07630c11047d5f3a74dd065863729915a; leave the
x86_64 checksum unchanged.
In `@packaging/flatpak/moe.kopuz.kopuz.json`:
- Around line 55-60: Update the Flatpak manifest’s desktop, metainfo, and icon
install destinations to use the moe.kopuz.kopuz IDs, and update the
corresponding source desktop and metainfo declarations and filenames to match.
Ensure all installed artifacts use moe.kopuz.kopuz.desktop,
moe.kopuz.kopuz.metainfo.xml, and moe.kopuz.kopuz.png consistently with the
manifest app-id.
- Around line 7-10: Update the Flatpak build-options configuration to match the
declared org.freedesktop.Sdk.Extension.node24 extension: change append-path to
/usr/lib/sdk/node24/bin and set npm_config_nodedir to /usr/lib/sdk/node24,
replacing the node22 references.
---
Nitpick comments:
In `@packaging/flatpak/generate-sources.sh`:
- Around line 12-27: Update the setup flow in generate-sources.sh to register
cleanup for WORKDIR on exit, and pin explicit versions for pipx,
flatpak-builder-tools, and flatpak-cargo-generator in their respective
installation commands. Preserve the existing virtualenv activation and
source-generation behavior while making repeated runs clean and reproducible.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 21bff765-11e9-420b-ad75-4849bceddbb7
📒 Files selected for processing (9)
packaging/flatpak/build-flatpak.shpackaging/flatpak/cargo-sources.jsonpackaging/flatpak/com.temidaradev.kopuz.jsonpackaging/flatpak/dioxus-cli.jsonpackaging/flatpak/generate-sources.shpackaging/flatpak/librusty.jsonpackaging/flatpak/moe.kopuz.kopuz.jsonpackaging/flatpak/native-modules.jsonpackaging/flatpak/pnpm-sources.json
💤 Files with no reviewable changes (1)
- packaging/flatpak/com.temidaradev.kopuz.json
| [ | ||
| { | ||
| "type": "file", | ||
| "url": "https://github.com/denoland/rusty_v8/releases/download/v130.0.7/librusty_v8_release_x86_64-unknown-linux-gnu.a.gz", | ||
| "sha256": "a6476cb94e9b0247081c465424eb793d77732b8db80848132d78cbb50f34b75d", | ||
| "dest-filename": "librusty.a.gz", | ||
| "only-arches": ["x86_64"] | ||
| }, | ||
| { | ||
| "type": "file", | ||
| "url": "https://github.com/denoland/rusty_v8/releases/download/v130.0.7/librusty_v8_release_aarch64-unknown-linux-gnu.a.gz", | ||
| "sha256": "a6476cb94e9b0247081c465424eb793d77732b8db80848132d78cbb50f34b75d", | ||
| "dest-filename": "librusty.a.gz", | ||
| "only-arches": ["aarch64"] | ||
| } | ||
| ] |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Confirm the correct sha256 for both rusty_v8 v130.0.7 release archives.
curl -sL "https://github.com/denoland/rusty_v8/releases/download/v130.0.7/librusty_v8_release_x86_64-unknown-linux-gnu.a.gz" | sha256sum
curl -sL "https://github.com/denoland/rusty_v8/releases/download/v130.0.7/librusty_v8_release_aarch64-unknown-linux-gnu.a.gz" | sha256sumRepository: Kopuz-org/kopuz
Length of output: 289
Fix the aarch64 archive checksum.
The x86_64 and aarch64 downloadable files are different, but the manifest currently assigns them the same SHA-256 value. Set the aarch64 entry to beefe7b35abee77159f7cb55096666b07630c11047d5f3a74dd065863729915a so flatpak-builder can verify the archived library file.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packaging/flatpak/librusty.json` around lines 1 - 16, Update the aarch64 file
entry in the manifest, identified by its aarch64 URL and only-arches value, to
use SHA-256 checksum
beefe7b35abee77159f7cb55096666b07630c11047d5f3a74dd065863729915a; leave the
x86_64 checksum unchanged.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packaging/flatpak/generate-sources.sh`:
- Around line 31-55: Update the source-generation flow around the commented
Dioxus release-generation block and the later dioxus-cli.json copy so it does
not attempt to copy a file absent from WORKDIR; either restore generation of the
pinned manifest or remove that copy and preserve the checked-in
packaging/flatpak/dioxus-cli.json unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e468486d-2e33-4765-942b-dc5c3f9e9f84
📒 Files selected for processing (2)
packaging/flatpak/dioxus-cli.jsonpackaging/flatpak/generate-sources.sh
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packaging/aur/PKGBUILD`:
- Around line 37-43: Update the pinned archive source and corresponding
sha256sums in packaging/aur/PKGBUILD and packaging/aur/PKGBUILD-bin so both use
an artifact containing the current desktop files, logo.png, and
moe.kopuz.kopuz.metainfo.xml; keep the existing install references in both
package scripts unchanged.
In `@packaging/flatpak/generate-sources.sh`:
- Line 74: Quote the workflow path argument in the grep invocation within the
Dioxus release URL construction, preserving the existing version extraction
pattern while ensuring CUR_DIR values containing spaces are passed as a single
file path.
In `@packaging/nix/crane.nix`:
- Around line 154-155: Update the install source and destination references in
packaging/nix/crane.nix lines 154-155, packaging/aur/PKGBUILD lines 45-46, and
packaging/aur/PKGBUILD-bin lines 45-46 to use moe.kopuz.kopuz.xml consistently
instead of the nonexistent .metainfo.xml filename.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f846cfb7-f53f-431f-9c9b-f31aa8baaa7f
📒 Files selected for processing (14)
.github/workflows/release.ymlJustfileREADME.mddata/moe.kopuz.kopuz.desktopdata/moe.kopuz.kopuz.xmldocs/README-ML.mddocs/README-PT-PT.mddocs/README-TR.mdpackaging/aur/PKGBUILDpackaging/aur/PKGBUILD-binpackaging/flatpak/generate-sources.shpackaging/flatpak/librusty.jsonpackaging/flatpak/moe.kopuz.kopuz.jsonpackaging/nix/crane.nix
🚧 Files skipped from review as they are similar to previous changes (2)
- packaging/flatpak/moe.kopuz.kopuz.json
- packaging/flatpak/librusty.json
| "librusty.json" | ||
|
|
||
| make_asset_source \ | ||
| "https://api.github.com/repos/DioxusLabs/dioxus/releases/tags/v$(grep -oPm1 'cargo install dioxus-cli@\K[0-9]+([\.\d]+)' $CUR_DIR/.github/workflows/release.yml)" \ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Quote the release workflow path.
If CUR_DIR contains spaces, shell word splitting makes grep read invalid path arguments. The version extraction then fails and the script requests an invalid Dioxus release tag.
Proposed fix
-"https://api.github.com/repos/DioxusLabs/dioxus/releases/tags/v$(grep -oPm1 'cargo install dioxus-cli@\K[0-9]+([\.\d]+)' $CUR_DIR/.github/workflows/release.yml)" \
+"https://api.github.com/repos/DioxusLabs/dioxus/releases/tags/v$(grep -oPm1 'cargo install dioxus-cli@\K[0-9]+([\.\d]+)' "$CUR_DIR/.github/workflows/release.yml")" \📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "https://api.github.com/repos/DioxusLabs/dioxus/releases/tags/v$(grep -oPm1 'cargo install dioxus-cli@\K[0-9]+([\.\d]+)' $CUR_DIR/.github/workflows/release.yml)" \ | |
| "https://api.github.com/repos/DioxusLabs/dioxus/releases/tags/v$(grep -oPm1 'cargo install dioxus-cli@\K[0-9]+([\.\d]+)' "$CUR_DIR/.github/workflows/release.yml")" \ |
🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 74-74: Double quote to prevent globbing and word splitting.
(SC2086)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packaging/flatpak/generate-sources.sh` at line 74, Quote the workflow path
argument in the grep invocation within the Dioxus release URL construction,
preserving the existing version extraction pattern while ensuring CUR_DIR values
containing spaces are passed as a single file path.
Source: Linters/SAST tools
|
Uhh you can add this to kopuz-flatpal repo maybe |
maybe add the repo as a sub module here later then? So the files stay in sync |
Updated the flatpak manifest so it builds from source as such is a requirement for flathub AND the current flatpak versions available are broken, so this fixes that too.
Updated the flatpak id from
com.temidaradev.kopuztomoe.kopuz.kopuzto comply with flathub requirements for verification.Also tthere is a script to update the static sources for flatpak builder. To be ran incase
Cargo.lockorpackage-lock.jsonis updatedFixes: #609
Sanity Checking
rules.
contribution guidelines, or this pull request did not use AI assistance.
Style and Consistency
style.
cargo fmt --all --checkorcargo fmt --allas appropriate.cargo clippy --workspace --all-targets -- -D warnings, orexplained why it could not be run.
this change depends on them.
Testing
Tested on platform(s):
x86_64-linuxaarch64-linuxx86_64-darwinaarch64-darwin