aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-revdepends
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-03-12 13:58:36 +0000
committermerakor <cem@ckyln.com>2021-03-12 13:58:36 +0000
commitfc8de2a8f48485ad8b035a4e76098c4a7dbadb05 (patch)
tree8334227f749afc03c992f7d17edbf72cb5bd6ba8 /contrib/cpt-revdepends
parentf7d3e9f6771a75bff790c569a149f0fee1d28f41 (diff)
downloadcpt-fc8de2a8f48485ad8b035a4e76098c4a7dbadb05.tar.gz
docs: update
FossilOrigin-Name: 143ea57c3d8309faf15399199d0e2930f07371a34c08ff16e9a9f5fbb0be6a23
Diffstat (limited to 'contrib/cpt-revdepends')
-rwxr-xr-xcontrib/cpt-revdepends30
1 files changed, 29 insertions, 1 deletions
diff --git a/contrib/cpt-revdepends b/contrib/cpt-revdepends
index 36fe4fa..833dea2 100755
--- a/contrib/cpt-revdepends
+++ b/contrib/cpt-revdepends
@@ -1,5 +1,25 @@
#!/bin/sh -e
-# Display packages which depend on package
+# Display packages which depend on the given package
+
+## SYNOPSIS:
+## .Nm
+## .Op Fl tm
+## .Op Ar package
+## DESCRIPTION:
+## .Nm
+## generates reverse dependencies for
+## .Ar package .
+## If no package name is given,
+## .Nm
+## uses the name of the current directory for the package.
+##
+## Following options are available for use::
+## .Bl -tag
+## .It Fl t , -tree
+## Also print indirect reverse dependencies
+## .It Fl m , -make
+## Include make dependencies
+## .El
parser_definition() {
setup REST help:usage -- "usage: ${0##*/} [options...] [pkg...]"
@@ -8,22 +28,30 @@ parser_definition() {
global_options
}
+# shellcheck disable=1091
. cpt-lib; set +f
[ "$1" ] || set -- "${PWD##*/}"
# 'cd' to the database directory as a simple way of
# stripping the path and performing a 'basename'.
+#
+# $sys_db is defined on cpt-lib
+# shellcheck disable=2154
cd "$sys_db"
get_revdep() {
query="^$1\$"
+ # Defined by parser.
+ # shellcheck disable=2154
[ "$make" ] && query="$query\\|^$1 *make\$"
grep "$query" -- */depends | while read -r pkg _; do
printf '%s\n' "${pkg%%/*}"
done
}
+# Defined by parser.
+# shellcheck disable=2154
if [ "$tree" ]; then
create_cache nobuild
:> "$tmp_dir/processed"