358.8. kcm-kdos-system-1.0.0
System Settings page for the A/B system slots — which version starts, its trial, and where updates come from
| Version | 1.0.0, release 1 |
| Source tree | src/desktop/kcm-kdos-system/ |
| Phase | 50_desktop (Desktop), 62 of 92 in build order |
| Licence | MIT |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 251.5 KiB in 2 files |
| Recipe | src/desktop/kcm-kdos-system/kpkgbuild |
About
System Versions is the System Settings page for KDOS’s two root slots, under System. It lists slot A and slot B with the version, build date, tree commit and kernel each holds and the state each is in (running, confirmed, on trial, failed), and its one button, “Start This Version Next Time”, arms a one-boot trial of the other slot: the previous version after an update, or the new one again after a rollback. Its settings are where kdos update takes a newer tree from (the KDOS releases, a folder or removable medium, or another address) and, under “Installing software”, the route kdos update install takes with no flag and the route of what a build lacks: the install = and build-deps = lines of /etc/kdos/update.conf, each prebuilt or built on this computer, both prebuilt by default. Beside the settings it shows what the update service reports — an update that is available, one prepared in the other slot that Discover has not yet installed, and why the last one stopped — and opens Discover to act on it.
The page holds no privilege and touches no file of the boot state. Every change is a call to io.kdos.Slots1 on the system bus, which kdos-sysupdated serves and authorises through polkit (io.kdos.slots.try, io.kdos.slots.channel, io.kdos.slots.install-route, each needing an administrator’s password) before it acts: a trial is kdos-bootctl try <slot> 1, and a refusal from kdos-bootctl is shown in its own words. The interface is io.kdos.Slots1.xml beside the recipe, and it is the contract both sides are held to: the page’s test fixture generates its adaptor from it, and kdos-sysupdated serves the same members and keys.
Why it is in KDOS
The comment above the 5 ports from kcm-kdos-system to kcm-kdos-health in script/phases/50_desktop/packages.txt:
System Settings pages: the A/B slots, boxes, the firewall's named services, the KDOS look and Phosphor mode, and the Health page.
Sources
None: the port builds from its own directory, /kdos/src/desktop/kcm-kdos-system.
Dependencies
Depends on: extra-cmake-modules, qt6-qtbase, qt6-qtdeclarative, kcoreaddons, ki18n, kio, kcmutils, kirigami, systemsettings, kdos-sysupdated.
Required by (1): kde-plasma.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install kcm-kdos-system'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/desktop/kcm-kdos-system.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kcm-kdos-system
SRC=$SRC_ROOT/kcm-kdos-system-1.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cmake -S "$PORT_SRC" -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-D BUILD_TESTING=OFF— Leave the QtTest suites out of the package. They start a fixtureio.kdos.Slots1server on a private session bus and load the page offscreen, whichtesting/plasmatest.shdoes in the development container; the package build has no session bus.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kcm-kdos-system, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kcm-kdos-system-1.0.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kcm-kdos-system, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: CMakeLists.txt, io.kdos.Slots1.xml, kcm_kdos_system.json, plugin.cpp, slotinfo.cpp, slotinfo.h, slotsclient.cpp, slotsclient.h, systemversions.cpp, systemversions.h, tests/, ui/.
Notes
The QML and the C++ share the translation domain kcm_kdos_system, the plugin id, because KQuickConfigModule::mainUi() sets the QML engine’s domain to the plugin id; a second name would split the catalogue in two.
X-DocPath in kcm_kdos_system.json is kdos/04-programs/kdos-settings.html#system-versions, the page’s section of the KDOS book under help:/, which testing/anchorcheck.py checks against the book’s headings. System Settings’ Help button opens help:/ followed by the key’s text, and KIO’s help: worker finds the page through /usr/share/doc/HTML/en/kdos, the link kdos-doc installs (see Help).
The Start This Version Next Time prompt is a window of its own. System Settings shows a KCM in a scene of its own beside its sidebar and footer, so a dialog drawn in the page’s scene blocks only the page, and a click on the sidebar goes through and discards it. The prompt is therefore popupType: QQC2.Popup.Window with modal: true: a window of its own, application-modal, so the rest of System Settings waits until it is answered.
Its parent. Qt makes the prompt’s window transient for the window of the item it is declared in, and for a KCM in System Settings that is QQuickWidget’s offscreen window, which is never mapped and has no xdg_toplevel; the prompt would map with no parent, and a click on System Settings would raise it over its own modal prompt. SystemVersionsModule::holdOver() sets the offscreen window’s transient parent to System Settings’ top level before the prompt’s first open, and Qt’s Wayland plugin resolves a parent by walking transient parents to the nearest window with a shell surface, so the prompt is mapped as a child of System Settings. The prompt’s own transient parent stays the offscreen QQuickWindow: QQuickPopupPrivate::adjustPopupItemParentAndWindow() casts it to a QQuickWindow on every open and close, and hiding and reshowing a mapped prompt to send a new parent rejects the dialog, because QQuickPopupWindow::hideEvent closes a visible dialog.
Its size, which keeps it from being maximised. KWin offers maximise to any xdg_toplevel whose minimum size is below its maximum, so SystemVersionsModule::holdSize() sets both to the prompt’s size and lifts them as it closes. KWin offers or withdraws maximise every time the bounds change (handleMinimumSizeChanged() and handleMaximumSizeChanged() each recompute the capabilities), and a mapped window that loses its maximise button keeps a dead close glyph in its title bar, so the bounds that withdraw it have to be on the QWindow before it is mapped: Qt’s Wayland plugin sends them with the shell surface’s first commit, from QWaylandWindow::initWindow() in setVisible(true).
QQuickPopupPrivate::adjustPopupItemParentAndWindow() creates the QQuickPopupWindow and shows it in one call, before aboutToShow is emitted, so no popup signal comes between the two; the one hook is the background’s Window.window, which changes as the popup item is moved into the window’s content item, just before setVisible, on every open (finalizeExitTransition() takes the item out again on close). The size then is not the settled one, and the popup’s implicit size is no better, since the content is laid out only in the new window: in the offscreen test the prompt is 432x16 there on the first open and 432x76 on a reopen, and settles at 432x117. So the prompt is held again in onOpened. That re-hold grows the window, which keeps it unmaximisable: Qt sends both bounds in one commit, and KWin’s XdgToplevelInterfacePrivate::apply() applies the minimum before the maximum, so a new minimum above the old maximum leaves no moment with room to resize. A re-hold that shrinks a dimension has that moment, and reaches KWin as maximise offered and withdrawn on a mapped window; the prompt’s width is fixed at 24 grid units and its height is mapped at its frame alone or less than its content needs, so the re-hold does not shrink it. The bounds are hints: neither Qt’s Wayland plugin nor KWin’s first configure clamps a size to them. QWindow does, though: every change of a bound fits the window into the bounds unless the minimum exceeds the maximum in both dimensions. A hold moves the maximum first, which leaves the window at the size it is held at; the release raises the minimum above every maximum before it lifts both, so neither resizes the window, and the plugin sends no bounds whose minimum exceeds the maximum.
Its dim and its minimise button. As its own window the prompt’s modal dim is transparent: the page’s scene is all a popup can dim, and a dimmed page beside a bright sidebar reads as a sidebar still in use. KWin’s Dialog Parent effect dims the whole window where effects run; under software rendering KWin reports it unsupported (isEffectSupported("dialogparent") is false on llvmpipe) and nothing is dimmed. Minimise stays: KWin offers it to every transient, and minimising a modal dialog minimises its main window too, so the prompt cannot be hidden on its own.
Applying a different update location or install route raises an administrator prompt, which needs the polkit agent of the Plasma session; a page opened outside a session gets a refusal and says so. A location is written whole into one tree = line of /etc/kdos/update.conf, so a path or an address containing a space or a control character is refused before it is sent.