diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-25 10:37:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-25 10:37:04 +0200 |
| commit | f4615b3fd010574a0c3bc517cd544c1ec7844f42 (patch) | |
| tree | 08d515c55fa13eab229a58a0d173ec44460dfe83 | |
| parent | 7a020b138458794743e82b888a03d54d15936ff7 (diff) | |
| download | my-slackbuilds-f4615b3fd010574a0c3bc517cd544c1ec7844f42.tar.gz my-slackbuilds-f4615b3fd010574a0c3bc517cd544c1ec7844f42.zip | |
Move maintainer tooling out of the repo
Git hooks, the upstream sweep and the SBo delivery workflow are the
maintainer's operational tools, not package knowledge. They now live in a
private workspace that wraps all three SlackBuild repos, with one shared
copy of each hook instead of three drifting ones.
Also in this pass:
- AGENTS.md: checksum loop documented as sbodl (sbofixinfo does not fix
checksums), nvchecker must not run without a token config, prefer
use_latest_release over use_max_tag
- README: Git Hooks section replaced by a short Contributing note
- sweep report renamed to LAST_SWEEP.md across all three repos
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rwxr-xr-x | .extras/hooks/post-commit | 66 | ||||
| -rwxr-xr-x | .extras/hooks/pre-commit | 84 | ||||
| -rw-r--r-- | AGENTS.md | 110 | ||||
| -rw-r--r-- | README.md | 20 |
4 files changed, 35 insertions, 245 deletions
diff --git a/.extras/hooks/post-commit b/.extras/hooks/post-commit deleted file mode 100755 index 6ed63f7..0000000 --- a/.extras/hooks/post-commit +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# post-commit hook: create SBo submission archive for added/updated packages -set -u - -REPO_ROOT=$(git rev-parse --show-toplevel) -SBO_DIR="$REPO_ROOT/SBo" - -# Find packages whose .SlackBuild was added (A) or modified (M) in this commit. -# git diff-tree output format: <status>\t<file> -# We only want files exactly one directory deep, e.g. hugo/hugo.SlackBuild. -PACKAGES=() -while IFS=$'\t' read -r status file; do - [[ "$status" != "A" && "$status" != "M" ]] && continue - dir=$(dirname "$file") - base=$(basename "$file") - [[ "$dir" == "." ]] && continue # skip root-level files - [[ "$dir" == *"/"* ]] && continue # skip files deeper than one level - [[ "$base" == *.SlackBuild ]] || continue - PACKAGES+=("$dir") -done < <(git diff-tree --no-commit-id -r --name-status HEAD) - -[[ ${#PACKAGES[@]} -eq 0 ]] && exit 0 - -for pkg in "${PACKAGES[@]}"; do - echo "" - echo "==> Package: $pkg" - echo "" - echo "Files to be archived:" - echo "---------------------" - while IFS= read -r f; do - printf '%s\n' "${f#"$REPO_ROOT/"}" - done < <(find "$REPO_ROOT/$pkg" -type f | sort) - echo "" - # Non-interactive override: set SBO_ARCHIVE=yes|no to skip the prompt. - # Lets agents and scripts answer without a terminal. - case "${SBO_ARCHIVE:-}" in - [yY]|[yY][eE][sS]) answer=yes ;; - [nN]|[nN][oO]) echo " -> Skipped (SBO_ARCHIVE=no)."; continue ;; - "") - # No override: need an interactive terminal to prompt. - if [ ! -r /dev/tty ]; then - echo " -> No terminal, skipped (set SBO_ARCHIVE=yes to archive)." - continue - fi - printf "Create SBo archive for '%s'? [y/N] " "$pkg" - answer="" - read -r answer </dev/tty || answer="" - ;; - *) echo " -> Skipped (SBO_ARCHIVE='$SBO_ARCHIVE' unrecognized)."; continue ;; - esac - case "$answer" in - [yY]|[yY][eE][sS]) - mkdir -p "$SBO_DIR" - if tar -czf "$SBO_DIR/$pkg.tar.gz" -C "$REPO_ROOT" "$pkg"; then - echo " -> Archive created: SBo/$pkg.tar.gz" - else - echo " -> Archive FAILED." >&2 - fi - ;; - *) - echo " -> Skipped." - ;; - esac -done - -exit 0 diff --git a/.extras/hooks/pre-commit b/.extras/hooks/pre-commit deleted file mode 100755 index d2f9506..0000000 --- a/.extras/hooks/pre-commit +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -# 20220315 bkw: SBo pre-commit hook, wrapper for sbolint. - -# Installation: - -# Copy this to <gitdir>/.git/hooks, mode 0755 (or anyway, make it -# executable). Also get sbolint and install it somewhere on $PATH, -# like /usr/local/bin. sbolint comes from: - -# https://slackware.uk/~urchlay/repos/sbostuff/plain/sbolint - -# That's a wgettable URL. You can also clone the sbostuff -# repo from https://slackware.uk/~urchlay/repos/sbostuff if you want. - -# Usage: - -# Just do your usual "git commit". When you do, sbolint will run on -# the build you're updating. If it finds any issues, it will cause the -# commit to abort, so you can fix whatever's wrong and try the commit -# again. - -# Since sbolint isn't perfect, you can skip the check for any commit -# by running e.g: - -# SBOLINT=no git commit <arguments> - -# You can also run sbolint by itself, and read its documentation with -# "sbolint --docs". - -set -e -exec 1>&2 - -# Check for staged source archives (.tar.gz, .tar.xz, .tar.bz2, .zip, etc.) -# Symlinks: auto-removed. Regular files: blocked (must not be committed). -source_pattern='\.\(tar\.gz\|tar\.xz\|tar\.bz2\|tar\.zst\|tgz\|zip\|7z\|rpm\|deb\)$' -source_blocked="" -while IFS= read -r f; do - mode=$(git ls-files --stage -- "$f" | awk '{print $1}') - if [ "$mode" = "120000" ]; then - echo "Removing staged symlink to source archive: $f" - git rm --cached -q -- "$f" - rm -f "$f" - else - source_blocked="$source_blocked $f" - fi -done < <(git diff --cached --name-only | grep -i "$source_pattern") -if [ -n "$source_blocked" ]; then - echo "*** ERROR: source archives staged for commit:" - for f in $source_blocked; do echo "*** $f"; done - echo "*** Remove them with: git rm --cached -- $source_blocked" - exit 1 -fi - -# There should normally only be one changed build per commit, but this -# rule may get broken when the repo's frozen pending a new Slackware -# release. So use a loop. - -# The weird-looking "< <(command)" syntax is why this script must -# have a #!/bin/bash at the top: it won't work with #!/bin/sh, even if -# /bin/sh is a symlink to bash. - -if [ "${SBOLINT:-yes}" = "yes" ]; then - sbolintfailed="" - if ! which sbolint &>/dev/null; then - echo "WARNING: can't find sbolint in PATH, no linting will be done" - else - while read build; do - # if there's no slack-desc or README, assume the build has been removed. - # the directory still might exist after a "git rm -rf" because it - # might contain untracked files (e.g. the source tarball). - if [ -e "$build/slack-desc" -o -e "$build/README" ]; then - sbolint "$build" || sbolintfailed=1 - fi - done < <(git diff --cached --name-only | cut -d/ -f1,2 | sort -u) - fi - if [ -n "$sbolintfailed" ]; then - echo "*** sbolint failed, fix the errors or set SBOLINT=no" - echo "*** in the environment to commit anyway." - exit 1 - fi -fi - -exit 0 @@ -5,22 +5,6 @@ Personal collection of SlackBuild scripts maintained by Danilo, compatible with --- -## Core Rules - -1. **Ask before acting.** If anything about the task is ambiguous — target version, - which package, whether to commit — stop and ask. Do not infer intent and proceed. -2. **Use available skills.** For git operations, commits, PRs, and any task covered - by a skill, invoke the relevant skill. Do not improvise a workflow that a skill - already defines. -3. **One package per task.** Never modify multiple packages in a single operation - unless explicitly instructed. -4. **Never skip lint.** Every change must pass `sbolint` before committing. No - exceptions. -5. **Never commit without being asked.** Complete all file edits and verification - steps, then wait for explicit instruction to commit. - ---- - ## Repository Layout Each package lives in its own top-level subfolder: @@ -35,6 +19,9 @@ Each package lives in its own top-level subfolder: └── [...] # Other optional files ``` +Maintainer tooling (git hooks, the upstream sweep, test builds) is kept +outside this repo, in the maintainer's private workspace. + Root-level files you may need to edit: ``` @@ -65,28 +52,24 @@ Set `MD5SUM` to a placeholder (e.g. `"placeholder"`) — it will be fixed in the ### Step 2 — Fix the checksum -Run `sbofixinfo` from inside the package directory: - -```bash -cd <package-name> && sbofixinfo -``` - -If `sbofixinfo` reports no changes (common when the checksum is a placeholder rather -than a stale real value), use the two-pass `sbodl` procedure instead: +`sbofixinfo` does not fix checksums, it only normalizes `.info` formatting. +The checksum loop is `sbodl`: ```bash -# Pass 1 — downloads the source; fails because MD5SUM is wrong/placeholder +# Pass 1: downloads the source and prints +# WARN: md5sum doesn't match ... got: <new> cd <package-name> && sbodl -# Compute the real checksum from the downloaded file -md5sum <package-name>-<version>.tar.gz # adjust filename as needed +# Put the got: value into MD5SUM in the .info file -# Update MD5SUM in the .info file with the value from the command above - -# Pass 2 — verifies the checksum; must report "md5sum matches OK" +# Pass 2: must report "md5sum matches OK" cd <package-name> && sbodl ``` +For a PyPI bump the hash-path `DOWNLOAD` URL also changes: take the sdist URL +and md5 from `https://pypi.org/pypi/<pkg>/<ver>/json` and set both fields, +then run `sbodl`. + Do not proceed past this step until `sbodl` reports `md5sum matches OK`. ### Step 3 — Lint @@ -123,7 +106,7 @@ Then proceed: `<prgnam>.SlackBuild`, `<prgnam>.info`, `README`, `slack-desc` 2. Follow the SlackBuild scripting rules below exactly. 3. Add an entry for the package in `.extras/nvchecker.toml`. -4. Run `sbofixinfo`, then `sbodl` (two-pass if needed), then `sbolint`. +4. Run `sbofixinfo`, then `sbodl` (two-pass, see above), then `sbolint`. 5. Report results and wait for commit instruction. --- @@ -209,7 +192,10 @@ Source: https://slackware.uk/~urchlay/repos/sbo-maintainer-tools | `sbopkglint` | Lint the built package | | `sbofixinfo` | Auto-fix common `.info` file issues | | `sbodl` | Download sources and verify `MD5SUM`/`SHA256SUM` from `.info` | -| `pre-commit-sbolint` | Git pre-commit hook — blocks commits that fail `sbolint` | + +Run `sbolint` on every changed package before committing. A `pre-commit` +wrapper that does it automatically is available from +https://slackware.uk/~urchlay/repos/sbostuff. --- @@ -222,9 +208,18 @@ Example for a GitHub-hosted package: [package-name] source = "github" github = "owner/repo" -use_max_tag = true +use_latest_release = true ``` +Prefer `use_latest_release` (hits `releases/latest`, lenient) over +`use_max_tag` (hits `git/refs/tags`, tightly rate-limited); use `use_max_tag` +only for repos that tag but don't cut Releases. + +The file has no `[__config__]`. Do not run it as-is against GitHub: the +anonymous API budget (60 req/h) runs out and later stanzas 403. Run it from a +throwaway copy with a `[__config__]` that adds a GitHub token keyfile, and +probe single stanzas with `nvchecker -c <cfg> -e <name>`. + When adding or updating a package, verify the entry exists and is correct. --- @@ -241,28 +236,6 @@ to git. Before any `git add`, run from the repo root: find . -type l -delete ``` -### Git hook setup - -Both hooks are tracked in the `.extras/hooks/` directory. Install them after cloning: - -```bash -cp .extras/hooks/pre-commit .git/hooks/pre-commit -cp .extras/hooks/post-commit .git/hooks/post-commit -chmod +x .git/hooks/pre-commit .git/hooks/post-commit -``` - -| Hook | Trigger | Purpose | -|------|---------|---------| -| `pre-commit` | Before every commit | Runs `sbolint` on staged packages; blocks commit on errors. Also checks for staged source archives: symlinks are auto-removed, real files block the commit. | -| `post-commit` | After every commit | Offers to create a `SBo/<pkg>.tar.gz` archive for submission | - -The pre-commit hook runs `sbolint` automatically. If it blocks the commit, fix -the reported errors and retry — do not bypass with `SBOLINT=no` unless the user -explicitly instructs it. - -The post-commit hook may prompt to create an SBo archive. This is interactive and -may fail in non-TTY environments — that failure is harmless and can be ignored. - Commit conventions: - One commit per package add or update. - Message format: @@ -272,31 +245,6 @@ Commit conventions: --- -## What Requires User Confirmation - -Stop and ask before doing any of the following: - -- Committing or pushing changes -- Modifying files in more than one package directory -- Deleting any file -- Bypassing the pre-commit hook (`SBOLINT=no`) -- Adding or removing entries in `.extras/nvchecker.toml` -- Any action not covered by the workflows above - ---- - -## Running Test Builds - -The general rule is: **never run builds directly.** Building is the user's -responsibility. - -The one exception is the `test-build-slackbuild` skill, which builds the package -in a Docker container via `sbo-dockerbuild` without touching the host system. -Use it to verify that a SlackBuild completes successfully, especially for new -packages or after significant changes. - ---- - ## Findings Repo-specific gotchas discovered during maintenance. Append new entries here @@ -336,7 +284,7 @@ trusting them, since upstream tooling fixes can retire a false positive. commit hash. - Action: no longer applies. Upstream switched to versioned releases, so the DOWNLOAD is now `archive/refs/tags/v<X.Y.Z>/...` and `sbolint` passes - clean. The `SBOLINT=no` exception to Core Rule 4 is withdrawn: commit + clean. The `SBOLINT=no` exception to the lint-before-commit rule is withdrawn: commit normally. Kept here so the old exception is not reintroduced from memory. ### test-build needs --local-deps for in-repo sibling deps @@ -97,7 +97,7 @@ Each package lives in its own top-level subfolder: ```bash # Clone the repository -git clone https://github.com/danix/my-slackbuilds.git +git clone https://github.com/danixland/my-slackbuilds.git cd my-slackbuilds # Download the source and verify checksums @@ -120,20 +120,12 @@ Check each package's `README` for dependencies and any special build instruction --- -## Git Hooks +## Contributing -Two hooks are included in `.extras/hooks/`. Install them after cloning: - -```bash -cp .extras/hooks/pre-commit .git/hooks/pre-commit -cp .extras/hooks/post-commit .git/hooks/post-commit -chmod +x .git/hooks/pre-commit .git/hooks/post-commit -``` - -| Hook | Purpose | -|------|---------| -| `pre-commit` | Runs [`sbolint`](https://slackware.uk/~urchlay/repos/sbo-maintainer-tools) on staged packages before each commit. Also guards against staged source archives: symlinks are auto-removed silently, real archive files block the commit and list the offenders. | -| `post-commit` | After each commit, offers to create a `SBo/<pkg>.tar.gz` archive ready for submission to SlackBuilds.org | +Run [`sbolint`](https://slackware.uk/~urchlay/repos/sbo-maintainer-tools) on +every changed package before sending a patch or pull request, and never commit +downloaded source archives or the symlinks `sbodl` leaves in package +directories. --- |
