diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-13 17:56:26 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-13 17:56:26 +0200 |
| commit | aadbfb4f261c4ab5c69548c4f317dcfa724a4341 (patch) | |
| tree | c211087a712e410b0707a64843cb5d2884afbac9 /mkhint | |
| parent | 43f6015ad81f791f89a78e1eb85c051e586612fc (diff) | |
| download | mkhintfile-aadbfb4f261c4ab5c69548c4f317dcfa724a4341.tar.gz mkhintfile-aadbfb4f261c4ab5c69548c4f317dcfa724a4341.zip | |
refactor: extract _has_nvchecker_section helper
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
| -rwxr-xr-x | mkhint | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -6,9 +6,10 @@ # ./mkhint --version VERSION --hintfile FILE Update existing hint file # ./mkhint --version VERSION --new FILE Create new hint file # ./mkhint --new FILE Create new hint file (no version) +# ./mkhint --hintfile FILE Update hint, suggest latest version via nvchecker +# ./mkhint --check [FILE...] Check all (or named) hints for upstream updates # ./mkhint --list List hint files # ./mkhint --clean Remove .bak files from HINT_DIR -# ./mkhint --delete FILE Delete a hint file (and .bak if present) # ./mkhint --no-dl --hintfile FILE Update hint, skip downloads, add NODOWNLOAD=yes # ./mkhint --no-dl --new FILE Create hint with NODOWNLOAD=yes # ./mkhint --help Show this help @@ -260,6 +261,13 @@ EOF fi } +# Return 0 if NVCHECKER_CONFIG already has a [pkg] section +_has_nvchecker_section() { + local pkg="$1" + [[ -f "$NVCHECKER_CONFIG" ]] || return 1 + grep -qE "^\[${pkg}\][[:space:]]*$" "$NVCHECKER_CONFIG" +} + # Append an nvchecker [pkg] section to NVCHECKER_CONFIG, auto-detecting the # source from the package's .info DOWNLOAD/HOMEPAGE. No-op if section exists. add_nvchecker_section() { @@ -271,7 +279,7 @@ add_nvchecker_section() { touch "$NVCHECKER_CONFIG" # Skip if section already present - if grep -qE "^\[${pkg}\][[:space:]]*$" "$NVCHECKER_CONFIG"; then + if _has_nvchecker_section "$pkg"; then echo "nvchecker: [${pkg}] already present in $NVCHECKER_CONFIG" return 0 fi |
