ccf8dbd3eafe246f3233e3aa98a9677a2b2b4494

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Fix PKGBUILD review script

Diff

 1diff --git a/dot_local/bin/executable_pkgbuild-review b/dot_local/bin/executable_pkgbuild-review
 2index 163f780fdddd8fa8130fd94aea8c14cd47a4a109..e76ea7913660b0202e43478fb2b86759c25402f3 100755
 3--- a/dot_local/bin/executable_pkgbuild-review
 4+++ b/dot_local/bin/executable_pkgbuild-review
 5@@ -87,6 +87,10 @@ review_one() {
 6 
 7     local pkgname pkgver sha cache_file
 8     pkgname=$(grep -m1 '^pkgname=' "$pkgbuild" | cut -d= -f2 | tr -d '"'"'"' ')
 9+    if [[ "$pkgname" == \$* ]]; then
10+        local varname="${pkgname#\$}"; varname="${varname#\{}"; varname="${varname%\}}"
11+        pkgname=$(grep -m1 "^${varname}=" "$pkgbuild" | cut -d= -f2 | tr -d '"'"'"' ')
12+    fi
13     pkgver=$(grep -m1 '^pkgver=' "$pkgbuild" | cut -d= -f2 | tr -d '"'"'"' ')
14     sha=$(sha256sum "$pkgbuild" | cut -d' ' -f1)
15     cache_file="$CACHE_DIR/$pkgname.sha256"
16@@ -129,7 +133,7 @@ review_one() {
17 
18     case "$verdict" in
19         SAFE)
20-            printf '[%s %s] %sSAFE%s\n' "$pkgname" "$pkgver" "$vc" "$RESET"
21+            printf "[%s %s] ${vc}SAFE${RESET}\n" "$pkgname" "$pkgver"
22             printf '%s' "$sha" > "$cache_file"
23             return 0
24             ;;