mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-27 10:52:52 +01:00
fix(scripts): the Linux scripts find the repository from scripts/linux/
The scripts were written for a KDE-only repository root (komorebi-for-kde/, scripts/ one level below it). They now live in scripts/linux/ of the consolidated repository: - run-kde looks for the repository two directories above itself (flake.nix at the root) and no longer knows the komorebi-for-kde/ subdirectory; its comments name nix/linux and docs/linux - vm-mac cd`s two levels up, usage and comments name scripts/linux/vm-mac - sync-e2e-core and scenario-status read nix/linux/tests/vm/lib, and usage lines name the new paths (scenario-status resolves the library with parents[2]) - wsl2-probe.sh names docs/linux/dev/wsl2-probe.md and prints "komorebi (KDE Plasma)" instead of komorebi-for-kde in its report header - compare-gen.py is stale by design: the docstring now says so a second time (layout) and names the new path of COMPARE.md; the logic is not repaired Flake attribute names the scripts call (nix run .#run-kde, .#wsl2-probe, legacyPackages.*.vm.NAME in vm-mac) are left for the one-flake revision. Verified: bash -n and shellcheck -S warning pass on the four shell scripts; the two Python scripts parse (ast); `bash run-kde --dry-run` run from /tmp prints KOMOREBI_REPO as this checkout; `sync-e2e-core --check e2e/lib` prints "in step"; `scenario-status --help` runs. Not run: the VM, vm-mac, wsl2-probe.
This commit is contained in:
1 parent
a7b78cc7e4
commit
1afac08af5
6 files changed
+36
-32
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate the tables of docs/dev/COMPARE.md from the source trees.
|
||||
"""Generate the tables of docs/linux/dev/COMPARE.md from the source trees.
|
||||
|
||||
NOTE (wip-cand4): STALE. The command definitions moved to crates/komorebic-core, the daemons' message
|
||||
types to crates/komorebi-protocol and the configuration types to crates/komorebi-config, so the
|
||||
@@ -7,6 +7,12 @@ readers below (`Tree.commands`, `socket_messages`, `struct_keys`, ...) find noth
|
||||
exits with "cannot find ^enum SubCommand". It runs only against the pre-consolidation checkouts
|
||||
named in COMPARE.md. Port it to the crates before using it again, or retire it with COMPARE.md.
|
||||
|
||||
NOTE (layout): STALE in a second way, and NOT repaired on purpose. This file now lives in
|
||||
scripts/linux/ of the consolidated repository, and the three trees it compares are komorebi-windows/,
|
||||
komorebi-linux/ and komorebi-macos/ of that one repository (the old komorebi-for-kde/ and
|
||||
komorebi-for-mac/ directories, the `komorebi/src` paths below, and the MONOREPO / HERE.parent
|
||||
logic describe the layout before the consolidation). `HERE` below is scripts/linux/, not a tree.
|
||||
|
||||
komorebi for Windows (kfw), komorebi for macOS (kfm) and komorebi for KDE Plasma (kfde, this
|
||||
repository) are read as they are on disk. Nothing in the tables is typed from memory, except the
|
||||
small hand-written tables in the NOTES section of this file, which hold what a source file cannot
|
||||
@@ -22,7 +28,7 @@ commit the result with the change.
|
||||
|
||||
Usage:
|
||||
|
||||
python3 -I scripts/compare-gen.py [--kfw DIR] [--kfm DIR] [--kfde DIR]
|
||||
python3 -I scripts/linux/compare-gen.py [--kfw DIR] [--kfm DIR] [--kfde DIR]
|
||||
[--update COMPARE.md | --check COMPARE.md] [--block NAME]
|
||||
|
||||
Without --update or --check the blocks are printed to stdout, each between the markers
|
||||
|
||||
+9
-11
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# run-kde: start the komorebi demo guest (nix/dev/run-kde.nix) in a virtual machine, so that anyone
|
||||
# can try tiling by hand. docs/trying-it.md is the guide, docs/dev/utm.md says what the guest takes
|
||||
# run-kde: start the komorebi demo guest (nix/linux/dev/run-kde.nix) in a virtual machine, so that anyone
|
||||
# can try tiling by hand. docs/linux/trying-it.md is the guide, docs/linux/dev/utm.md says what the guest takes
|
||||
# from its runner; this is the program.
|
||||
#
|
||||
# nix run .#run-kde -- [options] or just run-kde [options]
|
||||
@@ -40,7 +40,7 @@ source and downloads Plasma: there is no binary cache.
|
||||
-h, --help this text
|
||||
|
||||
The repository the guest mounts at /repo is the checkout this file is in (or, from the flake, the current
|
||||
checkout: the komorebi-for-kde directory of a bigger repository), or KOMOREBI_REPO.
|
||||
checkout), or KOMOREBI_REPO.
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ warn() {
|
||||
|
||||
# The guest mounts its /nix/store and its shared directories by virtiofs: for each of them the
|
||||
# runner starts a virtiofsd as this user, and QEMU hands the guest's virtio-fs device its socket.
|
||||
# `wsl2-probe` (docs/dev/wsl2-probe.md, P6) runs the same chain with a guest; its fixes are these.
|
||||
# `wsl2-probe` (docs/linux/dev/wsl2-probe.md, P6) runs the same chain with a guest; its fixes are these.
|
||||
check_virtiofs() {
|
||||
local virtiofsd tmp pid up line lines
|
||||
# virtiofsd does not open /dev/fuse (it speaks FUSE to the guest over its socket): a warning
|
||||
@@ -551,18 +551,16 @@ fi
|
||||
|
||||
repo=${KOMOREBI_REPO:-}
|
||||
if [ -z "$repo" ]; then
|
||||
# This tree may be a subdirectory of a bigger repository, whose toplevel has a flake.nix of its own,
|
||||
# so the toplevel is not the answer. A run of the file by hand is in scripts/ of the tree; the
|
||||
# flake's wrapper is in the store, and falls back to the checkout the command is run from.
|
||||
here=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." 2> /dev/null && pwd || true)
|
||||
# The repository is the one whose root has the flake.nix. A run of the file by hand is in
|
||||
# scripts/linux/ of it, two directories down; the flake's wrapper is in the store, and falls back
|
||||
# to the checkout the command is run from.
|
||||
here=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2> /dev/null && pwd || true)
|
||||
top=$(git rev-parse --show-toplevel 2> /dev/null || pwd)
|
||||
case $here in
|
||||
/nix/store/* | "") here= ;;
|
||||
esac
|
||||
if [ -n "$here" ] && [ -e "$here/flake.nix" ]; then
|
||||
repo=$here
|
||||
elif [ -e "$top/komorebi-for-kde/flake.nix" ]; then
|
||||
repo=$top/komorebi-for-kde
|
||||
else
|
||||
repo=$top
|
||||
fi
|
||||
@@ -574,7 +572,7 @@ fi
|
||||
|
||||
disk=$state_dir/disk.qcow2
|
||||
|
||||
# the arguments of the runner, and the environment it reads (docs/dev/utm.md says what each does)
|
||||
# the arguments of the runner, and the environment it reads (docs/linux/dev/utm.md says what each does)
|
||||
if [ "$gpu_on" = 1 ]; then gpu_device_name=virtio-vga-gl; else gpu_device_name=virtio-vga; fi
|
||||
width=${resolution%x*}
|
||||
height=${resolution#*x}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Makes the scenario-by-port status table from the logs of runs on KDE and the result files of
|
||||
kfw (see nix/tests/vm/lib/komorebi_vm/status.py).
|
||||
kfw (see nix/linux/tests/vm/lib/komorebi_vm/status.py).
|
||||
|
||||
scripts/scenario-status --kde LOG... [--windows DIR...] [--update docs/dev/BEHAVIOUR.md]
|
||||
scripts/linux/scenario-status --kde LOG... [--windows DIR...] [--update docs/linux/dev/BEHAVIOUR.md]
|
||||
|
||||
Without --update the table is printed. With it, what is between the two comment markers
|
||||
(`<!-- scenario-status:begin -->` and `<!-- scenario-status:end -->`) of the file is replaced.
|
||||
@@ -12,7 +12,7 @@ import argparse
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(__file__).resolve().parent.parent / "nix/tests/vm/lib/komorebi_vm/status.py"
|
||||
path = Path(__file__).resolve().parents[2] / "nix/linux/tests/vm/lib/komorebi_vm/status.py"
|
||||
spec = importlib.util.spec_from_file_location("status", path)
|
||||
assert spec and spec.loader
|
||||
status = importlib.util.module_from_spec(spec)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Checks that the copy of the platform-neutral part of the VM library in this tree is in step with
|
||||
# the root e2e/lib of the komorebi repository (the plan in docs/dev/vm-tests.md, "Writing a
|
||||
# the root e2e/lib of this repository (the plan in docs/linux/dev/vm-tests.md, "Writing a
|
||||
# scenario"): the package komorebi_vm.core, and the unit tests that belong to it. The SOURCE OF TRUTH
|
||||
# IS THE ROOT e2e/lib, where the core is on its way to the Windows tree, and this tree's copy follows
|
||||
# it. The script goes away once the root flake builds the KDE VM tests from e2e/lib; until then the
|
||||
# KDE flake cannot reach ../, so the copy stays.
|
||||
# KDE flake could not reach ../ of its own tree, so the copy stays.
|
||||
#
|
||||
# scripts/sync-e2e-core --check ../e2e/lib say what differs, and exit 1 if anything does
|
||||
# scripts/sync-e2e-core DEST copy THIS tree's core into DEST/komorebi_vm/core,
|
||||
# scripts/linux/sync-e2e-core --check e2e/lib say what differs, and exit 1 if anything does
|
||||
# scripts/linux/sync-e2e-core DEST copy THIS tree's core into DEST/komorebi_vm/core,
|
||||
# DEST/tests and DEST/tests/fixtures. That is the direction
|
||||
# from before the move: the root is the source now, so
|
||||
# do not point it at ../e2e/lib; copy the other way by hand.
|
||||
# do not point it at e2e/lib; copy the other way by hand.
|
||||
#
|
||||
# Nothing else of DEST is touched, and a file of DEST that is not here is reported and left alone.
|
||||
set -euo pipefail
|
||||
@@ -21,8 +21,8 @@ if [ "${1:-}" = --check ]; then
|
||||
shift
|
||||
fi
|
||||
dest=${1:?usage: sync-e2e-core [--check] DEST}
|
||||
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
lib=$repo/nix/tests/vm/lib
|
||||
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
||||
lib=$repo/nix/linux/tests/vm/lib
|
||||
|
||||
tests=(fake_platform.py fake_strip.py fake_wallpaper.py test_checks.py test_suite.py test_pixels.py test_snapshot.py test_recorded.py test_tiling.py
|
||||
test_focus_moving.py)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs one VM test on a Mac, where the guest is Linux and the host is not.
|
||||
#
|
||||
# scripts/vm-mac NAME [driver arguments]
|
||||
# scripts/linux/vm-mac NAME [driver arguments]
|
||||
#
|
||||
# The guest's closure is built on a Linux builder, copied back, and the test driver then runs
|
||||
# on the Mac under HVF. The driver is run directly, not through `nix build`, because the nix
|
||||
@@ -9,18 +9,18 @@
|
||||
# `.vm/out/NAME`.
|
||||
#
|
||||
# The builder is yours: set KOMOREBI_BUILDER to its store URL (for example
|
||||
# `ssh-ng://builder@localhost`) and, if it needs them, NIX_SSHOPTS. docs/dev/vm-tests.md
|
||||
# `ssh-ng://builder@localhost`) and, if it needs them, NIX_SSHOPTS. docs/linux/dev/vm-tests.md
|
||||
# says what a builder has to be.
|
||||
set -euo pipefail
|
||||
|
||||
name="${1:?usage: scripts/vm-mac NAME [driver arguments]}"
|
||||
name="${1:?usage: scripts/linux/vm-mac NAME [driver arguments]}"
|
||||
shift
|
||||
builder="${KOMOREBI_BUILDER:?set KOMOREBI_BUILDER to the store URL of a Linux builder}"
|
||||
cd "$(dirname "$0")/.."
|
||||
cd "$(dirname "$0")/../.."
|
||||
attr="legacyPackages.aarch64-darwin.vm.$name"
|
||||
test="path:$PWD#$attr"
|
||||
# a git checkout is a flake source without its untracked files (.vm, target); this tree may be the
|
||||
# komorebi-for-kde directory of a bigger repository, whose toplevel is not $PWD
|
||||
# a git checkout is a flake source without its untracked files (.vm, target); the repository may be
|
||||
# a subdirectory of a bigger git repository, whose toplevel is not $PWD
|
||||
if top=$(git rev-parse --show-toplevel 2> /dev/null); then
|
||||
if [ "$top" = "$PWD" ]; then
|
||||
test="git+file://$PWD#$attr"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# wsl2-probe: finds out what a NixOS-WSL2 virtual machine can do for a Plasma guest.
|
||||
# Start it as `nix run .#wsl2-probe` (or `just wsl2-probe`) and paste the end of its output
|
||||
# back. `--help` lists the options, docs/dev/wsl2-probe.md says what each check means.
|
||||
# back. `--help` lists the options, docs/linux/dev/wsl2-probe.md says what each check means.
|
||||
set -u
|
||||
export LC_ALL=C
|
||||
# wsl.exe writes UTF-16 unless it is told otherwise; WSLENV carries the variable to it
|
||||
@@ -1499,7 +1499,7 @@ summary() {
|
||||
local probe title text
|
||||
out ""
|
||||
out "================================ PASTE THIS ================================"
|
||||
out "komorebi-for-kde wsl2-probe, revision $REV, $(date -u +%Y-%m-%dT%H:%M:%SZ), $(uname -m)$([ "$DRY" = 1 ] && echo ', DRY RUN')"
|
||||
out "komorebi (KDE Plasma) wsl2-probe, revision $REV, $(date -u +%Y-%m-%dT%H:%M:%SZ), $(uname -m)$([ "$DRY" = 1 ] && echo ', DRY RUN')"
|
||||
for probe in P0 P1 P2 P3 P4 P5 P6; do
|
||||
[ "$probe" = P0 ] || want "$probe" || continue
|
||||
case $probe in
|
||||
@@ -1524,7 +1524,7 @@ summary() {
|
||||
out "Paste the block between the two lines of equals signs; the whole report if it is asked for."
|
||||
}
|
||||
|
||||
out "wsl2-probe of komorebi-for-kde, revision $REV: $(date -u +%Y-%m-%dT%H:%M:%SZ)$([ "$DRY" = 1 ] && echo ' (dry run)')"
|
||||
out "wsl2-probe of komorebi (KDE Plasma), revision $REV: $(date -u +%Y-%m-%dT%H:%M:%SZ)$([ "$DRY" = 1 ] && echo ' (dry run)')"
|
||||
out "It changes nothing: it reads the machine, boots a tiny guest that powers itself off, and listens on local ports for a few seconds."
|
||||
if [ "$DRY" = 0 ] && { want P2 || want P3; }; then
|
||||
out "It takes about two minutes. A window opens for $HOLD seconds in P2 and in P3: look at the Windows desktop."
|
||||
|
||||
Reference in new issue
Block a user