aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-24 16:41:11 +0200
committerDanilo M. <danix@danix.xyz>2026-06-24 16:41:11 +0200
commit5d688d633267d560c343168380db835044dfb920 (patch)
treed46a620cf72b7647f2125bcfcc705b9e50944bf6
parent9fb5b8b84b7822eb8a5aff2b0aaa176a15ff7a4f (diff)
downloadsbo-batch-tester-5d688d633267d560c343168380db835044dfb920.tar.gz
sbo-batch-tester-5d688d633267d560c343168380db835044dfb920.zip
Add version_of .info reader + test
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xsbo-batch-test11
-rwxr-xr-xtest-logic.sh5
2 files changed, 16 insertions, 0 deletions
diff --git a/sbo-batch-test b/sbo-batch-test
index c5e6cf1..01280a3 100755
--- a/sbo-batch-test
+++ b/sbo-batch-test
@@ -397,6 +397,17 @@ read_requires() {
( set +u; source "$info"; echo "${REQUIRES:-}" )
}
+# Echo the VERSION field from a SlackBuild dir's .info (empty if unreadable).
+# Used as the cache key's version component.
+version_of() {
+ local dir="$1"
+ local info="$dir/$(basename "$dir").info"
+ [[ -f "$info" ]] || return
+ # .info lines look like: VERSION="1.2.3"
+ local v; v="$(grep -m1 '^VERSION=' "$info" | cut -d'"' -f2)"
+ echo "$v"
+}
+
# =============================================================================
# DEPENDENCY RESOLUTION
# Builds a topological order over the local SBo tree.
diff --git a/test-logic.sh b/test-logic.sh
index 4505ecb..797041f 100755
--- a/test-logic.sh
+++ b/test-logic.sh
@@ -138,6 +138,11 @@ count=$(find "$PKG_CACHE/net/libfoo" -name '*.t?z' | wc -l)
[[ -e "$PKG_CACHE/net/libfoo/libfoo-1.2-x86_64-1_danix.txz" ]] && ok "cache_store stored new file" || bad "cache_store did not store new file"
rm -rf "$srctmp"
+# version_of reads VERSION from .info
+mkdir -p "$T/cat/verpkg"
+printf 'PRGNAM="verpkg"\nVERSION="3.4.5"\nREQUIRES=""\n' > "$T/cat/verpkg/verpkg.info"
+[[ "$(version_of "$T/cat/verpkg")" == "3.4.5" ]] && ok "version_of reads VERSION" || bad "version_of wrong, got [$(version_of "$T/cat/verpkg")]"
+
# --- result -----------------------------------------------------------------
echo
echo "$pass passed, $fail failed"