From a1359af5b5fad10ccba8b5e310d1dad91459ad36 Mon Sep 17 00:00:00 2001
From: Thomas Lange <lange@debian.org>
Date: Sat, 12 Aug 2017 05:18:23 +0200
Subject: [PATCH 4/6] There's no need to print the dependencies for each
 package separately, if when later do sort|uniq, so just collect all
 dependencies in a hash and print them at the end

---
 functions | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/functions b/functions
index dc287f8..8cf8c83 100644
--- a/functions
+++ b/functions
@@ -1319,19 +1319,11 @@ while (read STDIN, $x, 1) {
 		elif [ "$1" = "GETDEPS" ]; then
 			local pkgdest="$2"; shift; shift
 			perl -e '
-$prevpkg = "";
-@d = ();
 %seen = map { $_ => 1 } @ARGV;
 while (<STDIN>) {
 	if (/^Package: (.*)$/) {
 		$pkg = $1;
-		if ($pkg ne $prevpkg) {
-			for my $d (@d) {
-				print "$d\n";
-			}
-		}
-		$prevpkg = $1;
-		@d = ();
+		next;
 	} elsif (/^$/) {
                 $in = 0;
                 next;
@@ -1342,13 +1334,14 @@ while (<STDIN>) {
 			$d =~ s/\s*[|].*$//;
 			$d =~ s/\s*[(].*[)]\s*//;
 			$d =~ s/:.*//;
-			push @d, $d;
+			$depends{$d} = 1;
 		}
 	}
 }
-for my $d (@d) {
-	print "$d\n";
-}' <"$pkgdest" "$@" | sort | uniq
+	foreach (sort keys %depends) {
+	  print "$_\n";
+	}
+' <"$pkgdest" "$@"
 		elif [ "$1" = "PKGS" ]; then
 			local m="$2"
 			local p="$3"
-- 
2.11.0

