[packages/adapter: 274/631] - fix requires splitting with versions

glen glen at pld-linux.org
Mon Sep 12 19:57:25 CEST 2016


commit ba377afe8b2df7adf5d0f20744566e597e74ac10
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Sat Dec 31 13:07:44 2005 +0000

    - fix requires splitting with versions
    
    Changed files:
        adapter.awk -> 1.264

 adapter.awk | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index a5341c5..ca302e9 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -615,16 +615,13 @@ preamble == 1 {
 
 	# split (build)requires, obsoletes on commas
 	if (field ~ /(obsoletes|requires):/ && NF > 2) {
-		l = substr($0, index($0, $2));
-		n = split(l, p, / *,? */);
-		for (i in p) {
-			printf("%s\t%s\n", $1, p[i]);
-		}
-		next;
+		value = substr($0, index($0, $2));
+		$0 = format_requires($1, value);
 	}
 
-	if (field ~ /packager:|distribution:|docdir:|prefix:/)
+	if (field ~ /packager:|distribution:|docdir:|prefix:/) {
 		next
+	}
 
 	if (field ~ /buildroot:/)
 		$0 = $1 "%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
@@ -1274,3 +1271,20 @@ function kill_preamble_macros()
 		sub("\.sf\.net/$", ".sourceforge.net/", $2);
 	}
 }
+
+function format_requires(tag, value,	n, p, i, deps, ndeps) {
+	n = split(value, p, / *,? */);
+	for (i = 1; i <= n; i++) {
+		if (p[i+1] ~ /[<=>]/) {
+			deps[ndeps++] = p[i] " " p[i+1] " " p[i+2];
+			i += 2;
+		} else {
+			deps[ndeps++] = p[i];
+		}
+	}
+	s = ""
+	for (i in deps) {
+		s = s sprintf("%s\t%s\n", tag, deps[i]);
+	}
+	return substr(s, 1, length(s)-1);
+}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list