diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-04 18:07:58 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-04 18:07:58 +0200 |
| commit | 5802fe326ae787bfe7d184539416eff2cf9b123b (patch) | |
| tree | 27b03280b3b5ee8e6b1be47522ce9294b31da6d4 | |
| parent | d8adfca97dadff4d59c3dfb26f0b0c95542d9a69 (diff) | |
| download | mkhintfile-5802fe326ae787bfe7d184539416eff2cf9b123b.tar.gz mkhintfile-5802fe326ae787bfe7d184539416eff2cf9b123b.zip | |
docs: add CHANGELOG, document SemVer and -V/--set-version renamev1.0.0
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | CHANGELOG.md | 20 | ||||
| -rw-r--r-- | CLAUDE.md | 41 | ||||
| -rw-r--r-- | README.md | 22 |
3 files changed, 56 insertions, 27 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..231c836 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +All notable changes to this project are documented here. The format is based on +[Keep a Changelog](https://keepachangelog.com/), and this project adheres to +[Semantic Versioning](https://semver.org/). + +## [1.0.0] - 2026-07-04 + +First tagged release. mkhint manages slackrepo hint files: create/update hints, +nvchecker-driven update checks, phantom-dep stripping for -current, and a +listing/review workflow. + +### Changed +- **Breaking:** the hint-version flag is now `-V` / `--set-version`. `-v` / + `--version` now prints the tool's own version and exits. + +### Added +- `-v` / `--version` prints `mkhint X.Y.Z`. +- The `--help` header shows the version. +- `-l` colors the newer version cell green and adds a `DelReq` column. @@ -8,6 +8,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Configuration +The tool version is a `readonly MKHINT_VERSION` constant near the top of `mkhint`. `-v` / `--version` prints `mkhint <version>` and exits; the `--help` header shows it too. Setting a hint's version string uses `-V` / `--set-version` (renamed from the old `-v`). Project follows SemVer; releases tagged `vX.Y.Z`, bump `MKHINT_VERSION` in the tagging commit. See `CHANGELOG.md`. + Two paths hardcoded near top of `mkhint` (lines 16–17): ```bash @@ -44,14 +46,14 @@ bash mkhint --list # highlight hints whose version match bash mkhint --list mypackage # side-by-side hint vs .info (no table) bash mkhint --review # review matched hints: diff + [K]eep/[D]elete/[S]kip bash mkhint --list --review # show highlighted table, then review -bash mkhint --version 2.0.1 --hintfile mypackage -bash mkhint --version 1.2.3 --new mypackage +bash mkhint --set-version 2.0.1 --hintfile mypackage +bash mkhint --set-version 1.2.3 --new mypackage bash mkhint --new mypackage # keep VERSION from .info, no downloads -bash mkhint --version 2.0.1 --hintfile mypackage --no-dl # downloads + md5 + NODOWNLOAD=yes +bash mkhint --set-version 2.0.1 --hintfile mypackage --no-dl # downloads + md5 + NODOWNLOAD=yes bash mkhint --new mypackage --no-dl # create hint with NODOWNLOAD=yes bash mkhint --delete mypackage bash mkhint --clean -bash mkhint --hintfile mypackage # suggest latest version via nvchecker (no -v) +bash mkhint --hintfile mypackage # suggest latest version via nvchecker (no -V) bash mkhint --check # check all hints for upstream updates bash mkhint --check pkg1 pkg2 # check specific packages ``` @@ -69,31 +71,31 @@ Test coverage: | ID | Scenario | |-----|----------| | T1 | `--new` from `.info`, no version — template copied, VERSION kept from .info | -| T2 | `--new -v` — version updated, md5 recalculated | +| T2 | `--new -V` — version updated, md5 recalculated | | T3 | `--new -N` no version — NODOWNLOAD=yes added, no downloads | -| T4 | `--new -v -N` — version + md5 + NODOWNLOAD=yes | +| T4 | `--new -V -N` — version + md5 + NODOWNLOAD=yes | | T5 | `--new` when hint exists — backup + empty skeleton | -| T6 | `--hintfile -v` single URL — version + md5 updated, backup created | -| T7 | `--hintfile -v -N` — version + md5 + NODOWNLOAD=yes | +| T6 | `--hintfile -V` single URL — version + md5 updated, backup created | +| T7 | `--hintfile -V -N` — version + md5 + NODOWNLOAD=yes | | T8 | `DOWNLOAD=UNSUPPORTED`, `DOWNLOAD_x86_64` has URL — 32-bit skipped, x86_64 md5 recalculated | | T9 | `-N` alone — exits 1 | | T10 | `--hintfile` on nonexistent file — exits 2 | | T11 | `--delete` — removes hint and .bak | | T12 | `--delete` nonexistent — exits 2 | | T13 | `--new` multiline `.info`, no version — template copied, original md5s kept | -| T14 | `--new` multiline `.info` with `-v` — first URL+md5 updated, continuation md5 kept | +| T14 | `--new` multiline `.info` with `-V` — first URL+md5 updated, continuation md5 kept | | T15 | `--clean` — removes all .bak files | | T16 | `--new` github .info — [pkg] source=github appended to nvchecker config | | T17 | `--new` pypi .info — [pkg] source=pypi appended to nvchecker config | | T18 | `--new` unrecognised URL — commented stub [pkg] appended to nvchecker config | | T19 | `--new` when [pkg] exists in config — not duplicated | -| T20 | `--hintfile` no -v, accept suggestion — VERSION=latest, nvtake called | -| T21 | `--hintfile` no -v, type override — VERSION=typed value | -| T22 | `--hintfile` no -v, no nvchecker result — graceful abort, hint unchanged | +| T20 | `--hintfile` no -V, accept suggestion — VERSION=latest, nvtake called | +| T21 | `--hintfile` no -V, type override — VERSION=typed value | +| T22 | `--hintfile` no -V, no nvchecker result — graceful abort, hint unchanged | | T23 | `--check` one outdated, confirm — updated, nvtake, slackrepo prompted | | T24 | `--check` all current — "all up to date", no slackrepo | | T25 | `--check` mixed — decline one / accept one | -| T26 | `--check` with -v — mutually-exclusive error, exit 1 | +| T26 | `--check` with -V — mutually-exclusive error, exit 1 | | T27 | `--check` upstream older than hint — reported as `(?downgrade)` | | T28 | `--check` no args — scans entire HINT_DIR | | T29 | `--check` missing section, accept populate — github section appended, run stops, hint unchanged | @@ -119,7 +121,7 @@ Test coverage: | T53 | `--fix-current` existing manual hint — `.bak` made, `DELREQUIRES` merged, other vars intact | | 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 | +| T56 | `--fix-current` with `-V` — mutually-exclusive error, exit 1 | | T57 | `-l` skips hints with no `VERSION`; count excludes them | | T58 | `-l <pkg>` shows side-by-side hint vs `.info`, not the table | | T59 | `-l <missing>` — exit 2 | @@ -128,20 +130,23 @@ 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 | +| 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) | When adding new features, add a corresponding test case to `tests/mkhint_test.sh`. ## Key Behaviors - `--hintfile` update: backs up to `.bak`, replaces old version string globally via `sed`, re-downloads both URLs to recalculate MD5 checksums. Skips download if value is `UNSUPPORTED` or `UNTESTED`. -- `--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` 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. +- `--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` 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. - `--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. +- `--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. -- `--fix-current` / `-F`: bulk sweep. Loads `PHANTOM_DEPS_FILE`, scans every `.info` in `REPO_DIR`, and for each package whose REQUIRES contains a phantom dep, ensures its hint carries the matching `DELREQUIRES`. No existing hint → create a minimal `DELREQUIRES="..."` file. Existing hint → back up to `.bak` and union the phantom deps into its `DELREQUIRES` line (dedup), leaving all other content untouched. Idempotent: if the deps are already present, the file is left alone and no `.bak` is written. No per-package prompts, safe under `set -e`. Mutually exclusive with `-v`/`-f`/`-n` (exit 1). Empty/missing list → "Nothing to do", exit 0. Helpers: `load_phantom_deps`, `phantom_deps_in_info`, `merge_delrequires`, `fix_current`. +- `--fix-current` / `-F`: bulk sweep. Loads `PHANTOM_DEPS_FILE`, scans every `.info` in `REPO_DIR`, and for each package whose REQUIRES contains a phantom dep, ensures its hint carries the matching `DELREQUIRES`. No existing hint → create a minimal `DELREQUIRES="..."` file. Existing hint → back up to `.bak` and union the phantom deps into its `DELREQUIRES` line (dedup), leaving all other content untouched. Idempotent: if the deps are already present, the file is left alone and no `.bak` is written. No per-package prompts, safe under `set -e`. Mutually exclusive with `-V`/`-f`/`-n` (exit 1). Empty/missing list → "Nothing to do", exit 0. Helpers: `load_phantom_deps`, `phantom_deps_in_info`, `merge_delrequires`, `fix_current`. - `--new` phantom-dep hook: after commenting out REQUIRES, `create_new_hint_file` appends `DELREQUIRES="..."` for any phantom dep found in the `.info` REQUIRES. Same list as `--fix-current`. - `--delete` / `-d`: removes hint file and `.bak` if present. Accepts multiple package names. Exits 2 on first missing file. - Downloads go to `/tmp/mkhint/download` (single shared temp file, deleted after md5 calculation). @@ -52,8 +52,8 @@ The `--fix-current` / `--new` phantom-dependency list is read from `~/.config/mk Updates the package version, downloads the archive, and recalculates the MD5 checksums: ```bash -mkhint --hintfile mypackage --version 2.0.1 -mkhint -f mypackage -v 2.0.1 +mkhint --hintfile mypackage --set-version 2.0.1 +mkhint -f mypackage -V 2.0.1 ``` Replaces the old version string with 2.0.1 everywhere in mypackage.hint, re-downloads the URLs from DOWNLOAD and DOWNLOAD_x86_64, and updates MD5SUM and MD5SUM_x86_64. Backs up the old file to mypackage.hint.bak first. @@ -65,18 +65,18 @@ URLs set to `UNSUPPORTED` or `UNTESTED` are skipped. Downloads and recalculates checksums, then appends `NODOWNLOAD=yes` to tell slackrepo to skip checksum verification at build time: ```bash -mkhint -f mypackage -v 2.0.1 -N -mkhint --hintfile mypackage --version 2.0.1 --no-dl +mkhint -f mypackage -V 2.0.1 -N +mkhint --hintfile mypackage --set-version 2.0.1 --no-dl ``` ### Create a new hint file from .info -Copies the corresponding .info file as a template, removes PRGNAM, HOMEPAGE, MAINTAINER, EMAIL, comments out REQUIRES, and sets ARCH to x86_64. If `-v` is given, the version string is updated and checksums are recalculated: +Copies the corresponding .info file as a template, removes PRGNAM, HOMEPAGE, MAINTAINER, EMAIL, comments out REQUIRES, and sets ARCH to x86_64. If `-V` is given, the version string is updated and checksums are recalculated: ```bash mkhint --new mypackage # copy .info as-is, keep VERSION from .info -mkhint -n mypackage -v 1.2.3 # copy .info, update version + recalculate md5 -mkhint -n mypackage -v 1.2.3 -N # same, also add NODOWNLOAD=yes +mkhint -n mypackage -V 1.2.3 # copy .info, update version + recalculate md5 +mkhint -n mypackage -V 1.2.3 -N # same, also add NODOWNLOAD=yes mkhint -n mypackage -N # copy .info, add NODOWNLOAD=yes, no downloads ``` @@ -155,7 +155,7 @@ mkhint --new mypackage # adds [mypackage] section to nvchecker config When updating an existing hint file with `--hintfile` but without `-v`, mkhint queries nvchecker for the latest version, shows you the current and latest versions, and prompts to accept the latest, type a different version, or decline. After accepting an update, it runs `nvtake` to sync nvchecker's keyfile: ```bash -mkhint --hintfile mypackage # suggests latest version via nvchecker (no -v flag) +mkhint --hintfile mypackage # suggests latest version via nvchecker (no -V flag) ``` Check one or more packages for upstream updates with `--check`. mkhint runs nvchecker for all (or named) hint files, reports outdated packages, prompts per-package to update, applies updates with `nvtake`, and finishes with a single `slackrepo update` prompt for all updated packages: @@ -246,7 +246,11 @@ mkhint -h - If DOWNLOAD or DOWNLOAD_x86_64 is `UNSUPPORTED` or `UNTESTED`, that URL is skipped and its MD5SUM is left unchanged. - `--no-dl` / `-N` does **not** skip downloads — it downloads and recalculates checksums as normal, then appends `NODOWNLOAD=yes` to the hint file. - After a successful `--hintfile` update, mkhint prompts `Run 'slackrepo update <package>'? [Y/n]`. Enter or `y` runs slackrepo immediately; `n` skips. -- Bash completion for `-f`/`--hintfile`, `-n`/`--new`, `-d`/`--delete`, `-C`/`--check`, `-R`/`--review`, and `-l`/`--list` autocompletes package names from their respective directories (`-l` and `-R` complete hint names repeatedly, for any number of packages). When `-f <package>` is already on the command line, `-v [TAB]` suggests the current `VERSION` from that package's hint file. If the hint file is absent, no version is suggested. Short flags (`-v`, `-f`, `-n`, `-l`, `-R`, `-c`, `-d`, `-C`, `-N`, `-h`) and their long forms (including `--review`) are also completed. +- Bash completion for `-f`/`--hintfile`, `-n`/`--new`, `-d`/`--delete`, `-C`/`--check`, `-R`/`--review`, and `-l`/`--list` autocompletes package names from their respective directories (`-l` and `-R` complete hint names repeatedly, for any number of packages). When `-f <package>` is already on the command line, `-V [TAB]` suggests the current `VERSION` from that package's hint file. If the hint file is absent, no version is suggested. Short flags (`-v`, `-V`, `-f`, `-n`, `-l`, `-R`, `-c`, `-d`, `-C`, `-N`, `-h`) and their long forms (including `--review`) are also completed. + +## Versioning + +This project follows [Semantic Versioning](https://semver.org/). Commits use [Conventional Commits](https://www.conventionalcommits.org/): `feat:` bumps the minor version, `fix:` the patch version, and a `!` / `BREAKING CHANGE` the major version. Releases are tagged `vX.Y.Z`; the version is stored in `MKHINT_VERSION` in the `mkhint` script. `mkhint -v` (or `--version`) prints it. See [CHANGELOG.md](CHANGELOG.md). ## Development Approach |
