cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 2ed63a1b4e394cea78f864a7fe454c8d1b18c76b
parent f6fa78aa36776bff3d8a44ef5881079d4cc2ba18
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 11 May 2020 15:13:18 +0300

kiss: make sure directories and executables don't clash

kiss will no longer look for sys_db when called from extensions.
An alternate 'SEARCH_PATH' is used now to store KISS_PATH and sys_db
together. This SEARCH_PATH will be overriden by PATH if it is called
from extensions.

Diffstat:
Mkiss | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/kiss b/kiss @@ -131,18 +131,23 @@ pkg_lint() { } pkg_find() { + # Use a SEARCH_PATH variable so that we can get the sys_db into + # the same variable as KISS_PATH. This makes it easier when we are + # searching for executables instead of KISS_PATH. + : "${SEARCH_PATH:=$KISS_PATH:$sys_db}" + # Figure out which repository a package belongs to by # searching for directories matching the package name # in $KISS_PATH/*. - query=$1 match=$2 IFS=:; set -- + query=$1 match=$2 type=$3 IFS=:; set -- # Word splitting is intentional here. # shellcheck disable=2086 - for path in $KISS_PATH "$sys_db" ; do + for path in $SEARCH_PATH ; do set +f for path2 in "$path/"$query; do - [ -x "$path2" ] && set -f -- "$@" "$path2" + test "${type:--d}" "$path2" && set -f -- "$@" "$path2" done done @@ -1455,7 +1460,7 @@ args() { log "Installed extensions" set -- - for path in $(KISS_PATH=$PATH pkg_find kiss-* all); do + for path in $(SEARCH_PATH=$PATH pkg_find kiss-* all -x); do set -- "${path#*/kiss-}" "$@" max=$((${#1} > max ? ${#1} : max)) done @@ -1513,7 +1518,7 @@ args() { ;; *) - util=$(KISS_PATH=$PATH pkg_find "kiss-$action"* 2>/dev/null) || + util=$(SEARCH_PATH=$PATH pkg_find "kiss-$action"* "" -x 2>/dev/null) || die "'kiss $action' is not a valid command" "$util" "$@"