mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-21 22:50:07 -07:00
kiss-repo(rev)depends: same utility to search in repositories instead
This commit is contained in:
parent
7740c929a3
commit
b9a8f9fc28
16
contrib/kiss-repodepends
Executable file
16
contrib/kiss-repodepends
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh -ef
|
||||
# Display a package's dependencies in repositories
|
||||
|
||||
pkg=${1:-"${PWD##*/}"}
|
||||
|
||||
kiss search "$pkg" >/dev/null || {
|
||||
printf 'usage: kiss-depends [pkg]\n' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
kiss search "$pkg" | while read -r pkgpath; do
|
||||
printf '=> %s\n' "$pkgpath"
|
||||
while read -r dep mak || [ "$dep" ]; do
|
||||
printf '%s%s\n' "$dep" "${mak:+ "$mak"}"
|
||||
done 2>/dev/null < "$pkgpath/depends"
|
||||
done
|
19
contrib/kiss-reporevdepends
Executable file
19
contrib/kiss-reporevdepends
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Display packages in all repositories which depend on a package
|
||||
|
||||
[ "$1" ] || set -- "${PWD##*/}"
|
||||
|
||||
suffix () {
|
||||
case "$1" in *"$2") return 0; esac; return 1
|
||||
}
|
||||
|
||||
IFS=:
|
||||
for repo in $KISS_PATH; do
|
||||
# remove trailing slashes
|
||||
while suffix "$repo" /; do repo="${repo%/}"; done
|
||||
gitdir="$(git -C "$repo" rev-parse --show-toplevel 2>/dev/null || echo "$repo")"
|
||||
case "$gitdir" in "$repo") unset prefix ;; *) prefix="${repo##*/}/" ;; esac
|
||||
|
||||
cd "$gitdir/.." || continue
|
||||
grep -E "^$1([[:space:]]|$)" -- "${gitdir##*/}/$prefix"*/depends 2>/dev/null ||:
|
||||
done
|
Loading…
Reference in New Issue
Block a user