diff options
| -rw-r--r-- | CLAUDE.md | 3 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | mkhint | 6 | ||||
| -rwxr-xr-x | tests/mkhint_test.sh | 24 |
4 files changed, 31 insertions, 4 deletions
@@ -119,6 +119,7 @@ Test coverage: | T54 | `--fix-current` re-run — idempotent, no duplicate dep, no `.bak` churn | | T55 | missing phantom-deps file — `--fix-current` and `--new` are no-ops | | T56 | `--fix-current` with `-v` — mutually-exclusive error, exit 1 | +| T57 | `-l` skips hints with no `VERSION`; count excludes them | When adding new features, add a corresponding test case to `tests/mkhint_test.sh`. @@ -128,7 +129,7 @@ When adding new features, add a corresponding test case to `tests/mkhint_test.sh - `--new` with existing `.info`: copies `.info` as template, strips `PRGNAM`, `HOMEPAGE`, `MAINTAINER`, `EMAIL`, comments out `REQUIRES`, sets `ARCH="x86_64"`. Keeps `VERSION` from `.info`. If `-v` given, updates version string and recalculates checksums. Also appends an nvchecker `[section]` to the config, auto-detecting github/pypi source or providing a commented stub. - `--new` when hint already exists: backs up old, creates empty skeleton. - `--hintfile` with no `-v`: queries nvchecker for latest version, shows current vs. latest, prompts to accept/override/decline. After accepting, runs `nvtake` to sync nvchecker's keyfile. -- `--list` / `-l`: lists hints with `HintVer`/`SBOVer`; rows where the two are byte-equal are highlighted (color only on a TTY; plain when piped). Adds a legend when any row matched. +- `--list` / `-l`: lists hints with `HintVer`/`SBOVer`; hints with no `VERSION` are skipped (and excluded from the total). Version columns are 22 wide to fit long version strings. Rows where the two are byte-equal are highlighted (color only on a TTY; plain when piped). Adds a legend when any row matched. - `--review` / `-R`: with no package args, iterates only the matched (highlighted) hints. With explicit package names (`-R foo bar`), reviews each named hint regardless of version match (existence required: missing hint → exit 2). For each, shows the hint side-by-side with its `.info` (`git diff --no-index` if git present, else `diff -y`), then prompts `[K]eep / [D]elete / [S]kip` (default Keep). Delete removes the hint and its `.bak` via `_remove_hint`. Prints a deleted/kept summary counting hints actually reviewed. `-l` and `-R` combine: `-lR` shows the table first, then reviews. Bare `-R` with no matches → "nothing to review", exit 0. Per-hint logic lives in `_review_one_hint`; `review_hint_files` drives it from either the named list or `MATCHED_PKGS`. - `--check` / `-C`: runs nvchecker for all (or named) hints. With exactly one explicit package it uses `nvchecker -e <pkg>` to skip scanning the whole config; with two+ packages or no args it does one full scan. (`--hintfile` with no `-v` also queries via `nvchecker -e <pkg>`.) reports outdated packages with current → latest versions, prompts per-package to update, applies updates with `nvtake`, then prompts single `slackrepo update` for all updated packages. Hints with no `[pkg]` section in `nvchecker.toml` are collected and, after the scan, a single prompt offers to populate the config via `add_nvchecker_section` (github/pypi autodetect, else stub); on accept it prints a "review and re-run" message and stops the run without applying updates. Packages whose `.info` is not found in `REPO_DIR` are skipped. Upstream versions are normalized via `_normalize_version` (`-` → `_`) before comparing and before storing, so a dashed upstream version like `2026-06-02` matches the packaged `2026_06_02` (SlackBuild versions cannot contain `-`) and updates are written in the underscore form. The same normalization applies to `--hintfile` with no `-v`. `nvtake` still uses nvchecker's own raw keyfile value. - `--no-dl` / `-N`: downloads and recalculates checksums as normal, then appends `NODOWNLOAD=yes` after `MD5SUM_x86_64=`. Works with `--hintfile` or `--new`. Error if used alone. @@ -103,7 +103,7 @@ When updating a hint with multiline DOWNLOAD, mkhint: ### List hint files -Lists each hint file with its `HintVer` (version in the hint) and `SBOVer` (version in the repository `.info`). Rows where the two are byte-equal are highlighted, so you can see at a glance which hints are now redundant with the upstream SBo version. Color is used only on a TTY; piped output is plain. A legend is printed when any row matched. +Lists each hint file with its `HintVer` (version in the hint) and `SBOVer` (version in the repository `.info`). Hints with no `VERSION` set (e.g. pure `DELREQUIRES` hints) are skipped. Version columns are wide enough for long version strings. Rows where the two are byte-equal are highlighted, so you can see at a glance which hints are now redundant with the upstream SBo version. Color is used only on a TTY; piped output is plain. A legend is printed when any row matched. ```bash mkhint --list @@ -111,7 +111,7 @@ list_hint_files() { echo "Hint files in: $HINT_DIR" echo "=======================================================" - printf "%-40s %10s %10s %-20s %s\n" "File" "HintVer" "SBOVer" "Category" "Created" + printf "%-40s %22s %22s %-20s %s\n" "File" "HintVer" "SBOVer" "Category" "Created" echo "-------------------------------------------------------" MATCHED_PKGS=() @@ -119,6 +119,8 @@ list_hint_files() { for file in "$HINT_DIR"/*.hint; do if [[ -f "$file" ]]; then local VER; VER=$(grep "^VERSION" "$file" |cut -d '"' -f2) + # Skip hints with no VERSION set. + [[ -z "$VER" ]] && continue local name; name=$(basename "$file") local pkg="${name%.hint}" local info_file @@ -131,7 +133,7 @@ list_hint_files() { fi local date; date=$(stat -c "%y" "$file" | cut -d'.' -f1) local row - row=$(printf "%-40s %10s %10s %-20s %s" "$name" "$VER" "$SBO_VER" "$category" "$date") + row=$(printf "%-40s %22s %22s %-20s %s" "$name" "$VER" "$SBO_VER" "$category" "$date") if [[ -n "$VER" && "$VER" == "$SBO_VER" ]]; then printf "%s%s%s\n" "$c_on" "$row" "$c_off" MATCHED_PKGS+=("$pkg") diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index 421d7b6..425eba2 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -1098,6 +1098,30 @@ code=$? set -e assert_exit_code "mutually exclusive" 1 "$code" +# ── T57: -l skips hints with no VERSION ────────────────────────────────────── +echo "" +echo "T57: -l lists only hints that have a VERSION" +rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak 2>/dev/null +cat > "$MOCK_HINT/curl.hint" << 'EOF' +VERSION="8.5.0" +ARCH="x86_64" +EOF +# no VERSION line at all +cat > "$MOCK_HINT/novers.hint" << 'EOF' +ARCH="x86_64" +DELREQUIRES="rust-opt" +EOF +out=$(run_mkhint -l 2>&1) +echo "$out" | grep -q "curl.hint" \ + && { echo " PASS: versioned hint shown"; (( PASS++ )); } \ + || { echo " FAIL: versioned hint missing"; (( FAIL++ )); ERRORS+=("T57 shown"); } +echo "$out" | grep -q "novers.hint" \ + && { echo " FAIL: versionless hint shown"; (( FAIL++ )); ERRORS+=("T57 skip"); } \ + || { echo " PASS: versionless hint skipped"; (( PASS++ )); } +echo "$out" | grep -q "Total: 1 file" \ + && { echo " PASS: count excludes versionless"; (( PASS++ )); } \ + || { echo " FAIL: count wrong"; (( FAIL++ )); ERRORS+=("T57 count"); } + # ─── SUMMARY ────────────────────────────────────────────────────────────────── teardown |
