[packages/rpm-pld-macros/rpm.org] avoid autodep pattern '()' on empty input

atler atler at pld-linux.org
Fri Feb 12 19:20:28 CET 2021


commit da3376844c7153a74fbc95faa71d7367b82f77d0
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri Feb 12 19:18:12 2021 +0100

    avoid autodep pattern '()' on empty input
    
    matches everything otherwise and results in no autoreqs/autodeps
    whatsoever

 macros.pld | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/macros.pld b/macros.pld
index b267976..7292648 100644
--- a/macros.pld
+++ b/macros.pld
@@ -1153,15 +1153,17 @@ fi; \
 	RS = "\n([ \t]+\n)+";
 	FS = " ";
 	split(x, F);
-	printf("(");
-	for (i=1; i<=length(F); i++) {
-		s = F[i];
-		sub(/#.*/, "z&z", s);
-		if (s ~ /^$/) { continue; };
-		printf(s);
-		if (i != length(F)) { printf("|"); };
-	};
-	printf(")");
+	if (length(F) > 0) {
+		printf("(");
+		for (i=1; i<=length(F); i++) {
+			s = F[i];
+			sub(/#.*/, "z&z", s);
+			if (s ~ /^$/) { continue; };
+			printf(s);
+			if (i != length(F)) { printf("|"); };
+		};
+		printf(")");
+	}
 }')
 %__requires_exclude_from	%{__noautodep_helper %{__noautoreqfiles}}
 %__provides_exclude_from	%{__noautodep_helper %{__noautoprovfiles}}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-pld-macros.git/commitdiff/da3376844c7153a74fbc95faa71d7367b82f77d0



More information about the pld-cvs-commit mailing list