forked from kisslinux/kiss
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kiss-repo(rev)depends: same utility to search in repositories instead
- Loading branch information
1 parent
7740c92
commit b9a8f9f
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |