diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-13 17:57:05 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-13 17:57:05 +0200 |
| commit | bd881dbcfba6bfd1b49100cfb1282db990232ea2 (patch) | |
| tree | 4b564f3ab7c3543d5e216709a20ef6275c2d536c /mkhint | |
| parent | aadbfb4f261c4ab5c69548c4f317dcfa724a4341 (diff) | |
| download | mkhintfile-bd881dbcfba6bfd1b49100cfb1282db990232ea2.tar.gz mkhintfile-bd881dbcfba6bfd1b49100cfb1282db990232ea2.zip | |
feat: --check offers to populate missing nvchecker sections
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
| -rwxr-xr-x | mkhint | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -636,13 +636,22 @@ check_updates() { # Classify each target local outdated_pkgs=() outdated_old=() outdated_new=() outdated_flag=() + local missing_sections=() local pkg for pkg in "${targets[@]}"; do local hintpath="${HINT_DIR%/}/${pkg}.hint" [[ -f "$hintpath" ]] || { echo "skip ${pkg}: no hint file"; continue; } local current; current=$(grep '^VERSION=' "$hintpath" | sed 's/VERSION="//;s/"$//') local latest - latest=$(nvchecker_latest "$pkg") || { echo "skip ${pkg}: no nvchecker source"; continue; } + if ! latest=$(nvchecker_latest "$pkg"); then + if _has_nvchecker_section "$pkg"; then + echo "skip ${pkg}: no nvchecker result" + else + echo "skip ${pkg}: no nvchecker section" + missing_sections+=("$pkg") + fi + continue + fi [[ "$current" == "$latest" ]] && continue # up to date # determine direction with sort -V local newest; newest=$(printf '%s\n%s\n' "$current" "$latest" | sort -V | tail -1) @@ -654,6 +663,29 @@ check_updates() { outdated_flag+=("$flag") done + # Offer to populate nvchecker.toml for packages with no section + if [[ ${#missing_sections[@]} -gt 0 ]]; then + echo "" + echo "${#missing_sections[@]} package(s) have no nvchecker section: ${missing_sections[*]}" + local answer + read -r -p "Populate ${NVCHECKER_CONFIG} now? [Y/n] " answer + answer="${answer:-Y}" + if [[ "$answer" =~ ^[Yy]$ ]]; then + local mp info + for mp in "${missing_sections[@]}"; do + info=$(find "$REPO_DIR" -mindepth 2 -name "${mp}.info" 2>/dev/null | head -1) + if [[ -z "$info" ]]; then + echo "skip ${mp}: no .info found in $REPO_DIR" + continue + fi + add_nvchecker_section "$mp" "$info" + done + echo "" + echo "Sections added. Review $NVCHECKER_CONFIG (fill any stubs), then re-run 'mkhint -C'." + return 0 + fi + fi + if [[ ${#outdated_pkgs[@]} -eq 0 ]]; then echo "all up to date" return 0 |
