From 107d6ff9f09106e7abfcf7e6b9a65f95edaf955c Mon Sep 17 00:00:00 2001
From: Max Rees <maxcrees@me.com>
Date: Fri, 1 May 2020 02:25:05 -0500
Subject: checkapk: simplify rdeps search by using origins only

---
 checkapk.in | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/checkapk.in b/checkapk.in
index f254821..3ffc91d 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -207,24 +207,13 @@ check_soname() {
 	fi
 
 	rdeps="$($APK search --repositories-file "$tmpdir/repositories" \
-		--rdepends --quiet --exact "$soname" | sort -u)"
-
-	real_rdeps=
-	for i in $rdeps; do
-		self=0
-		for j in $pkgname $subpackages; do
-			[ "$i" = "$j" ] || continue
-			self=1
-			break
-		done
-		[ "$self" -eq 0 ] && real_rdeps="$real_rdeps
-$i"
-	done
+		--rdepends --quiet --exact --origin "$soname" \
+		| sort -u | grep -Fvx "$pkgname")"
 
-	if [ -n "$real_rdeps" ]; then
-		warning "dependents on $soname:"
-		# (warning2)                                  >>> WARNING:
-		printf '%s\n' "$real_rdeps" | sed '/^$/d; s/^/             /' >&2
+	if [ -n "$rdeps" ]; then
+		warning "dependent origins on $soname:"
+		# (warning2)                             >>> WARNING:
+		printf '%s\n' "$rdeps" | sed '/^$/d; s/^/             /' >&2
 	else
 		msg "No dependents on $soname."
 	fi
-- 
cgit v1.2.3-70-g09d2