Skip to content

Add snap package support for KLog - #1064

Open
ea4k wants to merge 6 commits into
masterfrom
claude/klog-snap-packaging-zr41ns
Open

Add snap package support for KLog#1064
ea4k wants to merge 6 commits into
masterfrom
claude/klog-snap-packaging-zr41ns

Conversation

@ea4k

@ea4k ea4k commented Aug 8, 2026

Copy link
Copy Markdown
Owner

This PR adds comprehensive snap package support for KLog, enabling distribution and installation as a self-contained snap on any GNU/Linux distribution with snapd.

Summary

KLog can now be built and distributed as a snap package that bundles Qt6, Hamlib, and all dependencies. This allows users to install KLog on any Linux distribution regardless of which Qt version that distribution ships, without requiring compilation or dependency resolution.

Key Changes

  • snap/snapcraft.yaml: Complete snapcraft recipe that:

    • Uses core26 (Ubuntu 26.04) as the base, which is the first LTS release with complete Qt6 support including QtLocation, QtCharts, and QtSerialPort
    • Configures strict confinement with appropriate plugs for desktop, network, home directory, and hardware access (serial ports, USB, printing)
    • Specifies all build and runtime dependencies (Qt6 modules, Hamlib, Mesa drivers)
    • Includes desktop integration and icon handling
    • Implements version extraction from CMakeLists.txt
  • snap/local/klog-launch: Command-chain wrapper script that:

    • Sets up Qt plugin and QML module search paths for the staged Qt6
    • Configures fontconfig for proper font rendering
    • Implements one-time logbook migration from existing ~/.klog installations to the snap's confined directory
    • Handles multiarch library paths automatically
  • INSTALL-snap: Comprehensive documentation covering:

    • Installation instructions (from Snap Store and local files)
    • Interface connection requirements (raw-usb, serial-port, cups-control)
    • Logbook location and migration behavior
    • Known limitations (LoTW signing, serial port visibility)
    • Build instructions and toolchain setup
    • Snap Store publishing workflow
  • devscripts/snap-create-package.sh: Build helper script that:

    • Automates snap package creation
    • Validates translation files are included
    • Provides user-friendly output and installation instructions
  • .github/workflows/snap.yml: CI/CD workflow that:

    • Builds snap on every push and pull request
    • Validates package contents (translations, QtLocation, SQLite driver)
    • Uploads artifacts and attaches to GitHub releases on version tags
    • Publishes to Snap Store when credentials are configured
  • Documentation updates:

    • Updated README.md with snap installation instructions
    • Updated INSTALL.txt to reference INSTALL-snap
    • Updated .gitignore to exclude snapcraft build artifacts
    • Updated Changelog with snap-related entry

Notable Implementation Details

  • The recipe uses core26 instead of core24 because Qt6 Location (required for the map window) was only restored in Qt 6.5, which is first available in Ubuntu 26.04
  • Desktop environment setup (Qt paths, fontconfig, XDG directories) is handled by the klog-launch wrapper since core26 lacks GNOME/KDE extensions
  • Hardware acceleration for the QtQuick map is provided via the "gpu" extension
  • The snap implements automatic one-time logbook migration from existing .deb or self-built installations
  • Strict confinement is used with manual connection required for CAT control and printing interfaces

https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM

claude added 6 commits August 8, 2026 13:39
Package KLog as a strictly confined snap so it can be installed on any
GNU/Linux distribution running snapd, independently of the Qt version that
distribution ships.

The recipe builds against core26 (Ubuntu 26.04). KLog links against Qt6
Location for the map window, and upstream Qt had no QtLocation between 6.0
and 6.4, so the module is absent from the Ubuntu 24.04 archive that core24
snaps are built from. The KDE neon extensions ship a newer Qt but explicitly
leave out QtCharts, which KLog needs for the statistics widgets. Ubuntu 26.04
carries the complete Qt 6.10 set as well as Hamlib, so every dependency comes
from the distribution archive: nothing is built from source and no
third-party apt repository is involved.

core26 has no GNOME/KDE desktop extension yet, so snap/local/klog-launch does
the work those extensions normally do for a Qt application - Qt plugin and
QML search paths, the library path for the staged Qt, fontconfig and the XDG
data directories - and the "gpu" extension provides the Mesa userspace
drivers the QtQuick map needs.

Because a confined snap gets its own home, KLog's data directory becomes
~/snap/klog/current/.klog. The launcher copies an existing ~/.klog into it on
the first run so a logbook made by the .deb is not left behind; the original
is never modified and KLOG_SNAP_NO_MIGRATE=1 skips the copy.

Added:
  snap/snapcraft.yaml               the recipe
  snap/local/klog-launch            command-chain wrapper
  devscripts/snap-create-package.sh build helper, matching the .deb one
  .github/workflows/snap.yml        CI build, artifact and store publishing
  INSTALL-snap                      installing, interfaces, building, publishing

The build checks that the translations made it into the package, the same
check the Debian package script performs, and CI additionally verifies that
the QtLocation QML module, the geoservices plugins and the Qt SQLite driver
are present.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
…ment

core26 (Ubuntu 26.04) is the newest snap base available - bases are only made
from LTS releases, so there is nothing above it - and it is the only Ubuntu
that carries both Qt6 Location and Qt6 Charts, the two modules KLog needs
that no earlier base can supply.

Record the exact versions the archive publishes (Qt 6.10.2, Hamlib 4.6.5)
and spell out that the base is what KLog is built against, not what the user
has to be running: snapd pulls the base snap in as a dependency, so the
package installs the same on Ubuntu 22.04, Debian, Fedora or Arch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
"snapcraft login" keeps its token in the system keyring, so on a build
server, in a container or over SSH it fails outright with "No keyring found
to store or retrieve credentials from". Section 7 sent the reader straight
into that command with no warning.

Explain the headless route instead: "snapcraft export-login" does not touch
the keyring, and exporting SNAPCRAFT_STORE_CREDENTIALS from the file it
writes authenticates every snapcraft command in the shell. Note that the
first export cannot use --snaps, since credentials can only be scoped to a
snap that is already registered, and point at the web registration form as
the alternative that needs no working CLI login. Also state up front that
building the snap needs no store account at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
The publishing section told the reader to check whether "klog" was free and
what to do if an unrelated project held it. The name is registered to the
KLog account, which is the name the recipe builds under, so drop the
speculation and say so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
devscripts/jenkins/Jenkinsfile.snap builds the snap on the debian-stable
agent in the same shape as the other platform jobs: power the ESXi VM on,
build, verify, upload to the NAS, power it off, and power it off again from
the failure handler. It reuses the credentials klog-debian-stable already
needs, so Jenkins gains no new secrets.

The agent does not need any Qt6 or Hamlib development package, because
snapcraft builds inside an LXD container running Ubuntu 26.04. What it does
need is snapd, snapcraft, LXD and a jenkins user in the lxd group, none of
which the .deb build required, so the pipeline opens with a Preflight stage
that checks for each of them and reports the exact missing command instead
of failing later mid-build.

Two details specific to running snapcraft under Jenkins are handled in the
build script as well, so it behaves the same when called by hand:

  - /snap/bin is only put on PATH by a login shell, and Jenkins runs sh
    non-login, so snapcraft would not be found at all.
  - snapcraft clean has nothing to do on a fresh checkout, and its non-zero
    exit must not abort the run.

It also pins SNAPCRAFT_BUILD_ENVIRONMENT to lxd and fails with the setup
commands if LXD is missing or unreachable, since core26 cannot be built
destructively on a Debian host.

klog-snap and klog-debian-stable share the one VM, so Jenkinsfile.all runs
them sequentially inside its "Debian stable" stage; in parallel the first to
finish would power the machine off under the other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
Revert Jenkinsfile.all to exactly what it was: klog-snap runs on its own with
Build Now, not as part of the all-platforms run.

Keep the note about the two jobs sharing the debian-stable VM, since it still
applies the day klog-snap is added there - each job powers the machine off
when it finishes, so a parallel branch would pull the VM out from under
klog-debian-stable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NH3YWvwLzEr3nZuQdhUZM
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants