diff --git a/justfile b/justfile index 772b582..563cfe1 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,7 @@ -# Owlry build and release automation +# Owlry build and release automation. +# +# v2 collapsed the workspace from 5 crates to 1 and shipped a single AUR +# package. The multi-crate / multi-package machinery has been removed. default: @just --list @@ -8,138 +11,128 @@ default: build: cargo build --workspace +# Release build with the AUR feature set (every optional provider compiled in). release: + cargo build --workspace --release --features full + +# Release build with only the minimal default features. +release-minimal: cargo build --workspace --release # === Run === +# Launch the UI (auto mode, default features). run *ARGS: cargo run -p owlry -- {{ARGS}} +# Run the daemon in the foreground (alias: `cargo run -- -d`). run-daemon *ARGS: cargo run -p owlry -- -d {{ARGS}} +# Run with dev-logging feature enabled (verbose debug output). +run-debug *ARGS: + cargo run -p owlry --features dev-logging -- {{ARGS}} + # === Quality === +# Run the full test matrix used in CI: no-default-features then --features full. test: - cargo test --workspace + cargo test --workspace --no-default-features + cargo test --workspace --features full +# cargo check + clippy across both feature axes. check: - cargo check --workspace - cargo clippy --workspace + cargo check --workspace --no-default-features + cargo check --workspace --features full + cargo clippy --workspace --features full fmt: cargo fmt --all +fmt-check: + cargo fmt --all --check + clean: cargo clean -# === Install === +# === Install (local dev) === install-local: #!/usr/bin/env bash set -euo pipefail - echo "Building release..." - cargo build -p owlry --release + echo "Building release with --features full..." + cargo build -p owlry --release --features full echo "Installing binary..." sudo install -Dm755 target/release/owlry /usr/bin/owlry - echo "Installing systemd service files..." + echo "Installing systemd user units..." sudo install -Dm644 systemd/owlry.service /usr/lib/systemd/user/owlry.service - sudo install -Dm644 systemd/owlry.socket /usr/lib/systemd/user/owlry.socket + sudo install -Dm644 systemd/owlry.socket /usr/lib/systemd/user/owlry.socket + echo "Installing man page..." + sudo install -Dm644 data/owlry.1 /usr/share/man/man1/owlry.1 + + echo echo "Done. Start daemon: systemctl --user enable --now owlry.service" # === Version Management === -show-versions: - #!/usr/bin/env bash - echo "=== Crate Versions ===" - for toml in crates/*/Cargo.toml; do - name=$(grep '^name' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - ver=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - printf " %-30s %s\n" "$name" "$ver" - done +# Print the current owlry version. +version: + @grep '^version' crates/owlry/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/' -# Get version of a specific crate -crate-version crate: - @grep '^version' crates/{{crate}}/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/' - -# Bump a single crate version, update Cargo.lock, commit -bump-crate crate new_version: - #!/usr/bin/env bash - set -euo pipefail - toml="crates/{{crate}}/Cargo.toml" - [ -f "$toml" ] || { echo "Error: $toml not found"; exit 1; } - - old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - [ "$old" = "{{new_version}}" ] && { echo "{{crate}} already at {{new_version}}"; exit 0; } - - echo "Bumping {{crate}} from $old to {{new_version}}" - sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" - cargo check -p {{crate}} - git add "$toml" Cargo.lock - git commit -m "chore({{crate}}): bump version to {{new_version}}" - echo "{{crate}} bumped to {{new_version}}" - -# Bump all crates to same version -bump-all new_version: - #!/usr/bin/env bash - set -euo pipefail - for toml in crates/*/Cargo.toml; do - crate=$(basename $(dirname "$toml")) - old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - [ "$old" = "{{new_version}}" ] && continue - echo "Bumping $crate from $old to {{new_version}}" - sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" - done - cargo check --workspace - git add crates/*/Cargo.toml Cargo.lock - git commit -m "chore: bump all crates to {{new_version}}" - echo "All crates bumped to {{new_version}}" - -# Bump core UI only +# Bump the owlry version, update Cargo.lock, commit. bump new_version: - just bump-crate owlry {{new_version}} + #!/usr/bin/env bash + set -euo pipefail + toml="crates/owlry/Cargo.toml" + old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') + if [ "$old" = "{{new_version}}" ]; then + echo "owlry already at {{new_version}}" + exit 0 + fi + echo "Bumping owlry from $old to {{new_version}}" + sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" + cargo check -p owlry + git add "$toml" Cargo.lock + git commit -m "chore(owlry): bump version to {{new_version}}" # === Tagging === -# Tag a specific crate (format: {crate}-v{version}) -tag-crate crate: +# Tag the current owlry version as owlry-v. +tag: #!/usr/bin/env bash set -euo pipefail - ver=$(grep '^version' "crates/{{crate}}/Cargo.toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - tag="{{crate}}-v$ver" + ver=$(just version) + tag="owlry-v$ver" if git rev-parse "$tag" >/dev/null 2>&1; then echo "Tag $tag already exists" exit 0 fi - git tag -a "$tag" -m "{{crate}} v$ver" + git tag -a "$tag" -m "owlry v$ver" echo "Created tag $tag" -# Push all local tags +# Push all local tags upstream. push-tags: git push --tags -# === AUR Package Management === +# === AUR === +# +# Only one AUR package after the v2 collapse: aur/owlry/. Its subdirectory +# has its own .git pointing at aur.archlinux.org — see aur-stage below. -# Stage AUR files into the main repo git index. -# AUR subdirs have their own .git (for aur.archlinux.org), which makes -# git treat them as embedded repos. Temporarily hide .git to stage files. -aur-stage pkg: +# Stage AUR files into the main repo index, working around the embedded .git +# that would otherwise make git treat aur/owlry/ as an embedded repo. +aur-stage: #!/usr/bin/env bash set -euo pipefail - dir="aur/{{pkg}}" - [ -d "$dir" ] || { echo "Error: $dir not found"; exit 1; } - - # Build list of files to stage + dir="aur/owlry" files=("$dir/PKGBUILD" "$dir/.SRCINFO") for f in "$dir"/*.install; do [ -f "$f" ] && files+=("$f") done - if [ -d "$dir/.git" ]; then mv "$dir/.git" "$dir/.git.bak" git add "${files[@]}" @@ -148,186 +141,115 @@ aur-stage pkg: git add "${files[@]}" fi -# Update a specific AUR package PKGBUILD with correct version + checksum -aur-update-pkg pkg: +# Refresh aur/owlry/PKGBUILD to point at the current Cargo.toml version's +# tagged source tarball (fetches the tarball to recompute the b2sum) and +# regenerates .SRCINFO. Requires the tag to be pushed beforehand. +aur-update: #!/usr/bin/env bash set -euo pipefail - aur_dir="aur/{{pkg}}" - [ -d "$aur_dir" ] || { echo "Error: $aur_dir not found"; exit 1; } - - # Determine version - case "{{pkg}}" in - owlry-meta-*) - ver=$(grep '^pkgver=' "$aur_dir/PKGBUILD" | sed 's/pkgver=//') - echo "Meta-package {{pkg}} at $ver (bump pkgrel manually if needed)" - (cd "$aur_dir" && makepkg --printsrcinfo > .SRCINFO) - exit 0 - ;; - *) - crate_dir="crates/{{pkg}}" - [ -d "$crate_dir" ] || { echo "Error: $crate_dir not found"; exit 1; } - ver=$(grep '^version' "$crate_dir/Cargo.toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - ;; - esac - - tag="{{pkg}}-v$ver" + aur_dir="aur/owlry" + ver=$(just version) + tag="owlry-v$ver" url="https://somegit.dev/Owlibou/owlry/archive/$tag.tar.gz" - echo "Updating {{pkg}} to $ver (tag: $tag)" + echo "Updating aur/owlry/PKGBUILD to $ver (tag: $tag)" sed -i "s/^pkgver=.*/pkgver=$ver/" "$aur_dir/PKGBUILD" sed -i 's/^pkgrel=.*/pkgrel=1/' "$aur_dir/PKGBUILD" - # Update checksum from the tagged tarball - if grep -q "^source=" "$aur_dir/PKGBUILD"; then - echo "Downloading tarball and computing checksum..." - hash=$(curl -sL "$url" | b2sum | cut -d' ' -f1) - if [ -z "$hash" ] || [ ${#hash} -lt 64 ]; then - echo "Error: failed to download or hash $url" - exit 1 - fi - sed -i "s|^b2sums=.*|b2sums=('$hash')|" "$aur_dir/PKGBUILD" + echo "Fetching tagged tarball and computing b2sum..." + hash=$(curl -fsL "$url" | b2sum | cut -d' ' -f1) + if [ -z "$hash" ] || [ ${#hash} -lt 64 ]; then + echo "Error: failed to download or hash $url" + echo " (Is the tag pushed? Run 'just push-tags' first.)" + exit 1 fi + sed -i "s|^b2sums=.*|b2sums=('$hash')|" "$aur_dir/PKGBUILD" (cd "$aur_dir" && makepkg --printsrcinfo > .SRCINFO) - echo "{{pkg}} PKGBUILD updated to $ver" + echo "aur/owlry/ PKGBUILD updated to $ver." -# Shortcut: update core UI AUR package -aur-update: - just aur-update-pkg owlry - -# Publish a specific AUR package to aur.archlinux.org -aur-publish-pkg pkg: +# Push aur/owlry/ to aur.archlinux.org (via the embedded .git remote). +aur-publish: #!/usr/bin/env bash set -euo pipefail - aur_dir="aur/{{pkg}}" - [ -d "$aur_dir/.git" ] || { echo "Error: $aur_dir has no AUR git repo"; exit 1; } - + aur_dir="aur/owlry" + [ -d "$aur_dir/.git" ] || { + echo "Error: $aur_dir has no AUR git repo. Clone it first:" + echo " cd $aur_dir && git init && git remote add origin ssh://aur@aur.archlinux.org/owlry.git" + exit 1 + } cd "$aur_dir" ver=$(grep '^pkgver=' PKGBUILD | sed 's/pkgver=//') git add -A git commit -m "Update to v$ver" || { echo "Nothing to commit"; exit 0; } git push origin master - echo "{{pkg}} v$ver published to AUR!" + echo "owlry v$ver published to AUR." -# Shortcut: publish core UI to AUR -aur-publish: - just aur-publish-pkg owlry - -# Update and publish ALL AUR packages -aur-update-all: - #!/usr/bin/env bash - set -euo pipefail - for dir in aur/*/; do - pkg=$(basename "$dir") - [ -f "$dir/PKGBUILD" ] || continue - echo "=== $pkg ===" - just aur-update-pkg "$pkg" - echo "" - done - echo "All updated. Run 'just aur-publish-all' to publish." - -aur-publish-all: - #!/usr/bin/env bash - set -euo pipefail - for dir in aur/*/; do - pkg=$(basename "$dir") - [ -d "$dir/.git" ] || continue - [ -f "$dir/PKGBUILD" ] || continue - echo "=== $pkg ===" - just aur-publish-pkg "$pkg" - echo "" - done - echo "All published!" - -# Show AUR package status +# Show the current AUR PKGBUILD version. aur-status: #!/usr/bin/env bash - echo "=== AUR Package Status ===" - for dir in aur/*/; do - pkg=$(basename "$dir") - [ -f "$dir/PKGBUILD" ] || continue - ver=$(grep '^pkgver=' "$dir/PKGBUILD" | sed 's/pkgver=//') - if [ -d "$dir/.git" ]; then - printf " ✓ %-30s %s\n" "$pkg" "$ver" - else - printf " ✗ %-30s %s (no AUR repo)\n" "$pkg" "$ver" - fi - done + set -euo pipefail + dir="aur/owlry" + ver=$(grep '^pkgver=' "$dir/PKGBUILD" | sed 's/pkgver=//') + rel=$(grep '^pkgrel=' "$dir/PKGBUILD" | sed 's/pkgrel=//') + if [ -d "$dir/.git" ]; then + printf " ✓ owlry %s-%s\n" "$ver" "$rel" + else + printf " ✗ owlry %s-%s (no embedded AUR .git — clone first)\n" "$ver" "$rel" + fi -# Commit AUR file changes to the main repo (handles embedded .git dirs) -aur-commit msg="chore(aur): update PKGBUILDs": +# Stage + commit PKGBUILD/.SRCINFO/.install changes into the main repo. +aur-commit msg="chore(aur): update PKGBUILD": #!/usr/bin/env bash set -euo pipefail - for dir in aur/*/; do - pkg=$(basename "$dir") - [ -f "$dir/PKGBUILD" ] || continue - just aur-stage "$pkg" - done + just aur-stage git diff --cached --quiet && { echo "No AUR changes to commit"; exit 0; } git commit -m "{{msg}}" -# === Release Workflows === +# === Release Workflow === -# Release a single crate: bump → push → tag → update AUR → publish AUR -release-crate crate new_version: +# Full release pipeline: bump → push → tag → aur-update → aur-commit → aur-publish. +# Stops between push and tag to give the tagged tarball time to materialise on +# somegit.dev before fetching it for b2sum. +release-owlry new_version: #!/usr/bin/env bash set -euo pipefail - just bump-crate {{crate}} {{new_version}} + just bump {{new_version}} git push - just tag-crate {{crate}} + just tag just push-tags echo "Waiting for tag to propagate..." sleep 3 - just aur-update-pkg {{crate}} - just aur-commit "chore(aur): update {{crate}} to {{new_version}}" + just aur-update + just aur-commit "chore(aur): update owlry to {{new_version}}" git push - just aur-publish-pkg {{crate}} - echo "" - echo "{{crate}} v{{new_version}} released and published to AUR!" - -# === Meta Package Management === - -# Bump meta-package versions -bump-meta new_version: - #!/usr/bin/env bash - set -euo pipefail - for pkg in owlry-meta-essentials owlry-meta-tools owlry-meta-widgets owlry-meta-full; do - file="aur/$pkg/PKGBUILD" - old=$(grep '^pkgver=' "$file" | sed 's/pkgver=//') - if [ "$old" != "{{new_version}}" ]; then - echo "Bumping $pkg from $old to {{new_version}}" - sed -i 's/^pkgver=.*/pkgver={{new_version}}/' "$file" - (cd "aur/$pkg" && makepkg --printsrcinfo > .SRCINFO) - fi - done - echo "Meta-packages bumped to {{new_version}}" + just aur-publish + echo + echo "owlry v{{new_version}} released and published to AUR." # === Testing === -# Quick local build test (no chroot, uses host deps) -aur-test-pkg pkg: +# Quick local PKGBUILD build (no chroot, uses host deps). +aur-test-pkg: #!/usr/bin/env bash set -euo pipefail - cd "aur/{{pkg}}" - echo "Testing {{pkg}} PKGBUILD..." + cd aur/owlry + echo "Testing PKGBUILD via makepkg -sf..." makepkg -sf - echo "Package built successfully!" + echo "Package built successfully." ls -lh *.pkg.tar.zst -# Build AUR packages from the local working tree in a clean chroot. -# Packages current source (incl. uncommitted changes), patches PKGBUILD, -# builds in dep order, injects local artifacts, restores PKGBUILD on exit. +# Build aur/owlry/ from the local working tree inside a clean extra chroot. +# Patches the PKGBUILD source line to a working-tree tarball; restores on exit. # -# Examples: -# just aur-local-test owlry-core -# just aur-local-test -c owlry-core owlry-rune -# just aur-local-test --all --reset -aur-local-test *args: +# Requires sudo (extra-x86_64-build runs as root). See scripts/aur-local-test +# for the full implementation. +aur-local-test *args="owlry": #!/usr/bin/env bash set -euo pipefail ts=$(date +%Y%m%d-%H%M%S)