diff options
| -rw-r--r-- | CHANGELOG.md | 7 | ||||
| -rw-r--r-- | CLAUDE.md | 4 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | mkhint | 9 | ||||
| -rw-r--r-- | mkhint.1.gz | bin | 3958 -> 3980 bytes | |||
| -rw-r--r-- | mkhint.1.md | 5 | ||||
| -rwxr-xr-x | tests/mkhint_test.sh | 34 |
7 files changed, 54 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b9add7..49e30c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project are documented here. The format is based on ## [Unreleased] +### Added +- `--list`/`-l`: new `NoDL` column showing `✓` when a hint carries + `NODOWNLOAD=yes`, alongside the existing `DelReq` column. +- Bash completion: `-V`/`--set-version` now completes from the SBo `.info` + VERSION when `-n`/`--new <pkg>` is on the line (previously only from the + hint's VERSION via `-f`/`--hintfile`). + ### Changed - `nvtake` timing: nvchecker's `oldver` is now synced (via `nvtake`) only when you confirm the slackrepo prompt, per package, just before slackrepo runs — @@ -132,6 +132,8 @@ Test coverage: | T62 | `-l` equal versions — whole row yellow, no green | | T63 | `-l` hint with populated `DELREQUIRES` — `✓` in DelReq column | | T64 | `-l` hint without `DELREQUIRES` — DelReq blank | +| T68 | `-l` hint with `NODOWNLOAD=yes` — `✓` in NoDL column | +| T69 | `-l` hint without `NODOWNLOAD` — NoDL blank | | T65 | `mkhint -v` prints `mkhint <version>`, exit 0 | | T66 | `mkhint --version` prints `mkhint <version>`, exit 0 | | T67 | `mkhint -V <ver> -n <pkg>` sets hint VERSION (rename works) | @@ -145,7 +147,7 @@ When adding new features, add a corresponding test case to `tests/mkhint_test.sh - `add_nvchecker_section` autodetection: `_detect_nvchecker_source` recognizes github, gitlab, bitbucket, gitea, codeberg, and pagure owner/repo URLs plus the pypi, npm, gems, crates.io (`cratesio`), cpan, hackage, packagist, and cran registries, else leaves a commented stub. Github gets `use_latest_release = true` with commented `use_max_tag`/`prefix = "v"` fallbacks; the other forges get `use_max_tag = true` plus a commented `# prefix = "v"`; registries use the package name parsed from the URL via `_registry_name_from_url`, falling back to `PRGNAM` when no host-specific pattern matches. Either way, the managed stanza (freshly added or already present) is echoed fenced on stdout via `_extract_nvchecker_section`. - `--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, updates the hint, then dispatches slackrepo via `prompt_slackrepo`; `nvtake` (syncing nvchecker's oldver keyfile) fires from `run_slackrepo` only when you confirm the slackrepo question, not on version-accept. Decline slackrepo and the hint stays bumped but oldver lags, so nvchecker keeps reporting the update until it's built. -- `--list` / `-l`: lists hints with `HintVer`/`SBOVer` plus a `DelReq` column (before `Created`) showing `✓` when the hint has a populated `DELREQUIRES` (detected via `grep '^DELREQUIRES="..*"'`, padded with `_pad_glyph` so the multibyte glyph stays aligned). Hints with no `VERSION` are skipped (and excluded from the total). Version columns are 22 wide to fit long version strings. Coloring: rows where the two versions are byte-equal get the whole row yellow (and populate `MATCHED_PKGS` for `-R`); when they differ, `sort -V` picks the newer side and only that version cell is green (version strings are pre-padded to 22 before the color wrap so the escape bytes don't break alignment); an absent/empty `SBOVer` leaves the row plain. Color only on a TTY (or `MKHINT_FORCE_COLOR`); plain when piped. Legend `(yellow row = versions match; green = newer side)` prints when any row matched. With package names (`-l foo bar`), the table is skipped and each named hint is shown side by side with its `.info` via `_show_hint_diff` (shared with `--review`); missing hint → exit 2. +- `--list` / `-l`: lists hints with `HintVer`/`SBOVer` plus a `DelReq` and a `NoDL` column (both before `Created`) showing `✓` when the hint has a populated `DELREQUIRES` (detected via `grep '^DELREQUIRES="..*"'`) resp. `NODOWNLOAD=yes` (via `grep -qi '^NODOWNLOAD=yes'`), each padded with `_pad_glyph` so the multibyte glyph stays aligned. Hints with no `VERSION` are skipped (and excluded from the total). Version columns are 22 wide to fit long version strings. Coloring: rows where the two versions are byte-equal get the whole row yellow (and populate `MATCHED_PKGS` for `-R`); when they differ, `sort -V` picks the newer side and only that version cell is green (version strings are pre-padded to 22 before the color wrap so the escape bytes don't break alignment); an absent/empty `SBOVer` leaves the row plain. Color only on a TTY (or `MKHINT_FORCE_COLOR`); plain when piped. Legend `(yellow row = versions match; green = newer side)` prints when any row matched. With package names (`-l foo bar`), the table is skipped and each named hint is shown side by side with its `.info` via `_show_hint_diff` (shared with `--review`); missing hint → exit 2. - `--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 (rewriting the hint on confirm), then prompts slackrepo for all updated packages. `nvtake` (syncing nvchecker's oldver) is NOT called at hint-rewrite time; it fires from `run_slackrepo`, per package, only after you answer Y to the slackrepo question and just before slackrepo runs. So answering Y acknowledges the versions; if slackrepo is then stopped or fails, just rerun it and nvchecker won't re-report versions already committed. Declining slackrepo (n) leaves the hints bumped but oldver behind, so those updates re-report next run. The slackrepo action is chosen per package by `pkg_in_repo` (glob `PACKAGES_DIR/*/<pkg>/<pkg>-*.txz`): a package already built in `PACKAGES_DIR` gets `slackrepo update`, an absent one gets `slackrepo build`. `--check` partitions its updated set into built vs. fresh and prompts `update` then `build` separately (each only if its list is non-empty), both dispatched through the shared `run_slackrepo` helper. 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. @@ -131,7 +131,7 @@ When updating a hint with multiline DOWNLOAD, mkhint: ### List hint files -Lists each hint file with its `HintVer` (version in the hint), `SBOVer` (version in the repository `.info`), and a `DelReq` column showing `✓` when the hint carries a populated `DELREQUIRES`. 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 versions are equal are shown in yellow, so you can see at a glance which hints are now redundant with the upstream SBo version. When the versions differ, the newer of the two (decided with `sort -V`) is shown in green, so you can tell at a glance whether the hint or the repository is ahead. 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), `SBOVer` (version in the repository `.info`), a `DelReq` column showing `✓` when the hint carries a populated `DELREQUIRES`, and a `NoDL` column showing `✓` when the hint has `NODOWNLOAD=yes`. 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 versions are equal are shown in yellow, so you can see at a glance which hints are now redundant with the upstream SBo version. When the versions differ, the newer of the two (decided with `sort -V`) is shown in green, so you can tell at a glance whether the hint or the repository is ahead. Color is used only on a TTY; piped output is plain. A legend is printed when any row matched. With one or more package names (`-l foo bar`), the table is skipped; instead each named hint is shown side by side with its `.info` (`git diff --no-index` if git is available, otherwise `diff -y`). A missing hint exits 2. @@ -120,7 +120,7 @@ list_hint_files() { echo "Hint files in: $HINT_DIR" echo "=======================================================" - printf "%-40s %22s %22s %-20s %-6s %s\n" "File" "HintVer" "SBOVer" "Category" "DelReq" "Created" + printf "%-40s %22s %22s %-20s %-6s %-5s %s\n" "File" "HintVer" "SBOVer" "Category" "DelReq" "NoDL" "Created" echo "-------------------------------------------------------" MATCHED_PKGS=() @@ -132,6 +132,8 @@ list_hint_files() { [[ -z "$VER" ]] && continue local delreq="" grep -q '^DELREQUIRES="..*"' "$file" && delreq="✓" + local nodl="" + grep -qi '^NODOWNLOAD=yes' "$file" && nodl="✓" local name; name=$(basename "$file") local pkg="${name%.hint}" local info_file @@ -144,13 +146,14 @@ list_hint_files() { fi local date; date=$(stat -c "%y" "$file" | cut -d'.' -f1) local dr; dr=$(_pad_glyph "$delreq" 6) + local nd; nd=$(_pad_glyph "$nodl" 5) local hv sv hv=$(printf "%22s" "$VER") sv=$(printf "%22s" "$SBO_VER") if [[ -n "$SBO_VER" && "$VER" == "$SBO_VER" ]]; then # equal → whole row yellow local row - row=$(printf "%-40s %s %s %-20s %s %s" "$name" "$hv" "$sv" "$category" "$dr" "$date") + row=$(printf "%-40s %s %s %-20s %s %s %s" "$name" "$hv" "$sv" "$category" "$dr" "$nd" "$date") printf "%s%s%s\n" "$c_on" "$row" "$c_off" MATCHED_PKGS+=("$pkg") matched=$((matched + 1)) @@ -165,7 +168,7 @@ list_hint_files() { sv="${g_on}${sv}${c_off}" fi fi - printf "%-40s %s %s %-20s %s %s\n" "$name" "$hv" "$sv" "$category" "$dr" "$date" + printf "%-40s %s %s %-20s %s %s %s\n" "$name" "$hv" "$sv" "$category" "$dr" "$nd" "$date" fi count=$((count + 1)) fi diff --git a/mkhint.1.gz b/mkhint.1.gz Binary files differindex 0b228e8..9ca085c 100644 --- a/mkhint.1.gz +++ b/mkhint.1.gz diff --git a/mkhint.1.md b/mkhint.1.md index aa458a7..28f294b 100644 --- a/mkhint.1.md +++ b/mkhint.1.md @@ -74,8 +74,9 @@ phantom dependency, ensure its hint carries the matching `DELREQUIRES`. Idempotent. Mutually exclusive with **-V**, **-f**, **-n**. **\--list**, **-l** \[*FILE*...] -: List all hint files with their hint version, `.info` version, and a -`DelReq` marker. With package names, show each hint side by side with its +: List all hint files with their hint version, `.info` version, a +`DelReq` marker (populated `DELREQUIRES`), and a `NoDL` marker +(`NODOWNLOAD=yes`). With package names, show each hint side by side with its `.info` instead of the table. **\--review**, **-R** \[*FILE*...] diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index b30273e..4c74501 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -1436,6 +1436,40 @@ echo "$out" | grep curl.hint | grep -q "✓" \ && { echo " FAIL: ✓ shown without DELREQUIRES"; (( FAIL++ )); ERRORS+=("T64 check"); } \ || { echo " PASS: no ✓ without DELREQUIRES"; (( PASS++ )); } +# ── T68: -l shows ✓ in NoDL for hint with NODOWNLOAD=yes ───────────────────── +echo "" +echo "T68: -l NoDL column shows ✓ when NODOWNLOAD=yes" +rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak 2>/dev/null +cat > "$MOCK_HINT/curl.hint" << 'EOF' +VERSION="8.5.0" +ARCH="x86_64" +DOWNLOAD="https://curl.se/download/curl-8.5.0.tar.gz" +MD5SUM="abc123def456abc123def456abc123de" +NODOWNLOAD=yes +EOF +out=$(run_mkhint -l 2>&1) +echo "$out" | grep -q "NoDL" \ + && { echo " PASS: NoDL header present"; (( PASS++ )); } \ + || { echo " FAIL: NoDL header missing"; echo "$out" | sed 's/^/ /'; (( FAIL++ )); ERRORS+=("T68 header"); } +echo "$out" | grep curl.hint | grep -q "✓" \ + && { echo " PASS: ✓ shown for NODOWNLOAD hint"; (( PASS++ )); } \ + || { echo " FAIL: ✓ missing"; echo "$out" | grep curl.hint | sed 's/^/ /'; (( FAIL++ )); ERRORS+=("T68 check"); } + +# ── T69: -l NoDL blank when no NODOWNLOAD ──────────────────────────────────── +echo "" +echo "T69: -l NoDL column blank when no NODOWNLOAD" +rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak 2>/dev/null +cat > "$MOCK_HINT/curl.hint" << 'EOF' +VERSION="8.5.0" +ARCH="x86_64" +DOWNLOAD="https://curl.se/download/curl-8.5.0.tar.gz" +MD5SUM="abc123def456abc123def456abc123de" +EOF +out=$(run_mkhint -l 2>&1) +echo "$out" | grep curl.hint | grep -q "✓" \ + && { echo " FAIL: ✓ shown without NODOWNLOAD"; (( FAIL++ )); ERRORS+=("T69 check"); } \ + || { echo " PASS: no ✓ without NODOWNLOAD"; (( PASS++ )); } + # ── T65: mkhint -v prints tool version ─────────────────────────────────────── echo "" echo "T65: -v prints 'mkhint <version>' and exits 0" |
