aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CLAUDE.md28
-rw-r--r--README.md42
2 files changed, 66 insertions, 4 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index e464d97..f6578bf 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -17,6 +17,14 @@ HINT_DIR="/etc/slackrepo/SBo-danix/hintfiles/" # where .hint files live
Bash completion script has its own hardcoded copies (lines 8–9) — keep in sync when changing defaults.
+nvchecker config path is read from `$HOME/.config/nvchecker/nvchecker.toml` (not hardcoded):
+
+```bash
+NVCHECKER_CONFIG="$HOME/.config/nvchecker/nvchecker.toml"
+```
+
+User must set up the `[__config__]` section once before version-checking features work. Bash completion now also knows `--check`/`-C`.
+
## Running / Testing
No build step. Direct execution:
@@ -31,6 +39,9 @@ bash mkhint --version 2.0.1 --hintfile mypackage --no-dl # downloads + md5 + N
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 --check # check all hints for upstream updates
+bash mkhint --check pkg1 pkg2 # check specific packages
```
### Automated test suite
@@ -60,14 +71,27 @@ Test coverage:
| T13 | `--new` multiline `.info`, no version — template copied, original md5s 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 |
+| 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 |
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.
+- `--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.
+- `--check` / `-C`: runs nvchecker for all (or named) hints, 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.
- `--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.
- `--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).
@@ -81,7 +105,7 @@ When adding new features, add a corresponding test case to `tests/mkhint_test.sh
| 1 | Invalid arguments |
| 2 | File not found |
| 3 | File already exists (unused — backup logic replaces this) |
-| 4 | wget not available |
+| 4 | Required tool not available (wget/nvchecker/nvtake/jq) |
## Installation
diff --git a/README.md b/README.md
index db659a8..e71429d 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,12 @@ sudo cp mkhint /usr/local/bin/mkhint
sudo cp mkhint.bash-completion /etc/bash-completion.d/mkhint
```
+### Dependencies
+
+- `wget` — for downloading archives and calculating checksums
+- `nvchecker` — for checking upstream versions (provides `nvchecker` and `nvtake`)
+- `jq` — for parsing version check results
+
### Configuration
Edit the paths at the top of mkhint to match your setup (lines 16–17):
@@ -27,6 +33,16 @@ HINT_DIR="/etc/slackrepo/SBo-danix/hintfiles/" # Directory where .hint files ar
Keep the same paths in sync in `mkhint.bash-completion` (lines 8–9).
+nvchecker reads its configuration from `~/.config/nvchecker/nvchecker.toml`. You must set up the `[__config__]` section with oldver and newver keyfile paths before using version-checking features:
+
+```toml
+[__config__]
+oldver = "/var/lib/nvchecker/oldver"
+newver = "/var/lib/nvchecker/newver"
+```
+
+mkhint only appends package-specific `[section]` entries to this file; the `[__config__]` section must be created manually once.
+
## Usage
### Update an existing hint file
@@ -108,6 +124,28 @@ mkhint --clean
mkhint -c
```
+### Check for upstream updates
+
+When creating a new hint file with `--new`, mkhint automatically appends an nvchecker configuration section, auto-detecting the source (github, pypi, etc.) or providing a commented template. A notice is printed so you can review and fill in any missing details:
+
+```bash
+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)
+```
+
+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:
+
+```bash
+mkhint --check # check all hints for upstream updates
+mkhint --check pkg1 pkg2 # check specific packages
+mkhint -C # short form
+```
+
### Help
```bash
@@ -123,7 +161,7 @@ mkhint -h
| 1 | Invalid arguments |
| 2 | File not found |
| 3 | File already exists (unused — backup logic replaces this) |
-| 4 | wget not available |
+| 4 | Required tool not available (wget/nvchecker/nvtake/jq) |
## Hint File Variables
@@ -143,4 +181,4 @@ 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`, and `-d`/`--delete` autocompletes package names from their respective directories. 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`, `-c`, `-d`, `-N`, `-h`) are also completed.
+- Bash completion for `-f`/`--hintfile`, `-n`/`--new`, `-d`/`--delete`, and `-C`/`--check` autocompletes package names from their respective directories. 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`, `-c`, `-d`, `-C`, `-N`, `-h`) are also completed.