diff options
| -rw-r--r-- | AGENTS.md | 11 | ||||
| -rw-r--r-- | README.md | 39 | ||||
| -rwxr-xr-x | install.sh | 45 | ||||
| -rwxr-xr-x | sb-builder | 19 |
4 files changed, 110 insertions, 4 deletions
@@ -40,8 +40,15 @@ Design and phasing: `docs/superpowers/specs/`. Phase 1 (core) is ## Testing -No test suite yet. Planned (phase 1 spec): `python3 -m unittest discover -tests`, with the GUI smoke test under `QT_QPA_PLATFORM=offscreen`. + python3 -m unittest discover -s tests + +Headless (`test_gui.py` sets `QT_QPA_PLATFORM=offscreen`), no VM needed. +`test_remote.py` loads `remote/sbb-remote` with `SourceFileLoader` (no `.py` +extension) and points it at a temp state dir through `SBB_CONFIG`. Two +`ResourceWarning: subprocess ... is still running` lines are expected: the +detached `_run` is never waited for. To try the helper on the VM without +installing it, copy it to `/tmp` there and run it with `SBB_CONFIG` pointing +at a config whose `state_dir` is under `/tmp`. ## Repo facts @@ -11,8 +11,43 @@ Work in progress. See `docs/superpowers/specs/` for the design. ## Requirements -- Desktop: Python 3, PyQt6, ssh access to the VM, optionally `virsh` -- VM: Python 3.11 or newer, the slackrepo_setup and mkhint tools +- Desktop: Python 3.11 or newer, PyQt6 (with QtDBus), ssh access to the VM, + optionally `virsh` for starting the VM +- VM: Python 3.11 or newer, root ssh login, the + [slackrepo_setup](https://forge.slackware.nl/danix/slackrepo_setup) tools (`sbpull`, `sbshadow`) + and mkhint + +## Install + + ./install.sh # ~/bin/sb-builder -> this repo, GUI config if missing + ./install.sh --remote # helper to the VM, its config if missing (asks first) + +`BINDIR` changes the launcher directory, `SBB_TARGET` the ssh destination for +`--remote` (default `buildsystem`). Configs: + +- GUI: `~/.config/sb-builder/config.toml`, see `config.example.toml` +- VM: `/etc/sb-builder/config.toml`, see `remote/config.example.toml` + +Every key is optional. `File > Reload config` rereads the GUI config. + +## Usage + + sb-builder + +- **Dashboard**: VM load, uptime and free disk, package counts, slackrepo + build results, last overlay pull, recent jobs. Refreshes while visible. +- **Open > Jobs**: start a job from the Start menu (`sbpull <overlay>` + preview, `sbshadow` preview or apply), follow its log live, kill it. After a + preview that lists `shadow:` or `unshadow:` lines, "Apply shadowing" runs + `sbshadow --yes`. + +Jobs run on the VM detached from the ssh session, one at a time. Closing the +GUI or losing the connection does not stop them; reopening the job resumes +the log. Job state and logs live in `/var/lib/sb-builder/jobs/` on the VM. + +When ssh fails and `vm.domain` is set, the status bar shows the libvirt state +of the VM and offers to start or resume it. Desktop notifications report +finished, failed, killed and lost jobs, and the VM coming up. ## License diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..464bde9 --- /dev/null +++ b/install.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# sb-builder - install the GUI locally, or the helper on the VM +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# ./install.sh symlink the launcher into ~/bin (BINDIR overrides), +# create the GUI config from the example if missing +# ./install.sh --remote deploy remote/sbb-remote to the VM (SBB_TARGET, +# default buildsystem) and create its config if missing + +set -euo pipefail +here=$(dirname "$(readlink -f "$0")") + +if [[ ${1:-} == --remote ]]; then + target=${SBB_TARGET:-buildsystem} + read -rp "Deploy sbb-remote to $target:/usr/local/bin (config created only if missing)? [y/N] " a + [[ $a =~ ^[Yy]$ ]] || exit 1 + scp -q "$here/remote/sbb-remote" "$target:/usr/local/bin/sbb-remote" + scp -q "$here/remote/config.example.toml" "$target:/tmp/sbb-config.example.toml" + ssh "$target" 'chmod 755 /usr/local/bin/sbb-remote && + mkdir -p /etc/sb-builder && + { [ -e /etc/sb-builder/config.toml ] || cp /tmp/sbb-config.example.toml /etc/sb-builder/config.toml; } && + rm -f /tmp/sbb-config.example.toml && + sbb-remote version' + exit +fi + +bindir=${BINDIR:-$HOME/bin} +cfgdir=${XDG_CONFIG_HOME:-$HOME/.config}/sb-builder +mkdir -p "$bindir" "$cfgdir" +ln -sfn "$here/sb-builder" "$bindir/sb-builder" +[[ -e $cfgdir/config.toml ]] || cp "$here/config.example.toml" "$cfgdir/config.toml" +echo "installed $bindir/sb-builder -> $here/sb-builder, config in $cfgdir/config.toml" diff --git a/sb-builder b/sb-builder new file mode 100755 index 0000000..734645d --- /dev/null +++ b/sb-builder @@ -0,0 +1,19 @@ +#!/bin/sh +# sb-builder - launcher +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +here=$(dirname "$(readlink -f "$0")") +PYTHONPATH="$here${PYTHONPATH:+:$PYTHONPATH}" exec python3 -m sb_builder "$@" |
